/******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 1062: /***/ (function(__unused_webpack_module, exports) { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); var key = { fullscreenEnabled: 0, fullscreenElement: 1, requestFullscreen: 2, exitFullscreen: 3, fullscreenchange: 4, fullscreenerror: 5, fullscreen: 6 }; var webkit = ['webkitFullscreenEnabled', 'webkitFullscreenElement', 'webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitfullscreenchange', 'webkitfullscreenerror', '-webkit-full-screen']; var moz = ['mozFullScreenEnabled', 'mozFullScreenElement', 'mozRequestFullScreen', 'mozCancelFullScreen', 'mozfullscreenchange', 'mozfullscreenerror', '-moz-full-screen']; var ms = ['msFullscreenEnabled', 'msFullscreenElement', 'msRequestFullscreen', 'msExitFullscreen', 'MSFullscreenChange', 'MSFullscreenError', '-ms-fullscreen']; // so it doesn't throw if no window or document var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {}; var vendor = 'fullscreenEnabled' in document && Object.keys(key) || webkit[0] in document && webkit || moz[0] in document && moz || ms[0] in document && ms || []; exports.A = { requestFullscreen: function requestFullscreen(element) { return element[vendor[key.requestFullscreen]](); }, requestFullscreenFunction: function requestFullscreenFunction(element) { return element[vendor[key.requestFullscreen]]; }, get exitFullscreen() { return document[vendor[key.exitFullscreen]].bind(document); }, get fullscreenPseudoClass() { return ':' + vendor[key.fullscreen]; }, addEventListener: function addEventListener(type, handler, options) { return document.addEventListener(vendor[key[type]], handler, options); }, removeEventListener: function removeEventListener(type, handler, options) { return document.removeEventListener(vendor[key[type]], handler, options); }, get fullscreenEnabled() { return Boolean(document[vendor[key.fullscreenEnabled]]); }, set fullscreenEnabled(val) {}, get fullscreenElement() { return document[vendor[key.fullscreenElement]]; }, set fullscreenElement(val) {}, get onfullscreenchange() { return document[('on' + vendor[key.fullscreenchange]).toLowerCase()]; }, set onfullscreenchange(handler) { return document[('on' + vendor[key.fullscreenchange]).toLowerCase()] = handler; }, get onfullscreenerror() { return document[('on' + vendor[key.fullscreenerror]).toLowerCase()]; }, set onfullscreenerror(handler) { return document[('on' + vendor[key.fullscreenerror]).toLowerCase()] = handler; } }; /***/ }), /***/ 6112: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ createCache; } }); ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js /* Based off glamor's StyleSheet, thanks Sunil ❤️ high performance StyleSheet for css-in-js systems - uses multiple style tags behind the scenes for millions of rules - uses `insertRule` for appending in production for *much* faster performance // usage import { StyleSheet } from '@emotion/sheet' let styleSheet = new StyleSheet({ key: '', container: document.head }) styleSheet.insert('#box { border: 1px solid red; }') - appends a css rule into the stylesheet styleSheet.flush() - empties the stylesheet of all its contents */ // $FlowFixMe function sheetForTag(tag) { if (tag.sheet) { // $FlowFixMe return tag.sheet; } // this weirdness brought to you by firefox /* istanbul ignore next */ for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { // $FlowFixMe return document.styleSheets[i]; } } } function createStyleElement(options) { var tag = document.createElement('style'); tag.setAttribute('data-emotion', options.key); if (options.nonce !== undefined) { tag.setAttribute('nonce', options.nonce); } tag.appendChild(document.createTextNode('')); tag.setAttribute('data-s', ''); return tag; } var StyleSheet = /*#__PURE__*/function () { // Using Node instead of HTMLElement since container may be a ShadowRoot function StyleSheet(options) { var _this = this; this._insertTag = function (tag) { var before; if (_this.tags.length === 0) { if (_this.insertionPoint) { before = _this.insertionPoint.nextSibling; } else if (_this.prepend) { before = _this.container.firstChild; } else { before = _this.before; } } else { before = _this.tags[_this.tags.length - 1].nextSibling; } _this.container.insertBefore(tag, before); _this.tags.push(tag); }; this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; this.tags = []; this.ctr = 0; this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets this.key = options.key; this.container = options.container; this.prepend = options.prepend; this.insertionPoint = options.insertionPoint; this.before = null; } var _proto = StyleSheet.prototype; _proto.hydrate = function hydrate(nodes) { nodes.forEach(this._insertTag); }; _proto.insert = function insert(rule) { // the max length is how many rules we have per style tag, it's 65000 in speedy mode // it's 1 in dev because we insert source maps that map a single rule to a location // and you can only have one source map per style tag if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { this._insertTag(createStyleElement(this)); } var tag = this.tags[this.tags.length - 1]; if (false) { var isImportRule; } if (this.isSpeedy) { var sheet = sheetForTag(tag); try { // this is the ultrafast version, works across browsers // the big drawback is that the css won't be editable in devtools sheet.insertRule(rule, sheet.cssRules.length); } catch (e) { if (false) {} } } else { tag.appendChild(document.createTextNode(rule)); } this.ctr++; }; _proto.flush = function flush() { // $FlowFixMe this.tags.forEach(function (tag) { return tag.parentNode && tag.parentNode.removeChild(tag); }); this.tags = []; this.ctr = 0; if (false) {} }; return StyleSheet; }(); ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Utility.js /** * @param {number} * @return {number} */ var abs = Math.abs /** * @param {number} * @return {string} */ var Utility_from = String.fromCharCode /** * @param {object} * @return {object} */ var Utility_assign = Object.assign /** * @param {string} value * @param {number} length * @return {number} */ function hash (value, length) { return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0 } /** * @param {string} value * @return {string} */ function trim (value) { return value.trim() } /** * @param {string} value * @param {RegExp} pattern * @return {string?} */ function Utility_match (value, pattern) { return (value = pattern.exec(value)) ? value[0] : value } /** * @param {string} value * @param {(string|RegExp)} pattern * @param {string} replacement * @return {string} */ function Utility_replace (value, pattern, replacement) { return value.replace(pattern, replacement) } /** * @param {string} value * @param {string} search * @return {number} */ function indexof (value, search) { return value.indexOf(search) } /** * @param {string} value * @param {number} index * @return {number} */ function Utility_charat (value, index) { return value.charCodeAt(index) | 0 } /** * @param {string} value * @param {number} begin * @param {number} end * @return {string} */ function Utility_substr (value, begin, end) { return value.slice(begin, end) } /** * @param {string} value * @return {number} */ function Utility_strlen (value) { return value.length } /** * @param {any[]} value * @return {number} */ function Utility_sizeof (value) { return value.length } /** * @param {any} value * @param {any[]} array * @return {any} */ function Utility_append (value, array) { return array.push(value), value } /** * @param {string[]} array * @param {function} callback * @return {string} */ function Utility_combine (array, callback) { return array.map(callback).join('') } ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Tokenizer.js var line = 1 var column = 1 var Tokenizer_length = 0 var position = 0 var character = 0 var characters = '' /** * @param {string} value * @param {object | null} root * @param {object | null} parent * @param {string} type * @param {string[] | string} props * @param {object[] | string} children * @param {number} length */ function node (value, root, parent, type, props, children, length) { return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} } /** * @param {object} root * @param {object} props * @return {object} */ function Tokenizer_copy (root, props) { return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) } /** * @return {number} */ function Tokenizer_char () { return character } /** * @return {number} */ function prev () { character = position > 0 ? Utility_charat(characters, --position) : 0 if (column--, character === 10) column = 1, line-- return character } /** * @return {number} */ function next () { character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0 if (column++, character === 10) column = 1, line++ return character } /** * @return {number} */ function peek () { return Utility_charat(characters, position) } /** * @return {number} */ function caret () { return position } /** * @param {number} begin * @param {number} end * @return {string} */ function slice (begin, end) { return Utility_substr(characters, begin, end) } /** * @param {number} type * @return {number} */ function token (type) { switch (type) { // \0 \t \n \r \s whitespace token case 0: case 9: case 10: case 13: case 32: return 5 // ! + , / > @ ~ isolate token case 33: case 43: case 44: case 47: case 62: case 64: case 126: // ; { } breakpoint token case 59: case 123: case 125: return 4 // : accompanied token case 58: return 3 // " ' ( [ opening delimit token case 34: case 39: case 40: case 91: return 2 // ) ] closing delimit token case 41: case 93: return 1 } return 0 } /** * @param {string} value * @return {any[]} */ function alloc (value) { return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, [] } /** * @param {any} value * @return {any} */ function dealloc (value) { return characters = '', value } /** * @param {number} type * @return {string} */ function delimit (type) { return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) } /** * @param {string} value * @return {string[]} */ function Tokenizer_tokenize (value) { return dealloc(tokenizer(alloc(value))) } /** * @param {number} type * @return {string} */ function whitespace (type) { while (character = peek()) if (character < 33) next() else break return token(type) > 2 || token(character) > 3 ? '' : ' ' } /** * @param {string[]} children * @return {string[]} */ function tokenizer (children) { while (next()) switch (token(character)) { case 0: append(identifier(position - 1), children) break case 2: append(delimit(character), children) break default: append(from(character), children) } return children } /** * @param {number} index * @param {number} count * @return {string} */ function escaping (index, count) { while (--count && next()) // not 0-9 A-F a-f if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) break return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) } /** * @param {number} type * @return {number} */ function delimiter (type) { while (next()) switch (character) { // ] ) " ' case type: return position // " ' case 34: case 39: if (type !== 34 && type !== 39) delimiter(character) break // ( case 40: if (type === 41) delimiter(type) break // \ case 92: next() break } return position } /** * @param {number} type * @param {number} index * @return {number} */ function commenter (type, index) { while (next()) // // if (type + character === 47 + 10) break // /* else if (type + character === 42 + 42 && peek() === 47) break return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next()) } /** * @param {number} index * @return {string} */ function identifier (index) { while (!token(peek())) next() return slice(index, position) } ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Enum.js var Enum_MS = '-ms-' var Enum_MOZ = '-moz-' var Enum_WEBKIT = '-webkit-' var COMMENT = 'comm' var Enum_RULESET = 'rule' var Enum_DECLARATION = 'decl' var PAGE = '@page' var MEDIA = '@media' var IMPORT = '@import' var CHARSET = '@charset' var VIEWPORT = '@viewport' var SUPPORTS = '@supports' var DOCUMENT = '@document' var NAMESPACE = '@namespace' var Enum_KEYFRAMES = '@keyframes' var FONT_FACE = '@font-face' var COUNTER_STYLE = '@counter-style' var FONT_FEATURE_VALUES = '@font-feature-values' var LAYER = '@layer' ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Serializer.js /** * @param {object[]} children * @param {function} callback * @return {string} */ function Serializer_serialize (children, callback) { var output = '' var length = Utility_sizeof(children) for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '' return output } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback * @return {string} */ function stringify (element, index, children, callback) { switch (element.type) { case LAYER: if (element.children.length) break case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value case COMMENT: return '' case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}' case Enum_RULESET: element.value = element.props.join(',') } return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' } ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Middleware.js /** * @param {function[]} collection * @return {function} */ function middleware (collection) { var length = Utility_sizeof(collection) return function (element, index, children, callback) { var output = '' for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '' return output } } /** * @param {function} callback * @return {function} */ function rulesheet (callback) { return function (element) { if (!element.root) if (element = element.return) callback(element) } } /** * @param {object} element * @param {number} index * @param {object[]} children * @param {function} callback */ function prefixer (element, index, children, callback) { if (element.length > -1) if (!element.return) switch (element.type) { case DECLARATION: element.return = prefix(element.value, element.length, children) return case KEYFRAMES: return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback) case RULESET: if (element.length) return combine(element.props, function (value) { switch (match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback) // :placeholder case '::placeholder': return serialize([ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}), copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}) ], callback) } return '' }) } } /** * @param {object} element * @param {number} index * @param {object[]} children */ function namespace (element) { switch (element.type) { case RULESET: element.props = element.props.map(function (value) { return combine(tokenize(value), function (value, index, children) { switch (charat(value, 0)) { // \f case 12: return substr(value, 1, strlen(value)) // \0 ( + > ~ case 0: case 40: case 43: case 62: case 126: return value // : case 58: if (children[++index] === 'global') children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1) // \s case 32: return index === 1 ? '' : value default: switch (index) { case 0: element = value return sizeof(children) > 1 ? '' : value case index = sizeof(children) - 1: case 2: return index === 2 ? value + element + element : value + element default: return value } } }) }) } } ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/stylis/src/Parser.js /** * @param {string} value * @return {object[]} */ function compile (value) { return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value)) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {string[]} rule * @param {string[]} rules * @param {string[]} rulesets * @param {number[]} pseudo * @param {number[]} points * @param {string[]} declarations * @return {object} */ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { var index = 0 var offset = 0 var length = pseudo var atrule = 0 var property = 0 var previous = 0 var variable = 1 var scanning = 1 var ampersand = 1 var character = 0 var type = '' var props = rules var children = rulesets var reference = rule var characters = type while (scanning) switch (previous = character, character = next()) { // ( case 40: if (previous != 108 && Utility_charat(characters, length - 1) == 58) { if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1 break } // " ' [ case 34: case 39: case 91: characters += delimit(character) break // \t \n \r \s case 9: case 10: case 13: case 32: characters += whitespace(previous) break // \ case 92: characters += escaping(caret() - 1, 7) continue // / case 47: switch (peek()) { case 42: case 47: Utility_append(comment(commenter(next(), caret()), root, parent), declarations) break default: characters += '/' } break // { case 123 * variable: points[index++] = Utility_strlen(characters) * ampersand // } ; \0 case 125 * variable: case 59: case 0: switch (character) { // \0 } case 0: case 125: scanning = 0 // ; case 59 + offset: if (ampersand == -1) characters = Utility_replace(characters, /\f/g, '') if (property > 0 && (Utility_strlen(characters) - length)) Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations) break // @ ; case 59: characters += ';' // { rule/at-rule default: Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children) else switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) { // d l m s case 100: case 108: case 109: case 115: parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) break default: parse(characters, reference, reference, reference, [''], children, 0, points, children) } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo break // : case 58: length = 1 + Utility_strlen(characters), property = previous default: if (variable < 1) if (character == 123) --variable else if (character == 125 && variable++ == 0 && prev() == 125) continue switch (characters += Utility_from(character), character * variable) { // & case 38: ampersand = offset > 0 ? 1 : (characters += '\f', -1) break // , case 44: points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1 break // @ case 64: // - if (peek() === 45) characters += delimit(next()) atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++ break // - case 45: if (previous === 45 && Utility_strlen(characters) == 2) variable = 0 } } return rulesets } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} index * @param {number} offset * @param {string[]} rules * @param {number[]} points * @param {string} type * @param {string[]} props * @param {string[]} children * @param {number} length * @return {object} */ function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { var post = offset - 1 var rule = offset === 0 ? rules : [''] var size = Utility_sizeof(rule) for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x]))) props[k++] = z return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length) } /** * @param {number} value * @param {object} root * @param {object?} parent * @return {object} */ function comment (value, root, parent) { return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0) } /** * @param {string} value * @param {object} root * @param {object?} parent * @param {number} length * @return {object} */ function declaration (value, root, parent, length) { return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length) } ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { var previous = 0; var character = 0; while (true) { previous = character; character = peek(); // &\f if (previous === 38 && character === 12) { points[index] = 1; } if (token(character)) { break; } next(); } return slice(begin, position); }; var toRules = function toRules(parsed, points) { // pretend we've started with a comma var index = -1; var character = 44; do { switch (token(character)) { case 0: // &\f if (character === 38 && peek() === 12) { // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings // stylis inserts \f after & to know when & where it should replace this sequence with the context selector // and when it should just concatenate the outer and inner selectors // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here points[index] = 1; } parsed[index] += identifierWithPointTracking(position - 1, points, index); break; case 2: parsed[index] += delimit(character); break; case 4: // comma if (character === 44) { // colon parsed[++index] = peek() === 58 ? '&\f' : ''; points[index] = parsed[index].length; break; } // fallthrough default: parsed[index] += Utility_from(character); } } while (character = next()); return parsed; }; var getRules = function getRules(value, points) { return dealloc(toRules(alloc(value), points)); }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 var fixedElements = /* #__PURE__ */new WeakMap(); var compat = function compat(element) { if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo // negative .length indicates that this rule has been already prefixed element.length < 1) { return; } var value = element.value, parent = element.parent; var isImplicitRule = element.column === parent.column && element.line === parent.line; while (parent.type !== 'rule') { parent = parent.parent; if (!parent) return; } // short-circuit for the simplest case if (element.props.length === 1 && value.charCodeAt(0) !== 58 /* colon */ && !fixedElements.get(parent)) { return; } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" if (isImplicitRule) { return; } fixedElements.set(element, true); var points = []; var rules = getRules(value, points); var parentRules = parent.props; for (var i = 0, k = 0; i < rules.length; i++) { for (var j = 0; j < parentRules.length; j++, k++) { element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }; var removeLabel = function removeLabel(element) { if (element.type === 'decl') { var value = element.value; if ( // charcode for l value.charCodeAt(0) === 108 && // charcode for b value.charCodeAt(2) === 98) { // this ignores label element["return"] = ''; element.value = ''; } } }; var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; var isIgnoringComment = function isIgnoringComment(element) { return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; }; var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { return function (element, index, children) { if (element.type !== 'rule' || cache.compat) return; var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); if (unsafePseudoClasses) { var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` // // considering this input: // .a { // .b /* comm */ {} // color: hotpink; // } // we get output corresponding to this: // .a { // & { // /* comm */ // color: hotpink; // } // .b {} // } var commentContainer = isNested ? element.parent.children : // global rule at the root level children; for (var i = commentContainer.length - 1; i >= 0; i--) { var node = commentContainer[i]; if (node.line < element.line) { break; } // it is quite weird but comments are *usually* put at `column: element.column - 1` // so we seek *from the end* for the node that is earlier than the rule's `element` and check that // this will also match inputs like this: // .a { // /* comm */ // .b {} // } // // but that is fine // // it would be the easiest to change the placement of the comment to be the first child of the rule: // .a { // .b { /* comm */ } // } // with such inputs we wouldn't have to search for the comment at all // TODO: consider changing this comment placement in the next major version if (node.column < element.column) { if (isIgnoringComment(node)) { return; } break; } } unsafePseudoClasses.forEach(function (unsafePseudoClass) { console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); }); } }; }; var isImportRule = function isImportRule(element) { return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; }; var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { for (var i = index - 1; i >= 0; i--) { if (!isImportRule(children[i])) { return true; } } return false; }; // use this to remove incorrect elements from further processing // so they don't get handed to the `sheet` (or anything else) // as that could potentially lead to additional logs which in turn could be overhelming to the user var nullifyElement = function nullifyElement(element) { element.type = ''; element.value = ''; element["return"] = ''; element.children = ''; element.props = ''; }; var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { if (!isImportRule(element)) { return; } if (element.parent) { console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); nullifyElement(element); } else if (isPrependedWithRegularRules(index, children)) { console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); nullifyElement(element); } }; /* eslint-disable no-fallthrough */ function emotion_cache_browser_esm_prefix(value, length) { switch (hash(value, length)) { // color-adjust case 5103: return Enum_WEBKIT + 'print-' + value + value; // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: return Enum_WEBKIT + value + value; // appearance, user-select, transform, hyphens, text-size-adjust case 5349: case 4246: case 4810: case 6968: case 2756: return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value; // flex, flex-direction case 6828: case 4268: return Enum_WEBKIT + value + Enum_MS + value + value; // order case 6165: return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value; // align-items case 5187: return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value; // align-self case 5443: return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value; // align-content case 4675: return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value; // flex-shrink case 5548: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value; // flex-basis case 5292: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value; // flex-grow case 6060: return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value; // transition case 4554: return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value; // cursor case 6187: return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value; // background, background-image case 5495: case 3959: return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1'); // justify-content case 4968: return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value; // (margin|padding)-inline-(start|end) case 4095: case 3583: case 4068: case 2532: return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value; // (min|max)?(width|height|inline-size|block-size) case 8116: case 7059: case 5753: case 5535: case 5445: case 5701: case 4933: case 4677: case 5533: case 5789: case 5021: case 4765: // stretch, max-content, min-content, fill-available if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) { // (m)ax-content, (m)in-content case 109: // - if (Utility_charat(value, length + 4) !== 45) break; // (f)ill-available, (f)it-content case 102: return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; // (s)tretch case 115: return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value; } break; // position: sticky case 4949: // (s)ticky? if (Utility_charat(value, length + 1) !== 115) break; // display: (flex|inline-flex) case 6444: switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) { // stic(k)y case 107: return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value; // (inline-)?fl(e)x case 101: return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value; } break; // writing-mode case 5936: switch (Utility_charat(value, length + 11)) { // vertical-l(r) case 114: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; // vertical-r(l) case 108: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; // horizontal(-)tb case 45: return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; } return Enum_WEBKIT + value + Enum_MS + value + value; } return value; } var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) { if (element.length > -1) if (!element["return"]) switch (element.type) { case Enum_DECLARATION: element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length); break; case Enum_KEYFRAMES: return Serializer_serialize([Tokenizer_copy(element, { value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT) })], callback); case Enum_RULESET: if (element.length) return Utility_combine(element.props, function (value) { switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) { // :read-(only|write) case ':read-only': case ':read-write': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')] })], callback); // :placeholder case '::placeholder': return Serializer_serialize([Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')] }), Tokenizer_copy(element, { props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')] })], callback); } return ''; }); } }; var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer]; var createCache = function createCache(options) { var key = options.key; if (false) {} if (key === 'css') { var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) // note this very very intentionally targets all style elements regardless of the key to ensure // that creating a cache works inside of render of a React component Array.prototype.forEach.call(ssrStyles, function (node) { // we want to only move elements which have a space in the data-emotion attribute value // because that indicates that it is an Emotion 11 server-side rendered style elements // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles // will not result in the Emotion 10 styles being destroyed var dataEmotionAttribute = node.getAttribute('data-emotion'); if (dataEmotionAttribute.indexOf(' ') === -1) { return; } document.head.appendChild(node); node.setAttribute('data-s', ''); }); } var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; if (false) {} var inserted = {}; var container; var nodesToHydrate = []; { container = options.container || document.head; Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which // means that the style elements we're looking at are only Emotion 11 server-rendered style elements document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe for (var i = 1; i < attrib.length; i++) { inserted[attrib[i]] = true; } nodesToHydrate.push(node); }); } var _insert; var omnipresentPlugins = [compat, removeLabel]; if (false) {} { var currentSheet; var finalizingPlugins = [stringify, false ? 0 : rulesheet(function (rule) { currentSheet.insert(rule); })]; var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); var stylis = function stylis(styles) { return Serializer_serialize(compile(styles), serializer); }; _insert = function insert(selector, serialized, sheet, shouldCache) { currentSheet = sheet; if (false) {} stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); if (shouldCache) { cache.inserted[serialized.name] = true; } }; } var cache = { key: key, sheet: new StyleSheet({ key: key, container: container, nonce: options.nonce, speedy: options.speedy, prepend: options.prepend, insertionPoint: options.insertionPoint }), nonce: options.nonce, inserted: inserted, registered: {}, insert: _insert }; cache.sheet.hydrate(nodesToHydrate); return cache; }; /***/ }), /***/ 7424: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ C: function() { return /* binding */ CacheProvider; }, /* harmony export */ T: function() { return /* binding */ ThemeContext; }, /* harmony export */ i: function() { return /* binding */ isBrowser; }, /* harmony export */ w: function() { return /* binding */ withEmotionCache; } /* harmony export */ }); /* unused harmony exports E, _, a, b, c, h, u */ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6112); /* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5018); /* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6243); var isBrowser = "object" !== 'undefined'; var hasOwnProperty = {}.hasOwnProperty; var EmotionCacheContext = /* #__PURE__ */react__WEBPACK_IMPORTED_MODULE_0__.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case // because this module is primarily intended for the browser and node // but it's also required in react native and similar environments sometimes // and we could have a special build just for that // but this is much easier and the native packages // might use a different theme context in the future anyway typeof HTMLElement !== 'undefined' ? /* #__PURE__ */(0,_emotion_cache__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)({ key: 'css' }) : null); if (false) {} var CacheProvider = EmotionCacheContext.Provider; var __unsafe_useEmotionCache = function useEmotionCache() { return useContext(EmotionCacheContext); }; var withEmotionCache = function withEmotionCache(func) { // $FlowFixMe return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, ref) { // the cache will never be null in the browser var cache = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(EmotionCacheContext); return func(props, cache, ref); }); }; if (!isBrowser) { withEmotionCache = function withEmotionCache(func) { return function (props) { var cache = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(EmotionCacheContext); if (cache === null) { // yes, we're potentially creating this on every render // it doesn't actually matter though since it's only on the server // so there will only every be a single render // that could change in the future because of suspense and etc. but for now, // this works and i don't want to optimise for a future thing that we aren't sure about cache = (0,_emotion_cache__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)({ key: 'css' }); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(EmotionCacheContext.Provider, { value: cache }, func(props, cache)); } else { return func(props, cache); } }; }; } var ThemeContext = /* #__PURE__ */react__WEBPACK_IMPORTED_MODULE_0__.createContext({}); if (false) {} var useTheme = function useTheme() { return React.useContext(ThemeContext); }; var getTheme = function getTheme(outerTheme, theme) { if (typeof theme === 'function') { var mergedTheme = theme(outerTheme); if (false) {} return mergedTheme; } if (false) {} return _extends({}, outerTheme, theme); }; var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) { return weakMemoize(function (theme) { return getTheme(outerTheme, theme); }); }))); var ThemeProvider = function ThemeProvider(props) { var theme = React.useContext(ThemeContext); if (props.theme !== theme) { theme = createCacheWithTheme(theme)(props.theme); } return /*#__PURE__*/React.createElement(ThemeContext.Provider, { value: theme }, props.children); }; function withTheme(Component) { var componentName = Component.displayName || Component.name || 'Component'; var render = function render(props, ref) { var theme = React.useContext(ThemeContext); return /*#__PURE__*/React.createElement(Component, _extends({ theme: theme, ref: ref }, props)); }; // $FlowFixMe var WithTheme = /*#__PURE__*/React.forwardRef(render); WithTheme.displayName = "WithTheme(" + componentName + ")"; return hoistNonReactStatics(WithTheme, Component); } var getLastPart = function getLastPart(functionName) { // The match may be something like 'Object.createEmotionProps' or // 'Loader.prototype.render' var parts = functionName.split('.'); return parts[parts.length - 1]; }; var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { // V8 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); if (match) return getLastPart(match[1]); // Safari / Firefox match = /^([A-Za-z0-9$.]+)@/.exec(line); if (match) return getLastPart(match[1]); return undefined; }; var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS // identifiers, thus we only need to replace what is a valid character for JS, // but not for CSS. var sanitizeIdentifier = function sanitizeIdentifier(identifier) { return identifier.replace(/\$/g, '-'); }; var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { if (!stackTrace) return undefined; var lines = stackTrace.split('\n'); for (var i = 0; i < lines.length; i++) { var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" if (!functionName) continue; // If we reach one of these, we have gone too far and should quit if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an // uppercase letter if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); } return undefined; }; var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; var createEmotionProps = function createEmotionProps(type, props) { if (false) {} var newProps = {}; for (var key in props) { if (hasOwnProperty.call(props, key)) { newProps[key] = props[key]; } } newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when // the label hasn't already been computed if (false) { var label; } return newProps; }; var Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; registerStyles(cache, serialized, isStringTag); useInsertionEffectAlwaysWithSyncFallback(function () { return insertStyles(cache, serialized, isStringTag); }); return null; }; var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) { var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works // not passing the registered cache to serializeStyles because it would // make certain babel optimisations not possible if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { cssProp = cache.registered[cssProp]; } var WrappedComponent = props[typePropName]; var registeredStyles = [cssProp]; var className = ''; if (typeof props.className === 'string') { className = getRegisteredStyles(cache.registered, registeredStyles, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext)); if (false) { var labelFromStack; } className += cache.key + "-" + serialized.name; var newProps = {}; for (var key in props) { if (hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) { newProps[key] = props[key]; } } newProps.ref = ref; newProps.className = className; return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, { cache: cache, serialized: serialized, isStringTag: typeof WrappedComponent === 'string' }), /*#__PURE__*/React.createElement(WrappedComponent, newProps)); }))); if (false) {} var Emotion$1 = (/* unused pure expression or super */ null && (Emotion)); /***/ }), /***/ 8361: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AH: function() { return /* binding */ css; }, /* harmony export */ i7: function() { return /* binding */ keyframes; }, /* harmony export */ mL: function() { return /* binding */ Global; } /* harmony export */ }); /* unused harmony exports ClassNames, createElement, jsx */ /* harmony import */ var _emotion_element_c39617d8_browser_esm_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7424); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var _emotion_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1957); /* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6243); /* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5018); /* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6112); /* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4146); /* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_4__); var pkg = { name: "@emotion/react", version: "11.11.1", main: "dist/emotion-react.cjs.js", module: "dist/emotion-react.esm.js", browser: { "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js" }, exports: { ".": { module: { worker: "./dist/emotion-react.worker.esm.js", browser: "./dist/emotion-react.browser.esm.js", "default": "./dist/emotion-react.esm.js" }, "import": "./dist/emotion-react.cjs.mjs", "default": "./dist/emotion-react.cjs.js" }, "./jsx-runtime": { module: { worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js", browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js", "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js" }, "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs", "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" }, "./_isolated-hnrs": { module: { worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js", browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js", "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js" }, "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs", "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" }, "./jsx-dev-runtime": { module: { worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js", browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js", "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js" }, "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs", "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" }, "./package.json": "./package.json", "./types/css-prop": "./types/css-prop.d.ts", "./macro": { types: { "import": "./macro.d.mts", "default": "./macro.d.ts" }, "default": "./macro.js" } }, types: "types/index.d.ts", files: [ "src", "dist", "jsx-runtime", "jsx-dev-runtime", "_isolated-hnrs", "types/*.d.ts", "macro.*" ], sideEffects: false, author: "Emotion Contributors", license: "MIT", scripts: { "test:typescript": "dtslint types" }, dependencies: { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.11.0", "@emotion/cache": "^11.11.0", "@emotion/serialize": "^1.1.2", "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", "@emotion/utils": "^1.2.1", "@emotion/weak-memoize": "^0.3.1", "hoist-non-react-statics": "^3.3.1" }, peerDependencies: { react: ">=16.8.0" }, peerDependenciesMeta: { "@types/react": { optional: true } }, devDependencies: { "@definitelytyped/dtslint": "0.0.112", "@emotion/css": "11.11.0", "@emotion/css-prettifier": "1.1.3", "@emotion/server": "11.11.0", "@emotion/styled": "11.11.0", "html-tag-names": "^1.1.2", react: "16.14.0", "svg-tag-names": "^1.1.1", typescript: "^4.5.5" }, repository: "https://github.com/emotion-js/emotion/tree/main/packages/react", publishConfig: { access: "public" }, "umd:main": "dist/emotion-react.umd.min.js", preconstruct: { entrypoints: [ "./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./_isolated-hnrs.js" ], umdName: "emotionReact", exports: { envConditions: [ "browser", "worker" ], extra: { "./types/css-prop": "./types/css-prop.d.ts", "./macro": { types: { "import": "./macro.d.mts", "default": "./macro.d.ts" }, "default": "./macro.js" } } } } }; var jsx = function jsx(type, props) { var args = arguments; if (props == null || !hasOwnProperty.call(props, 'css')) { // $FlowFixMe return React.createElement.apply(undefined, args); } var argsLength = args.length; var createElementArgArray = new Array(argsLength); createElementArgArray[0] = Emotion; createElementArgArray[1] = createEmotionProps(type, props); for (var i = 2; i < argsLength; i++) { createElementArgArray[i] = args[i]; } // $FlowFixMe return React.createElement.apply(null, createElementArgArray); }; var warnedAboutCssPropForGlobal = false; // maintain place over rerenders. // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild // initial client-side render from SSR, use place of hydrating tag var Global = /* #__PURE__ */(0,_emotion_element_c39617d8_browser_esm_js__WEBPACK_IMPORTED_MODULE_5__.w)(function (props, cache) { if (false) {} var styles = props.styles; var serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_2__/* .serializeStyles */ .J)([styles], undefined, react__WEBPACK_IMPORTED_MODULE_0__.useContext(_emotion_element_c39617d8_browser_esm_js__WEBPACK_IMPORTED_MODULE_5__.T)); if (!_emotion_element_c39617d8_browser_esm_js__WEBPACK_IMPORTED_MODULE_5__.i) { var _ref; var serializedNames = serialized.name; var serializedStyles = serialized.styles; var next = serialized.next; while (next !== undefined) { serializedNames += ' ' + next.name; serializedStyles += next.styles; next = next.next; } var shouldCache = cache.compat === true; var rules = cache.insert("", { name: serializedNames, styles: serializedStyles }, cache.sheet, shouldCache); if (shouldCache) { return null; } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = { __html: rules }, _ref.nonce = cache.sheet.nonce, _ref)); } // yes, i know these hooks are used conditionally // but it is based on a constant that will never change at runtime // it's effectively like having two implementations and switching them out // so it's not actually breaking anything var sheetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(); (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_1__/* .useInsertionEffectWithLayoutFallback */ .i)(function () { var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675 var sheet = new cache.sheet.constructor({ key: key, nonce: cache.sheet.nonce, container: cache.sheet.container, speedy: cache.sheet.isSpeedy }); var rehydrating = false; // $FlowFixMe var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]"); if (cache.sheet.tags.length) { sheet.before = cache.sheet.tags[0]; } if (node !== null) { rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other s node.setAttribute('data-emotion', key); sheet.hydrate([node]); } sheetRef.current = [sheet, rehydrating]; return function () { sheet.flush(); }; }, [cache]); (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_1__/* .useInsertionEffectWithLayoutFallback */ .i)(function () { var sheetRefCurrent = sheetRef.current; var sheet = sheetRefCurrent[0], rehydrating = sheetRefCurrent[1]; if (rehydrating) { sheetRefCurrent[1] = false; return; } if (serialized.next !== undefined) { // insert keyframes (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_6__/* .insertStyles */ .sk)(cache, serialized.next, true); } if (sheet.tags.length) { // if this doesn't exist then it will be null so the style element will be appended var element = sheet.tags[sheet.tags.length - 1].nextElementSibling; sheet.before = element; sheet.flush(); } cache.insert("", serialized, sheet, false); }, [cache, serialized.name]); return null; }); if (false) {} function css() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_2__/* .serializeStyles */ .J)(args); } var keyframes = function keyframes() { var insertable = css.apply(void 0, arguments); var name = "animation-" + insertable.name; // $FlowFixMe return { name: name, styles: "@keyframes " + name + "{" + insertable.styles + "}", anim: 1, toString: function toString() { return "_EMO_" + this.name + "_" + this.styles + "_EMO_"; } }; }; var classnames = function classnames(args) { var len = args.length; var i = 0; var cls = ''; for (; i < len; i++) { var arg = args[i]; if (arg == null) continue; var toAdd = void 0; switch (typeof arg) { case 'boolean': break; case 'object': { if (Array.isArray(arg)) { toAdd = classnames(arg); } else { if (false) {} toAdd = ''; for (var k in arg) { if (arg[k] && k) { toAdd && (toAdd += ' '); toAdd += k; } } } break; } default: { toAdd = arg; } } if (toAdd) { cls && (cls += ' '); cls += toAdd; } } return cls; }; function merge(registered, css, className) { var registeredStyles = []; var rawClassName = getRegisteredStyles(registered, registeredStyles, className); if (registeredStyles.length < 2) { return className; } return rawClassName + css(registeredStyles); } var Insertion = function Insertion(_ref) { var cache = _ref.cache, serializedArr = _ref.serializedArr; useInsertionEffectAlwaysWithSyncFallback(function () { for (var i = 0; i < serializedArr.length; i++) { insertStyles(cache, serializedArr[i], false); } }); return null; }; var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) { var hasRendered = false; var serializedArr = []; var css = function css() { if (hasRendered && "production" !== 'production') {} for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var serialized = serializeStyles(args, cache.registered); serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx` registerStyles(cache, serialized, false); return cache.key + "-" + serialized.name; }; var cx = function cx() { if (hasRendered && "production" !== 'production') {} for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return merge(cache.registered, css, classnames(args)); }; var content = { css: css, cx: cx, theme: React.useContext(ThemeContext) }; var ele = props.children(content); hasRendered = true; return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, { cache: cache, serializedArr: serializedArr }), ele); }))); if (false) {} if (false) { var globalKey, globalContext, isTestEnv, isBrowser; } /***/ }), /***/ 5018: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { J: function() { return /* binding */ serializeStyles; } }); ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/hash/dist/emotion-hash.esm.js /* eslint-disable */ // Inspired by https://github.com/garycourt/murmurhash-js // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 function murmur2(str) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. // const m = 0x5bd1e995; // const r = 24; // Initialize the hash var h = 0; // Mix 4 bytes at a time into the hash var k, i = 0, len = str.length; for (; len >= 4; ++i, len -= 4) { k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; k = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); k ^= /* k >>> r: */ k >>> 24; h = /* Math.imul(k, m): */ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Handle the last few bytes of the input array switch (len) { case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; case 1: h ^= str.charCodeAt(i) & 0xff; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >>> 13; h = /* Math.imul(h, m): */ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); return ((h ^ h >>> 15) >>> 0).toString(36); } // EXTERNAL MODULE: ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js var unitless_browser_esm = __webpack_require__(7103); // EXTERNAL MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js var memoize_browser_esm = __webpack_require__(4903); ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; var hyphenateRegex = /[A-Z]|^ms/g; var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; var isCustomProperty = function isCustomProperty(property) { return property.charCodeAt(1) === 45; }; var isProcessableValue = function isProcessableValue(value) { return value != null && typeof value !== 'boolean'; }; var processStyleName = /* #__PURE__ */(0,memoize_browser_esm/* default */.A)(function (styleName) { return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); }); var processStyleValue = function processStyleValue(key, value) { switch (key) { case 'animation': case 'animationName': { if (typeof value === 'string') { return value.replace(animationRegex, function (match, p1, p2) { cursor = { name: p1, styles: p2, next: cursor }; return p1; }); } } } if (unitless_browser_esm/* default */.A[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { return value + 'px'; } return value; }; if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.')); function handleInterpolation(mergedProps, registered, interpolation) { if (interpolation == null) { return ''; } if (interpolation.__emotion_styles !== undefined) { if (false) {} return interpolation; } switch (typeof interpolation) { case 'boolean': { return ''; } case 'object': { if (interpolation.anim === 1) { cursor = { name: interpolation.name, styles: interpolation.styles, next: cursor }; return interpolation.name; } if (interpolation.styles !== undefined) { var next = interpolation.next; if (next !== undefined) { // not the most efficient thing ever but this is a pretty rare case // and there will be very few iterations of this generally while (next !== undefined) { cursor = { name: next.name, styles: next.styles, next: cursor }; next = next.next; } } var styles = interpolation.styles + ";"; if (false) {} return styles; } return createStringFromObject(mergedProps, registered, interpolation); } case 'function': { if (mergedProps !== undefined) { var previousCursor = cursor; var result = interpolation(mergedProps); cursor = previousCursor; return handleInterpolation(mergedProps, registered, result); } else if (false) {} break; } case 'string': if (false) { var replaced, matched; } break; } // finalize string values (regular strings and functions interpolated into css calls) if (registered == null) { return interpolation; } var cached = registered[interpolation]; return cached !== undefined ? cached : interpolation; } function createStringFromObject(mergedProps, registered, obj) { var string = ''; if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; } } else { for (var _key in obj) { var value = obj[_key]; if (typeof value !== 'object') { if (registered != null && registered[value] !== undefined) { string += _key + "{" + registered[value] + "}"; } else if (isProcessableValue(value)) { string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";"; } } else { if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {} if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { for (var _i = 0; _i < value.length; _i++) { if (isProcessableValue(value[_i])) { string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";"; } } } else { var interpolated = handleInterpolation(mergedProps, registered, value); switch (_key) { case 'animation': case 'animationName': { string += processStyleName(_key) + ":" + interpolated + ";"; break; } default: { if (false) {} string += _key + "{" + interpolated + "}"; } } } } } } return string; } var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g; var sourceMapPattern; if (false) {} // this is the cursor for keyframes // keyframes are stored on the SerializedStyles object as a linked list var cursor; var serializeStyles = function serializeStyles(args, registered, mergedProps) { if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { return args[0]; } var stringMode = true; var styles = ''; cursor = undefined; var strings = args[0]; if (strings == null || strings.raw === undefined) { stringMode = false; styles += handleInterpolation(mergedProps, registered, strings); } else { if (false) {} styles += strings[0]; } // we start at 1 since we've already handled the first arg for (var i = 1; i < args.length; i++) { styles += handleInterpolation(mergedProps, registered, args[i]); if (stringMode) { if (false) {} styles += strings[i]; } } var sourceMap; if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time labelPattern.lastIndex = 0; var identifierName = ''; var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 while ((match = labelPattern.exec(styles)) !== null) { identifierName += '-' + // $FlowFixMe we know it's not null match[1]; } var name = murmur2(styles) + identifierName; if (false) {} return { name: name, styles: styles, next: cursor }; }; /***/ }), /***/ 6243: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; var react__WEBPACK_IMPORTED_MODULE_0___namespace_cache; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ i: function() { return /* binding */ useInsertionEffectWithLayoutFallback; }, /* harmony export */ s: function() { return /* binding */ useInsertionEffectAlwaysWithSyncFallback; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); var syncFallback = function syncFallback(create) { return create(); }; var useInsertionEffect = /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2)))['useInsertion' + 'Effect'] ? /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2)))['useInsertion' + 'Effect'] : false; var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; var useInsertionEffectWithLayoutFallback = useInsertionEffect || react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect; /***/ }), /***/ 1957: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Rk: function() { return /* binding */ getRegisteredStyles; }, /* harmony export */ SF: function() { return /* binding */ registerStyles; }, /* harmony export */ sk: function() { return /* binding */ insertStyles; } /* harmony export */ }); var isBrowser = "object" !== 'undefined'; function getRegisteredStyles(registered, registeredStyles, classNames) { var rawClassName = ''; classNames.split(' ').forEach(function (className) { if (registered[className] !== undefined) { registeredStyles.push(registered[className] + ";"); } else { rawClassName += className + " "; } }); return rawClassName; } var registerStyles = function registerStyles(cache, serialized, isStringTag) { var className = cache.key + "-" + serialized.name; if ( // we only need to add the styles to the registered cache if the // class name could be used further down // the tree but if it's a string tag, we know it won't // so we don't have to add it to registered cache. // this improves memory usage since we can avoid storing the whole style string (isStringTag === false || // we need to always store it if we're in compat mode and // in node since emotion-server relies on whether a style is in // the registered cache to know whether a style is global or not // also, note that this check will be dead code eliminated in the browser isBrowser === false ) && cache.registered[className] === undefined) { cache.registered[className] = serialized.styles; } }; var insertStyles = function insertStyles(cache, serialized, isStringTag) { registerStyles(cache, serialized, isStringTag); var className = cache.key + "-" + serialized.name; if (cache.inserted[serialized.name] === undefined) { var current = serialized; do { cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); current = current.next; } while (current !== undefined); } }; /***/ }), /***/ 1953: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg) && arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if ( true && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }()); /***/ }), /***/ 4609: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export clsx */ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t * MIT Expat Licence */ // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // // The limit on the value of `precision`, and on the value of the first argument to // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. var MAX_DIGITS = 1e9, // 0 to 1e9 // The initial configuration properties of the Decimal constructor. Decimal = { // These values must be integers within the stated ranges (inclusive). // Most of these values can be changed during run-time using `Decimal.config`. // The maximum number of significant digits of the result of a calculation or base conversion. // E.g. `Decimal.config({ precision: 20 });` precision: 20, // 1 to MAX_DIGITS // The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`, // `toFixed`, `toPrecision` and `toSignificantDigits`. // // ROUND_UP 0 Away from zero. // ROUND_DOWN 1 Towards zero. // ROUND_CEIL 2 Towards +Infinity. // ROUND_FLOOR 3 Towards -Infinity. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. // // E.g. // `Decimal.rounding = 4;` // `Decimal.rounding = Decimal.ROUND_HALF_UP;` rounding: 4, // 0 to 8 // The exponent value at and beneath which `toString` returns exponential notation. // JavaScript numbers: -7 toExpNeg: -7, // 0 to -MAX_E // The exponent value at and above which `toString` returns exponential notation. // JavaScript numbers: 21 toExpPos: 21, // 0 to MAX_E // The natural logarithm of 10. // 115 digits LN10: '2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286' }, // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // external = true, decimalError = '[DecimalError] ', invalidArgument = decimalError + 'Invalid argument: ', exponentOutOfRange = decimalError + 'Exponent out of range: ', mathfloor = Math.floor, mathpow = Math.pow, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ONE, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, MAX_E = mathfloor(MAX_SAFE_INTEGER / LOG_BASE), // 1286742750677284 // Decimal.prototype object P = {}; // Decimal prototype methods /* * absoluteValue abs * comparedTo cmp * decimalPlaces dp * dividedBy div * dividedToIntegerBy idiv * equals eq * exponent * greaterThan gt * greaterThanOrEqualTo gte * isInteger isint * isNegative isneg * isPositive ispos * isZero * lessThan lt * lessThanOrEqualTo lte * logarithm log * minus sub * modulo mod * naturalExponential exp * naturalLogarithm ln * negated neg * plus add * precision sd * squareRoot sqrt * times mul * toDecimalPlaces todp * toExponential * toFixed * toInteger toint * toNumber * toPower pow * toPrecision * toSignificantDigits tosd * toString * valueOf val */ /* * Return a new Decimal whose value is the absolute value of this Decimal. * */ P.absoluteValue = P.abs = function () { var x = new this.constructor(this); if (x.s) x.s = 1; return x; }; /* * Return * 1 if the value of this Decimal is greater than the value of `y`, * -1 if the value of this Decimal is less than the value of `y`, * 0 if they have the same value * */ P.comparedTo = P.cmp = function (y) { var i, j, xdL, ydL, x = this; y = new x.constructor(y); // Signs differ? if (x.s !== y.s) return x.s || -y.s; // Compare exponents. if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1; xdL = x.d.length; ydL = y.d.length; // Compare digit by digit. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1; } // Compare lengths. return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1; }; /* * Return the number of decimal places of the value of this Decimal. * */ P.decimalPlaces = P.dp = function () { var x = this, w = x.d.length - 1, dp = (w - x.e) * LOG_BASE; // Subtract the number of trailing zeros of the last word. w = x.d[w]; if (w) for (; w % 10 == 0; w /= 10) dp--; return dp < 0 ? 0 : dp; }; /* * Return a new Decimal whose value is the value of this Decimal divided by `y`, truncated to * `precision` significant digits. * */ P.dividedBy = P.div = function (y) { return divide(this, new this.constructor(y)); }; /* * Return a new Decimal whose value is the integer part of dividing the value of this Decimal * by the value of `y`, truncated to `precision` significant digits. * */ P.dividedToIntegerBy = P.idiv = function (y) { var x = this, Ctor = x.constructor; return round(divide(x, new Ctor(y), 0, 1), Ctor.precision); }; /* * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. * */ P.equals = P.eq = function (y) { return !this.cmp(y); }; /* * Return the (base 10) exponent value of this Decimal (this.e is the base 10000000 exponent). * */ P.exponent = function () { return getBase10Exponent(this); }; /* * Return true if the value of this Decimal is greater than the value of `y`, otherwise return * false. * */ P.greaterThan = P.gt = function (y) { return this.cmp(y) > 0; }; /* * Return true if the value of this Decimal is greater than or equal to the value of `y`, * otherwise return false. * */ P.greaterThanOrEqualTo = P.gte = function (y) { return this.cmp(y) >= 0; }; /* * Return true if the value of this Decimal is an integer, otherwise return false. * */ P.isInteger = P.isint = function () { return this.e > this.d.length - 2; }; /* * Return true if the value of this Decimal is negative, otherwise return false. * */ P.isNegative = P.isneg = function () { return this.s < 0; }; /* * Return true if the value of this Decimal is positive, otherwise return false. * */ P.isPositive = P.ispos = function () { return this.s > 0; }; /* * Return true if the value of this Decimal is 0, otherwise return false. * */ P.isZero = function () { return this.s === 0; }; /* * Return true if the value of this Decimal is less than `y`, otherwise return false. * */ P.lessThan = P.lt = function (y) { return this.cmp(y) < 0; }; /* * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. * */ P.lessThanOrEqualTo = P.lte = function (y) { return this.cmp(y) < 1; }; /* * Return the logarithm of the value of this Decimal to the specified base, truncated to * `precision` significant digits. * * If no base is specified, return log[10](x). * * log[base](x) = ln(x) / ln(base) * * The maximum error of the result is 1 ulp (unit in the last place). * * [base] {number|string|Decimal} The base of the logarithm. * */ P.logarithm = P.log = function (base) { var r, x = this, Ctor = x.constructor, pr = Ctor.precision, wpr = pr + 5; // Default base is 10. if (base === void 0) { base = new Ctor(10); } else { base = new Ctor(base); // log[-b](x) = NaN // log[0](x) = NaN // log[1](x) = NaN if (base.s < 1 || base.eq(ONE)) throw Error(decimalError + 'NaN'); } // log[b](-x) = NaN // log[b](0) = -Infinity if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity')); // log[b](1) = 0 if (x.eq(ONE)) return new Ctor(0); external = false; r = divide(ln(x, wpr), ln(base, wpr), wpr); external = true; return round(r, pr); }; /* * Return a new Decimal whose value is the value of this Decimal minus `y`, truncated to * `precision` significant digits. * */ P.minus = P.sub = function (y) { var x = this; y = new x.constructor(y); return x.s == y.s ? subtract(x, y) : add(x, (y.s = -y.s, y)); }; /* * Return a new Decimal whose value is the value of this Decimal modulo `y`, truncated to * `precision` significant digits. * */ P.modulo = P.mod = function (y) { var q, x = this, Ctor = x.constructor, pr = Ctor.precision; y = new Ctor(y); // x % 0 = NaN if (!y.s) throw Error(decimalError + 'NaN'); // Return x if x is 0. if (!x.s) return round(new Ctor(x), pr); // Prevent rounding of intermediate calculations. external = false; q = divide(x, y, 0, 1).times(y); external = true; return x.minus(q); }; /* * Return a new Decimal whose value is the natural exponential of the value of this Decimal, * i.e. the base e raised to the power the value of this Decimal, truncated to `precision` * significant digits. * */ P.naturalExponential = P.exp = function () { return exp(this); }; /* * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, * truncated to `precision` significant digits. * */ P.naturalLogarithm = P.ln = function () { return ln(this); }; /* * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by * -1. * */ P.negated = P.neg = function () { var x = new this.constructor(this); x.s = -x.s || 0; return x; }; /* * Return a new Decimal whose value is the value of this Decimal plus `y`, truncated to * `precision` significant digits. * */ P.plus = P.add = function (y) { var x = this; y = new x.constructor(y); return x.s == y.s ? add(x, y) : subtract(x, (y.s = -y.s, y)); }; /* * Return the number of significant digits of the value of this Decimal. * * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. * */ P.precision = P.sd = function (z) { var e, sd, w, x = this; if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); e = getBase10Exponent(x) + 1; w = x.d.length - 1; sd = w * LOG_BASE + 1; w = x.d[w]; // If non-zero... if (w) { // Subtract the number of trailing zeros of the last word. for (; w % 10 == 0; w /= 10) sd--; // Add the number of digits of the first word. for (w = x.d[0]; w >= 10; w /= 10) sd++; } return z && e > sd ? e : sd; }; /* * Return a new Decimal whose value is the square root of this Decimal, truncated to `precision` * significant digits. * */ P.squareRoot = P.sqrt = function () { var e, n, pr, r, s, t, wpr, x = this, Ctor = x.constructor; // Negative or zero? if (x.s < 1) { if (!x.s) return new Ctor(0); // sqrt(-x) = NaN throw Error(decimalError + 'NaN'); } e = getBase10Exponent(x); external = false; // Initial estimate. s = Math.sqrt(+x); // Math.sqrt underflow/overflow? // Pass x to Math.sqrt as integer, then adjust the exponent of the result. if (s == 0 || s == 1 / 0) { n = digitsToString(x.d); if ((n.length + e) % 2 == 0) n += '0'; s = Math.sqrt(n); e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); if (s == 1 / 0) { n = '5e' + e; } else { n = s.toExponential(); n = n.slice(0, n.indexOf('e') + 1) + e; } r = new Ctor(n); } else { r = new Ctor(s.toString()); } pr = Ctor.precision; s = wpr = pr + 3; // Newton-Raphson iteration. for (;;) { t = r; r = t.plus(divide(x, t, wpr + 2)).times(0.5); if (digitsToString(t.d).slice(0, wpr) === (n = digitsToString(r.d)).slice(0, wpr)) { n = n.slice(wpr - 3, wpr + 1); // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or // 4999, i.e. approaching a rounding boundary, continue the iteration. if (s == wpr && n == '4999') { // On the first iteration only, check to see if rounding up gives the exact result as the // nines may infinitely repeat. round(t, pr + 1, 0); if (t.times(t).eq(x)) { r = t; break; } } else if (n != '9999') { break; } wpr += 4; } } external = true; return round(r, pr); }; /* * Return a new Decimal whose value is the value of this Decimal times `y`, truncated to * `precision` significant digits. * */ P.times = P.mul = function (y) { var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; // Return 0 if either is 0. if (!x.s || !y.s) return new Ctor(0); y.s *= x.s; e = x.e + y.e; xdL = xd.length; ydL = yd.length; // Ensure xd points to the longer array. if (xdL < ydL) { r = xd; xd = yd; yd = r; rL = xdL; xdL = ydL; ydL = rL; } // Initialise the result array with zeros. r = []; rL = xdL + ydL; for (i = rL; i--;) r.push(0); // Multiply! for (i = ydL; --i >= 0;) { carry = 0; for (k = xdL + i; k > i;) { t = r[k] + yd[i] * xd[k - i - 1] + carry; r[k--] = t % BASE | 0; carry = t / BASE | 0; } r[k] = (r[k] + carry) % BASE | 0; } // Remove trailing zeros. for (; !r[--rL];) r.pop(); if (carry) ++e; else r.shift(); y.d = r; y.e = e; return external ? round(y, Ctor.precision) : y; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. * * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toDecimalPlaces = P.todp = function (dp, rm) { var x = this, Ctor = x.constructor; x = new Ctor(x); if (dp === void 0) return x; checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); return round(x, dp + getBase10Exponent(x) + 1, rm); }; /* * Return a string representing the value of this Decimal in exponential notation rounded to * `dp` fixed decimal places using rounding mode `rounding`. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toExponential = function (dp, rm) { var str, x = this, Ctor = x.constructor; if (dp === void 0) { str = toString(x, true); } else { checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); x = round(new Ctor(x), dp + 1, rm); str = toString(x, true, dp + 1); } return str; }; /* * Return a string representing the value of this Decimal in normal (fixed-point) notation to * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is * omitted. * * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. * * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. * (-0).toFixed(3) is '0.000'. * (-0.5).toFixed(0) is '-0'. * */ P.toFixed = function (dp, rm) { var str, y, x = this, Ctor = x.constructor; if (dp === void 0) return toString(x); checkInt32(dp, 0, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); y = round(new Ctor(x), dp + getBase10Exponent(x) + 1, rm); str = toString(y.abs(), false, dp + getBase10Exponent(y) + 1); // To determine whether to add the minus sign look at the value before it was rounded, // i.e. look at `x` rather than `y`. return x.isneg() && !x.isZero() ? '-' + str : str; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using * rounding mode `rounding`. * */ P.toInteger = P.toint = function () { var x = this, Ctor = x.constructor; return round(new Ctor(x), getBase10Exponent(x) + 1, Ctor.rounding); }; /* * Return the value of this Decimal converted to a number primitive. * */ P.toNumber = function () { return +this; }; /* * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, * truncated to `precision` significant digits. * * For non-integer or very large exponents pow(x, y) is calculated using * * x^y = exp(y*ln(x)) * * The maximum error is 1 ulp (unit in last place). * * y {number|string|Decimal} The power to which to raise this Decimal. * */ P.toPower = P.pow = function (y) { var e, k, pr, r, sign, yIsInt, x = this, Ctor = x.constructor, guard = 12, yn = +(y = new Ctor(y)); // pow(x, 0) = 1 if (!y.s) return new Ctor(ONE); x = new Ctor(x); // pow(0, y > 0) = 0 // pow(0, y < 0) = Infinity if (!x.s) { if (y.s < 1) throw Error(decimalError + 'Infinity'); return x; } // pow(1, y) = 1 if (x.eq(ONE)) return x; pr = Ctor.precision; // pow(x, 1) = x if (y.eq(ONE)) return round(x, pr); e = y.e; k = y.d.length - 1; yIsInt = e >= k; sign = x.s; if (!yIsInt) { // pow(x < 0, y non-integer) = NaN if (sign < 0) throw Error(decimalError + 'NaN'); // If y is a small integer use the 'exponentiation by squaring' algorithm. } else if ((k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { r = new Ctor(ONE); // Max k of 9007199254740991 takes 53 loop iterations. // Maximum digits array length; leaves [28, 34] guard digits. e = Math.ceil(pr / LOG_BASE + 4); external = false; for (;;) { if (k % 2) { r = r.times(x); truncate(r.d, e); } k = mathfloor(k / 2); if (k === 0) break; x = x.times(x); truncate(x.d, e); } external = true; return y.s < 0 ? new Ctor(ONE).div(r) : round(r, pr); } // Result is negative if x is negative and the last digit of integer y is odd. sign = sign < 0 && y.d[Math.max(e, k)] & 1 ? -1 : 1; x.s = 1; external = false; r = y.times(ln(x, pr + guard)); external = true; r = exp(r); r.s = sign; return r; }; /* * Return a string representing the value of this Decimal rounded to `sd` significant digits * using rounding mode `rounding`. * * Return exponential notation if `sd` is less than the number of digits necessary to represent * the integer part of the value in normal notation. * * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toPrecision = function (sd, rm) { var e, str, x = this, Ctor = x.constructor; if (sd === void 0) { e = getBase10Exponent(x); str = toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); } else { checkInt32(sd, 1, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); x = round(new Ctor(x), sd, rm); e = getBase10Exponent(x); str = toString(x, sd <= e || e <= Ctor.toExpNeg, sd); } return str; }; /* * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if * omitted. * * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. * */ P.toSignificantDigits = P.tosd = function (sd, rm) { var x = this, Ctor = x.constructor; if (sd === void 0) { sd = Ctor.precision; rm = Ctor.rounding; } else { checkInt32(sd, 1, MAX_DIGITS); if (rm === void 0) rm = Ctor.rounding; else checkInt32(rm, 0, 8); } return round(new Ctor(x), sd, rm); }; /* * Return a string representing the value of this Decimal. * * Return exponential notation if this Decimal has a positive exponent equal to or greater than * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. * */ P.toString = P.valueOf = P.val = P.toJSON = function () { var x = this, e = getBase10Exponent(x), Ctor = x.constructor; return toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); }; // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. /* * add P.minus, P.plus * checkInt32 P.todp, P.toExponential, P.toFixed, P.toPrecision, P.tosd * digitsToString P.log, P.sqrt, P.pow, toString, exp, ln * divide P.div, P.idiv, P.log, P.mod, P.sqrt, exp, ln * exp P.exp, P.pow * getBase10Exponent P.exponent, P.sd, P.toint, P.sqrt, P.todp, P.toFixed, P.toPrecision, * P.toString, divide, round, toString, exp, ln * getLn10 P.log, ln * getZeroString digitsToString, toString * ln P.log, P.ln, P.pow, exp * parseDecimal Decimal * round P.abs, P.idiv, P.log, P.minus, P.mod, P.neg, P.plus, P.toint, P.sqrt, * P.times, P.todp, P.toExponential, P.toFixed, P.pow, P.toPrecision, P.tosd, * divide, getLn10, exp, ln * subtract P.minus, P.plus * toString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf * truncate P.pow * * Throws: P.log, P.mod, P.sd, P.sqrt, P.pow, checkInt32, divide, round, * getLn10, exp, ln, parseDecimal, Decimal, config */ function add(x, y) { var carry, d, e, i, k, len, xd, yd, Ctor = x.constructor, pr = Ctor.precision; // If either is zero... if (!x.s || !y.s) { // Return x if y is zero. // Return y if y is non-zero. if (!y.s) y = new Ctor(x); return external ? round(y, pr) : y; } xd = x.d; yd = y.d; // x and y are finite, non-zero numbers with the same sign. k = x.e; e = y.e; xd = xd.slice(); i = k - e; // If base 1e7 exponents differ... if (i) { if (i < 0) { d = xd; i = -i; len = yd.length; } else { d = yd; e = k; len = xd.length; } // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. k = Math.ceil(pr / LOG_BASE); len = k > len ? k + 1 : len + 1; if (i > len) { i = len; d.length = 1; } // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. d.reverse(); for (; i--;) d.push(0); d.reverse(); } len = xd.length; i = yd.length; // If yd is longer than xd, swap xd and yd so xd points to the longer array. if (len - i < 0) { i = len; d = yd; yd = xd; xd = d; } // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. for (carry = 0; i;) { carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; xd[i] %= BASE; } if (carry) { xd.unshift(carry); ++e; } // Remove trailing zeros. // No need to check for zero, as +x + +y != 0 && -x + -y != 0 for (len = xd.length; xd[--len] == 0;) xd.pop(); y.d = xd; y.e = e; return external ? round(y, pr) : y; } function checkInt32(i, min, max) { if (i !== ~~i || i < min || i > max) { throw Error(invalidArgument + i); } } function digitsToString(d) { var i, k, ws, indexOfLastWord = d.length - 1, str = '', w = d[0]; if (indexOfLastWord > 0) { str += w; for (i = 1; i < indexOfLastWord; i++) { ws = d[i] + ''; k = LOG_BASE - ws.length; if (k) str += getZeroString(k); str += ws; } w = d[i]; ws = w + ''; k = LOG_BASE - ws.length; if (k) str += getZeroString(k); } else if (w === 0) { return '0'; } // Remove trailing zeros of last w. for (; w % 10 === 0;) w /= 10; return str + w; } var divide = (function () { // Assumes non-zero x and k, and hence non-zero result. function multiplyInteger(x, k) { var temp, carry = 0, i = x.length; for (x = x.slice(); i--;) { temp = x[i] * k + carry; x[i] = temp % BASE | 0; carry = temp / BASE | 0; } if (carry) x.unshift(carry); return x; } function compare(a, b, aL, bL) { var i, r; if (aL != bL) { r = aL > bL ? 1 : -1; } else { for (i = r = 0; i < aL; i++) { if (a[i] != b[i]) { r = a[i] > b[i] ? 1 : -1; break; } } } return r; } function subtract(a, b, aL) { var i = 0; // Subtract b from a. for (; aL--;) { a[aL] -= i; i = a[aL] < b[aL] ? 1 : 0; a[aL] = i * BASE + a[aL] - b[aL]; } // Remove leading zeros. for (; !a[0] && a.length > 1;) a.shift(); } return function (x, y, pr, dp) { var cmp, e, i, k, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; // Either 0? if (!x.s) return new Ctor(x); if (!y.s) throw Error(decimalError + 'Division by zero'); e = x.e - y.e; yL = yd.length; xL = xd.length; q = new Ctor(sign); qd = q.d = []; // Result exponent may be one less than e. for (i = 0; yd[i] == (xd[i] || 0); ) ++i; if (yd[i] > (xd[i] || 0)) --e; if (pr == null) { sd = pr = Ctor.precision; } else if (dp) { sd = pr + (getBase10Exponent(x) - getBase10Exponent(y)) + 1; } else { sd = pr; } if (sd < 0) return new Ctor(0); // Convert precision in number of base 10 digits to base 1e7 digits. sd = sd / LOG_BASE + 2 | 0; i = 0; // divisor < 1e7 if (yL == 1) { k = 0; yd = yd[0]; sd++; // k is the carry. for (; (i < xL || k) && sd--; i++) { t = k * BASE + (xd[i] || 0); qd[i] = t / yd | 0; k = t % yd | 0; } // divisor >= 1e7 } else { // Normalise xd and yd so highest order digit of yd is >= BASE/2 k = BASE / (yd[0] + 1) | 0; if (k > 1) { yd = multiplyInteger(yd, k); xd = multiplyInteger(xd, k); yL = yd.length; xL = xd.length; } xi = yL; rem = xd.slice(0, yL); remL = rem.length; // Add zeros to make remainder as long as divisor. for (; remL < yL;) rem[remL++] = 0; yz = yd.slice(); yz.unshift(0); yd0 = yd[0]; if (yd[1] >= BASE / 2) ++yd0; do { k = 0; // Compare divisor and remainder. cmp = compare(yd, rem, yL, remL); // If divisor < remainder. if (cmp < 0) { // Calculate trial digit, k. rem0 = rem[0]; if (yL != remL) rem0 = rem0 * BASE + (rem[1] || 0); // k will be how many times the divisor goes into the current remainder. k = rem0 / yd0 | 0; // Algorithm: // 1. product = divisor * trial digit (k) // 2. if product > remainder: product -= divisor, k-- // 3. remainder -= product // 4. if product was < remainder at 2: // 5. compare new remainder and divisor // 6. If remainder > divisor: remainder -= divisor, k++ if (k > 1) { if (k >= BASE) k = BASE - 1; // product = divisor * trial digit. prod = multiplyInteger(yd, k); prodL = prod.length; remL = rem.length; // Compare product and remainder. cmp = compare(prod, rem, prodL, remL); // product > remainder. if (cmp == 1) { k--; // Subtract divisor from product. subtract(prod, yL < prodL ? yz : yd, prodL); } } else { // cmp is -1. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 // to avoid it. If k is 1 there is a need to compare yd and rem again below. if (k == 0) cmp = k = 1; prod = yd.slice(); } prodL = prod.length; if (prodL < remL) prod.unshift(0); // Subtract product from remainder. subtract(rem, prod, remL); // If product was < previous remainder. if (cmp == -1) { remL = rem.length; // Compare divisor and new remainder. cmp = compare(yd, rem, yL, remL); // If divisor < new remainder, subtract divisor from remainder. if (cmp < 1) { k++; // Subtract divisor from remainder. subtract(rem, yL < remL ? yz : yd, remL); } } remL = rem.length; } else if (cmp === 0) { k++; rem = [0]; } // if cmp === 1, k will be 0 // Add the next digit, k, to the result array. qd[i++] = k; // Update the remainder. if (cmp && rem[0]) { rem[remL++] = xd[xi] || 0; } else { rem = [xd[xi]]; remL = 1; } } while ((xi++ < xL || rem[0] !== void 0) && sd--); } // Leading zero? if (!qd[0]) qd.shift(); q.e = e; return round(q, dp ? pr + getBase10Exponent(q) + 1 : pr); }; })(); /* * Return a new Decimal whose value is the natural exponential of `x` truncated to `sd` * significant digits. * * Taylor/Maclaurin series. * * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... * * Argument reduction: * Repeat x = x / 32, k += 5, until |x| < 0.1 * exp(x) = exp(x / 2^k)^(2^k) * * Previously, the argument was initially reduced by * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was * found to be slower than just dividing repeatedly by 32 as above. * * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) * * exp(x) is non-terminating for any finite, non-zero x. * */ function exp(x, sd) { var denominator, guard, pow, sum, t, wpr, i = 0, k = 0, Ctor = x.constructor, pr = Ctor.precision; if (getBase10Exponent(x) > 16) throw Error(exponentOutOfRange + getBase10Exponent(x)); // exp(0) = 1 if (!x.s) return new Ctor(ONE); if (sd == null) { external = false; wpr = pr; } else { wpr = sd; } t = new Ctor(0.03125); while (x.abs().gte(0.1)) { x = x.times(t); // x = x / 2^5 k += 5; } // Estimate the precision increase necessary to ensure the first 4 rounding digits are correct. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; wpr += guard; denominator = pow = sum = new Ctor(ONE); Ctor.precision = wpr; for (;;) { pow = round(pow.times(x), wpr); denominator = denominator.times(++i); t = sum.plus(divide(pow, denominator, wpr)); if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { while (k--) sum = round(sum.times(sum), wpr); Ctor.precision = pr; return sd == null ? (external = true, round(sum, pr)) : sum; } sum = t; } } // Calculate the base 10 exponent from the base 1e7 exponent. function getBase10Exponent(x) { var e = x.e * LOG_BASE, w = x.d[0]; // Add the number of digits of the first word of the digits array. for (; w >= 10; w /= 10) e++; return e; } function getLn10(Ctor, sd, pr) { if (sd > Ctor.LN10.sd()) { // Reset global state in case the exception is caught. external = true; if (pr) Ctor.precision = pr; throw Error(decimalError + 'LN10 precision limit exceeded'); } return round(new Ctor(Ctor.LN10), sd); } function getZeroString(k) { var zs = ''; for (; k--;) zs += '0'; return zs; } /* * Return a new Decimal whose value is the natural logarithm of `x` truncated to `sd` significant * digits. * * ln(n) is non-terminating (n != 1) * */ function ln(y, sd) { var c, c0, denominator, e, numerator, sum, t, wpr, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, pr = Ctor.precision; // ln(-x) = NaN // ln(0) = -Infinity if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-Infinity')); // ln(1) = 0 if (x.eq(ONE)) return new Ctor(0); if (sd == null) { external = false; wpr = pr; } else { wpr = sd; } if (x.eq(10)) { if (sd == null) external = true; return getLn10(Ctor, wpr); } wpr += guard; Ctor.precision = wpr; c = digitsToString(xd); c0 = c.charAt(0); e = getBase10Exponent(x); if (Math.abs(e) < 1.5e15) { // Argument reduction. // The series converges faster the closer the argument is to 1, so using // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can // later be divided by this number, then separate out the power of 10 using // ln(a*10^b) = ln(a) + b*ln(10). // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { // max n is 6 (gives 0.7 - 1.3) while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { x = x.times(y); c = digitsToString(x.d); c0 = c.charAt(0); n++; } e = getBase10Exponent(x); if (c0 > 1) { x = new Ctor('0.' + c); e++; } else { x = new Ctor(c0 + '.' + c.slice(1)); } } else { // The argument reduction method above may result in overflow if the argument y is a massive // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this // function using ln(x*10^e) = ln(x) + e*ln(10). t = getLn10(Ctor, wpr + 2, pr).times(e + ''); x = ln(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); Ctor.precision = pr; return sd == null ? (external = true, round(x, pr)) : x; } // x is reduced to a value near 1. // Taylor series. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) // where x = (y - 1)/(y + 1) (|x| < 1) sum = numerator = x = divide(x.minus(ONE), x.plus(ONE), wpr); x2 = round(x.times(x), wpr); denominator = 3; for (;;) { numerator = round(numerator.times(x2), wpr); t = sum.plus(divide(numerator, new Ctor(denominator), wpr)); if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { sum = sum.times(2); // Reverse the argument reduction. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); sum = divide(sum, new Ctor(n), wpr); Ctor.precision = pr; return sd == null ? (external = true, round(sum, pr)) : sum; } sum = t; denominator += 2; } } /* * Parse the value of a new Decimal `x` from string `str`. */ function parseDecimal(x, str) { var e, i, len; // Decimal point? if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); // Exponential form? if ((i = str.search(/e/i)) > 0) { // Determine exponent. if (e < 0) e = i; e += +str.slice(i + 1); str = str.substring(0, i); } else if (e < 0) { // Integer. e = str.length; } // Determine leading zeros. for (i = 0; str.charCodeAt(i) === 48;) ++i; // Determine trailing zeros. for (len = str.length; str.charCodeAt(len - 1) === 48;) --len; str = str.slice(i, len); if (str) { len -= i; e = e - i - 1; x.e = mathfloor(e / LOG_BASE); x.d = []; // Transform base // e is the base 10 exponent. // i is where to slice str to get the first word of the digits array. i = (e + 1) % LOG_BASE; if (e < 0) i += LOG_BASE; if (i < len) { if (i) x.d.push(+str.slice(0, i)); for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); str = str.slice(i); i = LOG_BASE - str.length; } else { i -= len; } for (; i--;) str += '0'; x.d.push(+str); if (external && (x.e > MAX_E || x.e < -MAX_E)) throw Error(exponentOutOfRange + e); } else { // Zero. x.s = 0; x.e = 0; x.d = [0]; } return x; } /* * Round `x` to `sd` significant digits, using rounding mode `rm` if present (truncate otherwise). */ function round(x, sd, rm) { var i, j, k, n, rd, doRound, w, xdi, xd = x.d; // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. // w: the word of xd which contains the rounding digit, a base 1e7 number. // xdi: the index of w within xd. // n: the number of digits of w. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if // they had leading zeros) // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). // Get the length of the first word of the digits array xd. for (n = 1, k = xd[0]; k >= 10; k /= 10) n++; i = sd - n; // Is the rounding digit in the first word of xd? if (i < 0) { i += LOG_BASE; j = sd; w = xd[xdi = 0]; } else { xdi = Math.ceil((i + 1) / LOG_BASE); k = xd.length; if (xdi >= k) return x; w = k = xd[xdi]; // Get the number of digits of w. for (n = 1; k >= 10; k /= 10) n++; // Get the index of rd within w. i %= LOG_BASE; // Get the index of rd within w, adjusted for leading zeros. // The number of leading zeros of w is given by LOG_BASE - n. j = i - LOG_BASE + n; } if (rm !== void 0) { k = mathpow(10, n - j - 1); // Get the rounding digit at index j of w. rd = w / k % 10 | 0; // Are there any non-zero digits after the rounding digit? doRound = sd < 0 || xd[xdi + 1] !== void 0 || w % k; // The expression `w % mathpow(10, n - j - 1)` returns all the digits of w to the right of the // digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression will give // 714. doRound = rm < 4 ? (rd || doRound) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || doRound || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. ((i > 0 ? j > 0 ? w / mathpow(10, n - j) : 0 : xd[xdi - 1]) % 10) & 1 || rm == (x.s < 0 ? 8 : 7)); } if (sd < 1 || !xd[0]) { if (doRound) { k = getBase10Exponent(x); xd.length = 1; // Convert sd to decimal places. sd = sd - k - 1; // 1, 0.1, 0.01, 0.001, 0.0001 etc. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); x.e = mathfloor(-sd / LOG_BASE) || 0; } else { xd.length = 1; // Zero. xd[0] = x.e = x.s = 0; } return x; } // Remove excess digits. if (i == 0) { xd.length = xdi; k = 1; xdi--; } else { xd.length = xdi + 1; k = mathpow(10, LOG_BASE - i); // E.g. 56700 becomes 56000 if 7 is the rounding digit. // j > 0 means i > number of leading zeros of w. xd[xdi] = j > 0 ? (w / mathpow(10, n - j) % mathpow(10, j) | 0) * k : 0; } if (doRound) { for (;;) { // Is the digit to be rounded up in the first word of xd? if (xdi == 0) { if ((xd[0] += k) == BASE) { xd[0] = 1; ++x.e; } break; } else { xd[xdi] += k; if (xd[xdi] != BASE) break; xd[xdi--] = 0; k = 1; } } } // Remove trailing zeros. for (i = xd.length; xd[--i] === 0;) xd.pop(); if (external && (x.e > MAX_E || x.e < -MAX_E)) { throw Error(exponentOutOfRange + getBase10Exponent(x)); } return x; } function subtract(x, y) { var d, e, i, j, k, len, xd, xe, xLTy, yd, Ctor = x.constructor, pr = Ctor.precision; // Return y negated if x is zero. // Return x if y is zero and x is non-zero. if (!x.s || !y.s) { if (y.s) y.s = -y.s; else y = new Ctor(x); return external ? round(y, pr) : y; } xd = x.d; yd = y.d; // x and y are non-zero numbers with the same sign. e = y.e; xe = x.e; xd = xd.slice(); k = xe - e; // If exponents differ... if (k) { xLTy = k < 0; if (xLTy) { d = xd; k = -k; len = yd.length; } else { d = yd; e = xe; len = xd.length; } // Numbers with massively different exponents would result in a very high number of zeros // needing to be prepended, but this can be avoided while still ensuring correct rounding by // limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; if (k > i) { k = i; d.length = 1; } // Prepend zeros to equalise exponents. d.reverse(); for (i = k; i--;) d.push(0); d.reverse(); // Base 1e7 exponents equal. } else { // Check digits to determine which is the bigger number. i = xd.length; len = yd.length; xLTy = i < len; if (xLTy) len = i; for (i = 0; i < len; i++) { if (xd[i] != yd[i]) { xLTy = xd[i] < yd[i]; break; } } k = 0; } if (xLTy) { d = xd; xd = yd; yd = d; y.s = -y.s; } len = xd.length; // Append zeros to xd if shorter. // Don't add zeros to yd if shorter as subtraction only needs to start at yd length. for (i = yd.length - len; i > 0; --i) xd[len++] = 0; // Subtract yd from xd. for (i = yd.length; i > k;) { if (xd[--i] < yd[i]) { for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; --xd[j]; xd[i] += BASE; } xd[i] -= yd[i]; } // Remove trailing zeros. for (; xd[--len] === 0;) xd.pop(); // Remove leading zeros and adjust exponent accordingly. for (; xd[0] === 0; xd.shift()) --e; // Zero? if (!xd[0]) return new Ctor(0); y.d = xd; y.e = e; //return external && xd.length >= pr / LOG_BASE ? round(y, pr) : y; return external ? round(y, pr) : y; } function toString(x, isExp, sd) { var k, e = getBase10Exponent(x), str = digitsToString(x.d), len = str.length; if (isExp) { if (sd && (k = sd - len) > 0) { str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); } else if (len > 1) { str = str.charAt(0) + '.' + str.slice(1); } str = str + (e < 0 ? 'e' : 'e+') + e; } else if (e < 0) { str = '0.' + getZeroString(-e - 1) + str; if (sd && (k = sd - len) > 0) str += getZeroString(k); } else if (e >= len) { str += getZeroString(e + 1 - len); if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); } else { if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); if (sd && (k = sd - len) > 0) { if (e + 1 === len) str += '.'; str += getZeroString(k); } } return x.s < 0 ? '-' + str : str; } // Does not strip trailing zeros. function truncate(arr, len) { if (arr.length > len) { arr.length = len; return true; } } // Decimal methods /* * clone * config/set */ /* * Create and return a Decimal constructor with the same configuration properties as this Decimal * constructor. * */ function clone(obj) { var i, p, ps; /* * The Decimal constructor and exported function. * Return a new Decimal instance. * * value {number|string|Decimal} A numeric value. * */ function Decimal(value) { var x = this; // Decimal called without new. if (!(x instanceof Decimal)) return new Decimal(value); // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor // which points to Object. x.constructor = Decimal; // Duplicate. if (value instanceof Decimal) { x.s = value.s; x.e = value.e; x.d = (value = value.d) ? value.slice() : value; return; } if (typeof value === 'number') { // Reject Infinity/NaN. if (value * 0 !== 0) { throw Error(invalidArgument + value); } if (value > 0) { x.s = 1; } else if (value < 0) { value = -value; x.s = -1; } else { x.s = 0; x.e = 0; x.d = [0]; return; } // Fast path for small integers. if (value === ~~value && value < 1e7) { x.e = 0; x.d = [value]; return; } return parseDecimal(x, value.toString()); } else if (typeof value !== 'string') { throw Error(invalidArgument + value); } // Minus sign? if (value.charCodeAt(0) === 45) { value = value.slice(1); x.s = -1; } else { x.s = 1; } if (isDecimal.test(value)) parseDecimal(x, value); else throw Error(invalidArgument + value); } Decimal.prototype = P; Decimal.ROUND_UP = 0; Decimal.ROUND_DOWN = 1; Decimal.ROUND_CEIL = 2; Decimal.ROUND_FLOOR = 3; Decimal.ROUND_HALF_UP = 4; Decimal.ROUND_HALF_DOWN = 5; Decimal.ROUND_HALF_EVEN = 6; Decimal.ROUND_HALF_CEIL = 7; Decimal.ROUND_HALF_FLOOR = 8; Decimal.clone = clone; Decimal.config = Decimal.set = config; if (obj === void 0) obj = {}; if (obj) { ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'LN10']; for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; } Decimal.config(obj); return Decimal; } /* * Configure global settings for a Decimal constructor. * * `obj` is an object with one or more of the following properties, * * precision {number} * rounding {number} * toExpNeg {number} * toExpPos {number} * * E.g. Decimal.config({ precision: 20, rounding: 4 }) * */ function config(obj) { if (!obj || typeof obj !== 'object') { throw Error(decimalError + 'Object expected'); } var i, p, v, ps = [ 'precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -1 / 0, 0, 'toExpPos', 0, 1 / 0 ]; for (i = 0; i < ps.length; i += 3) { if ((v = obj[p = ps[i]]) !== void 0) { if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; else throw Error(invalidArgument + p + ': ' + v); } } if ((v = obj[p = 'LN10']) !== void 0) { if (v == Math.LN10) this[p] = new this(v); else throw Error(invalidArgument + p + ': ' + v); } return this; } // Create and configure initial Decimal constructor. Decimal = clone(Decimal); Decimal['default'] = Decimal.Decimal = Decimal; // Internal constant. ONE = new Decimal(1); // Export. // AMD. if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Decimal; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // Node and other environments that support module.exports. } else {} })(this); /***/ }), /***/ 1640: /***/ (function(module) { "use strict"; var has = Object.prototype.hasOwnProperty , prefix = '~'; /** * Constructor to create a storage for our `EE` objects. * An `Events` instance is a plain object whose properties are event names. * * @constructor * @private */ function Events() {} // // We try to not inherit from `Object.prototype`. In some engines creating an // instance in this way is faster than calling `Object.create(null)` directly. // If `Object.create(null)` is not supported we prefix the event names with a // character to make sure that the built-in object properties are not // overridden or used as an attack vector. // if (Object.create) { Events.prototype = Object.create(null); // // This hack is needed because the `__proto__` property is still inherited in // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. // if (!new Events().__proto__) prefix = false; } /** * Representation of a single event listener. * * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} [once=false] Specify if the listener is a one-time listener. * @constructor * @private */ function EE(fn, context, once) { this.fn = fn; this.context = context; this.once = once || false; } /** * Add a listener for a given event. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} once Specify if the listener is a one-time listener. * @returns {EventEmitter} * @private */ function addListener(emitter, event, fn, context, once) { if (typeof fn !== 'function') { throw new TypeError('The listener must be a function'); } var listener = new EE(fn, context || emitter, once) , evt = prefix ? prefix + event : event; if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); else emitter._events[evt] = [emitter._events[evt], listener]; return emitter; } /** * Clear event by name. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} evt The Event name. * @private */ function clearEvent(emitter, evt) { if (--emitter._eventsCount === 0) emitter._events = new Events(); else delete emitter._events[evt]; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. * * @constructor * @public */ function EventEmitter() { this._events = new Events(); this._eventsCount = 0; } /** * Return an array listing the events for which the emitter has registered * listeners. * * @returns {Array} * @public */ EventEmitter.prototype.eventNames = function eventNames() { var names = [] , events , name; if (this._eventsCount === 0) return names; for (name in (events = this._events)) { if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); } if (Object.getOwnPropertySymbols) { return names.concat(Object.getOwnPropertySymbols(events)); } return names; }; /** * Return the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Array} The registered listeners. * @public */ EventEmitter.prototype.listeners = function listeners(event) { var evt = prefix ? prefix + event : event , handlers = this._events[evt]; if (!handlers) return []; if (handlers.fn) return [handlers.fn]; for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { ee[i] = handlers[i].fn; } return ee; }; /** * Return the number of listeners listening to a given event. * * @param {(String|Symbol)} event The event name. * @returns {Number} The number of listeners. * @public */ EventEmitter.prototype.listenerCount = function listenerCount(event) { var evt = prefix ? prefix + event : event , listeners = this._events[evt]; if (!listeners) return 0; if (listeners.fn) return 1; return listeners.length; }; /** * Calls each of the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Boolean} `true` if the event had listeners, else `false`. * @public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; var listeners = this._events[evt] , len = arguments.length , args , i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); switch (len) { case 1: return listeners.fn.call(listeners.context), true; case 2: return listeners.fn.call(listeners.context, a1), true; case 3: return listeners.fn.call(listeners.context, a1, a2), true; case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } for (i = 1, args = new Array(len -1); i < len; i++) { args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length , j; for (i = 0; i < length; i++) { if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); switch (len) { case 1: listeners[i].fn.call(listeners[i].context); break; case 2: listeners[i].fn.call(listeners[i].context, a1); break; case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { args[j - 1] = arguments[j]; } listeners[i].fn.apply(listeners[i].context, args); } } } return true; }; /** * Add a listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.on = function on(event, fn, context) { return addListener(this, event, fn, context, false); }; /** * Add a one-time listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.once = function once(event, fn, context) { return addListener(this, event, fn, context, true); }; /** * Remove the listeners of a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn Only remove the listeners that match this function. * @param {*} context Only remove the listeners that have this context. * @param {Boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return this; if (!fn) { clearEvent(this, evt); return this; } var listeners = this._events[evt]; if (listeners.fn) { if ( listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context) ) { clearEvent(this, evt); } } else { for (var i = 0, events = [], length = listeners.length; i < length; i++) { if ( listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context) ) { events.push(listeners[i]); } } // // Reset the array, or remove it completely if we have no more listeners. // if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; else clearEvent(this, evt); } return this; }; /** * Remove all listeners, or those of the specified event. * * @param {(String|Symbol)} [event] The event name. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { var evt; if (event) { evt = prefix ? prefix + event : event; if (this._events[evt]) clearEvent(this, evt); } else { this._events = new Events(); this._eventsCount = 0; } return this; }; // // Alias methods names because people roll like that. // EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.addListener = EventEmitter.prototype.on; // // Expose the prefix. // EventEmitter.prefixed = prefix; // // Allow `EventEmitter` to be imported as module namespace. // EventEmitter.EventEmitter = EventEmitter; // // Expose the module. // if (true) { module.exports = EventEmitter; } /***/ }), /***/ 3096: /***/ (function(module) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ (function (global, factory) { true ? module.exports = factory() : 0; }(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice; function createClass(ctor, superClass) { if (superClass) { ctor.prototype = Object.create(superClass.prototype); } ctor.prototype.constructor = ctor; } function Iterable(value) { return isIterable(value) ? value : Seq(value); } createClass(KeyedIterable, Iterable); function KeyedIterable(value) { return isKeyed(value) ? value : KeyedSeq(value); } createClass(IndexedIterable, Iterable); function IndexedIterable(value) { return isIndexed(value) ? value : IndexedSeq(value); } createClass(SetIterable, Iterable); function SetIterable(value) { return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); } function isIterable(maybeIterable) { return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); } function isKeyed(maybeKeyed) { return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); } function isIndexed(maybeIndexed) { return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); } function isAssociative(maybeAssociative) { return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); } function isOrdered(maybeOrdered) { return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); } Iterable.isIterable = isIterable; Iterable.isKeyed = isKeyed; Iterable.isIndexed = isIndexed; Iterable.isAssociative = isAssociative; Iterable.isOrdered = isOrdered; Iterable.Keyed = KeyedIterable; Iterable.Indexed = IndexedIterable; Iterable.Set = SetIterable; var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; // Used for setting prototype methods that IE8 chokes on. var DELETE = 'delete'; // Constants describing the size of trie nodes. var SHIFT = 5; // Resulted in best performance after ______? var SIZE = 1 << SHIFT; var MASK = SIZE - 1; // A consistent shared value representing "not set" which equals nothing other // than itself, and nothing that could be provided externally. var NOT_SET = {}; // Boolean references, Rough equivalent of `bool &`. var CHANGE_LENGTH = { value: false }; var DID_ALTER = { value: false }; function MakeRef(ref) { ref.value = false; return ref; } function SetRef(ref) { ref && (ref.value = true); } // A function which returns a value representing an "owner" for transient writes // to tries. The return value will only ever equal itself, and will not equal // the return of any subsequent call of this function. function OwnerID() {} // http://jsperf.com/copy-array-inline function arrCopy(arr, offset) { offset = offset || 0; var len = Math.max(0, arr.length - offset); var newArr = new Array(len); for (var ii = 0; ii < len; ii++) { newArr[ii] = arr[ii + offset]; } return newArr; } function ensureSize(iter) { if (iter.size === undefined) { iter.size = iter.__iterate(returnTrue); } return iter.size; } function wrapIndex(iter, index) { // This implements "is array index" which the ECMAString spec defines as: // // A String property name P is an array index if and only if // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal // to 2^32−1. // // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects if (typeof index !== 'number') { var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 if ('' + uint32Index !== index || uint32Index === 4294967295) { return NaN; } index = uint32Index; } return index < 0 ? ensureSize(iter) + index : index; } function returnTrue() { return true; } function wholeSlice(begin, end, size) { return (begin === 0 || (size !== undefined && begin <= -size)) && (end === undefined || (size !== undefined && end >= size)); } function resolveBegin(begin, size) { return resolveIndex(begin, size, 0); } function resolveEnd(end, size) { return resolveIndex(end, size, size); } function resolveIndex(index, size, defaultIndex) { return index === undefined ? defaultIndex : index < 0 ? Math.max(0, size + index) : size === undefined ? index : Math.min(size, index); } /* global Symbol */ var ITERATE_KEYS = 0; var ITERATE_VALUES = 1; var ITERATE_ENTRIES = 2; var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; function Iterator(next) { this.next = next; } Iterator.prototype.toString = function() { return '[Iterator]'; }; Iterator.KEYS = ITERATE_KEYS; Iterator.VALUES = ITERATE_VALUES; Iterator.ENTRIES = ITERATE_ENTRIES; Iterator.prototype.inspect = Iterator.prototype.toSource = function () { return this.toString(); } Iterator.prototype[ITERATOR_SYMBOL] = function () { return this; }; function iteratorValue(type, k, v, iteratorResult) { var value = type === 0 ? k : type === 1 ? v : [k, v]; iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { value: value, done: false }); return iteratorResult; } function iteratorDone() { return { value: undefined, done: true }; } function hasIterator(maybeIterable) { return !!getIteratorFn(maybeIterable); } function isIterator(maybeIterator) { return maybeIterator && typeof maybeIterator.next === 'function'; } function getIterator(iterable) { var iteratorFn = getIteratorFn(iterable); return iteratorFn && iteratorFn.call(iterable); } function getIteratorFn(iterable) { var iteratorFn = iterable && ( (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || iterable[FAUX_ITERATOR_SYMBOL] ); if (typeof iteratorFn === 'function') { return iteratorFn; } } function isArrayLike(value) { return value && typeof value.length === 'number'; } createClass(Seq, Iterable); function Seq(value) { return value === null || value === undefined ? emptySequence() : isIterable(value) ? value.toSeq() : seqFromValue(value); } Seq.of = function(/*...values*/) { return Seq(arguments); }; Seq.prototype.toSeq = function() { return this; }; Seq.prototype.toString = function() { return this.__toString('Seq {', '}'); }; Seq.prototype.cacheResult = function() { if (!this._cache && this.__iterateUncached) { this._cache = this.entrySeq().toArray(); this.size = this._cache.length; } return this; }; // abstract __iterateUncached(fn, reverse) Seq.prototype.__iterate = function(fn, reverse) { return seqIterate(this, fn, reverse, true); }; // abstract __iteratorUncached(type, reverse) Seq.prototype.__iterator = function(type, reverse) { return seqIterator(this, type, reverse, true); }; createClass(KeyedSeq, Seq); function KeyedSeq(value) { return value === null || value === undefined ? emptySequence().toKeyedSeq() : isIterable(value) ? (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : keyedSeqFromValue(value); } KeyedSeq.prototype.toKeyedSeq = function() { return this; }; createClass(IndexedSeq, Seq); function IndexedSeq(value) { return value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); } IndexedSeq.of = function(/*...values*/) { return IndexedSeq(arguments); }; IndexedSeq.prototype.toIndexedSeq = function() { return this; }; IndexedSeq.prototype.toString = function() { return this.__toString('Seq [', ']'); }; IndexedSeq.prototype.__iterate = function(fn, reverse) { return seqIterate(this, fn, reverse, false); }; IndexedSeq.prototype.__iterator = function(type, reverse) { return seqIterator(this, type, reverse, false); }; createClass(SetSeq, Seq); function SetSeq(value) { return ( value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value ).toSetSeq(); } SetSeq.of = function(/*...values*/) { return SetSeq(arguments); }; SetSeq.prototype.toSetSeq = function() { return this; }; Seq.isSeq = isSeq; Seq.Keyed = KeyedSeq; Seq.Set = SetSeq; Seq.Indexed = IndexedSeq; var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; Seq.prototype[IS_SEQ_SENTINEL] = true; createClass(ArraySeq, IndexedSeq); function ArraySeq(array) { this._array = array; this.size = array.length; } ArraySeq.prototype.get = function(index, notSetValue) { return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue; }; ArraySeq.prototype.__iterate = function(fn, reverse) { var array = this._array; var maxIndex = array.length - 1; for (var ii = 0; ii <= maxIndex; ii++) { if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) { return ii + 1; } } return ii; }; ArraySeq.prototype.__iterator = function(type, reverse) { var array = this._array; var maxIndex = array.length - 1; var ii = 0; return new Iterator(function() {return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} ); }; createClass(ObjectSeq, KeyedSeq); function ObjectSeq(object) { var keys = Object.keys(object); this._object = object; this._keys = keys; this.size = keys.length; } ObjectSeq.prototype.get = function(key, notSetValue) { if (notSetValue !== undefined && !this.has(key)) { return notSetValue; } return this._object[key]; }; ObjectSeq.prototype.has = function(key) { return this._object.hasOwnProperty(key); }; ObjectSeq.prototype.__iterate = function(fn, reverse) { var object = this._object; var keys = this._keys; var maxIndex = keys.length - 1; for (var ii = 0; ii <= maxIndex; ii++) { var key = keys[reverse ? maxIndex - ii : ii]; if (fn(object[key], key, this) === false) { return ii + 1; } } return ii; }; ObjectSeq.prototype.__iterator = function(type, reverse) { var object = this._object; var keys = this._keys; var maxIndex = keys.length - 1; var ii = 0; return new Iterator(function() { var key = keys[reverse ? maxIndex - ii : ii]; return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, key, object[key]); }); }; ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; createClass(IterableSeq, IndexedSeq); function IterableSeq(iterable) { this._iterable = iterable; this.size = iterable.length || iterable.size; } IterableSeq.prototype.__iterateUncached = function(fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } var iterable = this._iterable; var iterator = getIterator(iterable); var iterations = 0; if (isIterator(iterator)) { var step; while (!(step = iterator.next()).done) { if (fn(step.value, iterations++, this) === false) { break; } } } return iterations; }; IterableSeq.prototype.__iteratorUncached = function(type, reverse) { if (reverse) { return this.cacheResult().__iterator(type, reverse); } var iterable = this._iterable; var iterator = getIterator(iterable); if (!isIterator(iterator)) { return new Iterator(iteratorDone); } var iterations = 0; return new Iterator(function() { var step = iterator.next(); return step.done ? step : iteratorValue(type, iterations++, step.value); }); }; createClass(IteratorSeq, IndexedSeq); function IteratorSeq(iterator) { this._iterator = iterator; this._iteratorCache = []; } IteratorSeq.prototype.__iterateUncached = function(fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } var iterator = this._iterator; var cache = this._iteratorCache; var iterations = 0; while (iterations < cache.length) { if (fn(cache[iterations], iterations++, this) === false) { return iterations; } } var step; while (!(step = iterator.next()).done) { var val = step.value; cache[iterations] = val; if (fn(val, iterations++, this) === false) { break; } } return iterations; }; IteratorSeq.prototype.__iteratorUncached = function(type, reverse) { if (reverse) { return this.cacheResult().__iterator(type, reverse); } var iterator = this._iterator; var cache = this._iteratorCache; var iterations = 0; return new Iterator(function() { if (iterations >= cache.length) { var step = iterator.next(); if (step.done) { return step; } cache[iterations] = step.value; } return iteratorValue(type, iterations, cache[iterations++]); }); }; // # pragma Helper functions function isSeq(maybeSeq) { return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); } var EMPTY_SEQ; function emptySequence() { return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); } function keyedSeqFromValue(value) { var seq = Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : typeof value === 'object' ? new ObjectSeq(value) : undefined; if (!seq) { throw new TypeError( 'Expected Array or iterable object of [k, v] entries, '+ 'or keyed object: ' + value ); } return seq; } function indexedSeqFromValue(value) { var seq = maybeIndexedSeqFromValue(value); if (!seq) { throw new TypeError( 'Expected Array or iterable object of values: ' + value ); } return seq; } function seqFromValue(value) { var seq = maybeIndexedSeqFromValue(value) || (typeof value === 'object' && new ObjectSeq(value)); if (!seq) { throw new TypeError( 'Expected Array or iterable object of values, or keyed object: ' + value ); } return seq; } function maybeIndexedSeqFromValue(value) { return ( isArrayLike(value) ? new ArraySeq(value) : isIterator(value) ? new IteratorSeq(value) : hasIterator(value) ? new IterableSeq(value) : undefined ); } function seqIterate(seq, fn, reverse, useKeys) { var cache = seq._cache; if (cache) { var maxIndex = cache.length - 1; for (var ii = 0; ii <= maxIndex; ii++) { var entry = cache[reverse ? maxIndex - ii : ii]; if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) { return ii + 1; } } return ii; } return seq.__iterateUncached(fn, reverse); } function seqIterator(seq, type, reverse, useKeys) { var cache = seq._cache; if (cache) { var maxIndex = cache.length - 1; var ii = 0; return new Iterator(function() { var entry = cache[reverse ? maxIndex - ii : ii]; return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]); }); } return seq.__iteratorUncached(type, reverse); } function fromJS(json, converter) { return converter ? fromJSWith(converter, json, '', {'': json}) : fromJSDefault(json); } function fromJSWith(converter, json, key, parentJSON) { if (Array.isArray(json)) { return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); } if (isPlainObj(json)) { return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); } return json; } function fromJSDefault(json) { if (Array.isArray(json)) { return IndexedSeq(json).map(fromJSDefault).toList(); } if (isPlainObj(json)) { return KeyedSeq(json).map(fromJSDefault).toMap(); } return json; } function isPlainObj(value) { return value && (value.constructor === Object || value.constructor === undefined); } /** * An extension of the "same-value" algorithm as [described for use by ES6 Map * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality) * * NaN is considered the same as NaN, however -0 and 0 are considered the same * value, which is different from the algorithm described by * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). * * This is extended further to allow Objects to describe the values they * represent, by way of `valueOf` or `equals` (and `hashCode`). * * Note: because of this extension, the key equality of Immutable.Map and the * value equality of Immutable.Set will differ from ES6 Map and Set. * * ### Defining custom values * * The easiest way to describe the value an object represents is by implementing * `valueOf`. For example, `Date` represents a value by returning a unix * timestamp for `valueOf`: * * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ... * var date2 = new Date(1234567890000); * date1.valueOf(); // 1234567890000 * assert( date1 !== date2 ); * assert( Immutable.is( date1, date2 ) ); * * Note: overriding `valueOf` may have other implications if you use this object * where JavaScript expects a primitive, such as implicit string coercion. * * For more complex types, especially collections, implementing `valueOf` may * not be performant. An alternative is to implement `equals` and `hashCode`. * * `equals` takes another object, presumably of similar type, and returns true * if the it is equal. Equality is symmetrical, so the same result should be * returned if this and the argument are flipped. * * assert( a.equals(b) === b.equals(a) ); * * `hashCode` returns a 32bit integer number representing the object which will * be used to determine how to store the value object in a Map or Set. You must * provide both or neither methods, one must not exist without the other. * * Also, an important relationship between these methods must be upheld: if two * values are equal, they *must* return the same hashCode. If the values are not * equal, they might have the same hashCode; this is called a hash collision, * and while undesirable for performance reasons, it is acceptable. * * if (a.equals(b)) { * assert( a.hashCode() === b.hashCode() ); * } * * All Immutable collections implement `equals` and `hashCode`. * */ function is(valueA, valueB) { if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { return true; } if (!valueA || !valueB) { return false; } if (typeof valueA.valueOf === 'function' && typeof valueB.valueOf === 'function') { valueA = valueA.valueOf(); valueB = valueB.valueOf(); if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { return true; } if (!valueA || !valueB) { return false; } } if (typeof valueA.equals === 'function' && typeof valueB.equals === 'function' && valueA.equals(valueB)) { return true; } return false; } function deepEqual(a, b) { if (a === b) { return true; } if ( !isIterable(b) || a.size !== undefined && b.size !== undefined && a.size !== b.size || a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || isKeyed(a) !== isKeyed(b) || isIndexed(a) !== isIndexed(b) || isOrdered(a) !== isOrdered(b) ) { return false; } if (a.size === 0 && b.size === 0) { return true; } var notAssociative = !isAssociative(a); if (isOrdered(a)) { var entries = a.entries(); return b.every(function(v, k) { var entry = entries.next().value; return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); }) && entries.next().done; } var flipped = false; if (a.size === undefined) { if (b.size === undefined) { if (typeof a.cacheResult === 'function') { a.cacheResult(); } } else { flipped = true; var _ = a; a = b; b = _; } } var allEqual = true; var bSize = b.__iterate(function(v, k) { if (notAssociative ? !a.has(v) : flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { allEqual = false; return false; } }); return allEqual && a.size === bSize; } createClass(Repeat, IndexedSeq); function Repeat(value, times) { if (!(this instanceof Repeat)) { return new Repeat(value, times); } this._value = value; this.size = times === undefined ? Infinity : Math.max(0, times); if (this.size === 0) { if (EMPTY_REPEAT) { return EMPTY_REPEAT; } EMPTY_REPEAT = this; } } Repeat.prototype.toString = function() { if (this.size === 0) { return 'Repeat []'; } return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; }; Repeat.prototype.get = function(index, notSetValue) { return this.has(index) ? this._value : notSetValue; }; Repeat.prototype.includes = function(searchValue) { return is(this._value, searchValue); }; Repeat.prototype.slice = function(begin, end) { var size = this.size; return wholeSlice(begin, end, size) ? this : new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); }; Repeat.prototype.reverse = function() { return this; }; Repeat.prototype.indexOf = function(searchValue) { if (is(this._value, searchValue)) { return 0; } return -1; }; Repeat.prototype.lastIndexOf = function(searchValue) { if (is(this._value, searchValue)) { return this.size; } return -1; }; Repeat.prototype.__iterate = function(fn, reverse) { for (var ii = 0; ii < this.size; ii++) { if (fn(this._value, ii, this) === false) { return ii + 1; } } return ii; }; Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; var ii = 0; return new Iterator(function() {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} ); }; Repeat.prototype.equals = function(other) { return other instanceof Repeat ? is(this._value, other._value) : deepEqual(other); }; var EMPTY_REPEAT; function invariant(condition, error) { if (!condition) throw new Error(error); } createClass(Range, IndexedSeq); function Range(start, end, step) { if (!(this instanceof Range)) { return new Range(start, end, step); } invariant(step !== 0, 'Cannot step a Range by 0'); start = start || 0; if (end === undefined) { end = Infinity; } step = step === undefined ? 1 : Math.abs(step); if (end < start) { step = -step; } this._start = start; this._end = end; this._step = step; this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); if (this.size === 0) { if (EMPTY_RANGE) { return EMPTY_RANGE; } EMPTY_RANGE = this; } } Range.prototype.toString = function() { if (this.size === 0) { return 'Range []'; } return 'Range [ ' + this._start + '...' + this._end + (this._step !== 1 ? ' by ' + this._step : '') + ' ]'; }; Range.prototype.get = function(index, notSetValue) { return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue; }; Range.prototype.includes = function(searchValue) { var possibleIndex = (searchValue - this._start) / this._step; return possibleIndex >= 0 && possibleIndex < this.size && possibleIndex === Math.floor(possibleIndex); }; Range.prototype.slice = function(begin, end) { if (wholeSlice(begin, end, this.size)) { return this; } begin = resolveBegin(begin, this.size); end = resolveEnd(end, this.size); if (end <= begin) { return new Range(0, 0); } return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); }; Range.prototype.indexOf = function(searchValue) { var offsetValue = searchValue - this._start; if (offsetValue % this._step === 0) { var index = offsetValue / this._step; if (index >= 0 && index < this.size) { return index } } return -1; }; Range.prototype.lastIndexOf = function(searchValue) { return this.indexOf(searchValue); }; Range.prototype.__iterate = function(fn, reverse) { var maxIndex = this.size - 1; var step = this._step; var value = reverse ? this._start + maxIndex * step : this._start; for (var ii = 0; ii <= maxIndex; ii++) { if (fn(value, ii, this) === false) { return ii + 1; } value += reverse ? -step : step; } return ii; }; Range.prototype.__iterator = function(type, reverse) { var maxIndex = this.size - 1; var step = this._step; var value = reverse ? this._start + maxIndex * step : this._start; var ii = 0; return new Iterator(function() { var v = value; value += reverse ? -step : step; return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); }); }; Range.prototype.equals = function(other) { return other instanceof Range ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other); }; var EMPTY_RANGE; createClass(Collection, Iterable); function Collection() { throw TypeError('Abstract'); } createClass(KeyedCollection, Collection);function KeyedCollection() {} createClass(IndexedCollection, Collection);function IndexedCollection() {} createClass(SetCollection, Collection);function SetCollection() {} Collection.Keyed = KeyedCollection; Collection.Indexed = IndexedCollection; Collection.Set = SetCollection; var imul = typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? Math.imul : function imul(a, b) { a = a | 0; // int b = b | 0; // int var c = a & 0xffff; var d = b & 0xffff; // Shift by 0 fixes the sign on the high part. return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int }; // v8 has an optimization for storing 31-bit signed numbers. // Values which have either 00 or 11 as the high order bits qualify. // This function drops the highest order bit in a signed number, maintaining // the sign bit. function smi(i32) { return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); } function hash(o) { if (o === false || o === null || o === undefined) { return 0; } if (typeof o.valueOf === 'function') { o = o.valueOf(); if (o === false || o === null || o === undefined) { return 0; } } if (o === true) { return 1; } var type = typeof o; if (type === 'number') { if (o !== o || o === Infinity) { return 0; } var h = o | 0; if (h !== o) { h ^= o * 0xFFFFFFFF; } while (o > 0xFFFFFFFF) { o /= 0xFFFFFFFF; h ^= o; } return smi(h); } if (type === 'string') { return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); } if (typeof o.hashCode === 'function') { return o.hashCode(); } if (type === 'object') { return hashJSObj(o); } if (typeof o.toString === 'function') { return hashString(o.toString()); } throw new Error('Value type ' + type + ' cannot be hashed.'); } function cachedHashString(string) { var hash = stringHashCache[string]; if (hash === undefined) { hash = hashString(string); if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { STRING_HASH_CACHE_SIZE = 0; stringHashCache = {}; } STRING_HASH_CACHE_SIZE++; stringHashCache[string] = hash; } return hash; } // http://jsperf.com/hashing-strings function hashString(string) { // This is the hash from JVM // The hash code for a string is computed as // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], // where s[i] is the ith character of the string and n is the length of // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 // (exclusive) by dropping high bits. var hash = 0; for (var ii = 0; ii < string.length; ii++) { hash = 31 * hash + string.charCodeAt(ii) | 0; } return smi(hash); } function hashJSObj(obj) { var hash; if (usingWeakMap) { hash = weakMap.get(obj); if (hash !== undefined) { return hash; } } hash = obj[UID_HASH_KEY]; if (hash !== undefined) { return hash; } if (!canDefineProperty) { hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; if (hash !== undefined) { return hash; } hash = getIENodeHash(obj); if (hash !== undefined) { return hash; } } hash = ++objHashUID; if (objHashUID & 0x40000000) { objHashUID = 0; } if (usingWeakMap) { weakMap.set(obj, hash); } else if (isExtensible !== undefined && isExtensible(obj) === false) { throw new Error('Non-extensible objects are not allowed as keys.'); } else if (canDefineProperty) { Object.defineProperty(obj, UID_HASH_KEY, { 'enumerable': false, 'configurable': false, 'writable': false, 'value': hash }); } else if (obj.propertyIsEnumerable !== undefined && obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { // Since we can't define a non-enumerable property on the object // we'll hijack one of the less-used non-enumerable properties to // save our hash on it. Since this is a function it will not show up in // `JSON.stringify` which is what we want. obj.propertyIsEnumerable = function() { return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); }; obj.propertyIsEnumerable[UID_HASH_KEY] = hash; } else if (obj.nodeType !== undefined) { // At this point we couldn't get the IE `uniqueID` to use as a hash // and we couldn't use a non-enumerable property to exploit the // dontEnum bug so we simply add the `UID_HASH_KEY` on the node // itself. obj[UID_HASH_KEY] = hash; } else { throw new Error('Unable to set a non-enumerable property on object.'); } return hash; } // Get references to ES5 object methods. var isExtensible = Object.isExtensible; // True if Object.defineProperty works as expected. IE8 fails this test. var canDefineProperty = (function() { try { Object.defineProperty({}, '@', {}); return true; } catch (e) { return false; } }()); // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it // and avoid memory leaks from the IE cloneNode bug. function getIENodeHash(node) { if (node && node.nodeType > 0) { switch (node.nodeType) { case 1: // Element return node.uniqueID; case 9: // Document return node.documentElement && node.documentElement.uniqueID; } } } // If possible, use a WeakMap. var usingWeakMap = typeof WeakMap === 'function'; var weakMap; if (usingWeakMap) { weakMap = new WeakMap(); } var objHashUID = 0; var UID_HASH_KEY = '__immutablehash__'; if (typeof Symbol === 'function') { UID_HASH_KEY = Symbol(UID_HASH_KEY); } var STRING_HASH_CACHE_MIN_STRLEN = 16; var STRING_HASH_CACHE_MAX_SIZE = 255; var STRING_HASH_CACHE_SIZE = 0; var stringHashCache = {}; function assertNotInfinite(size) { invariant( size !== Infinity, 'Cannot perform this action with an infinite size.' ); } createClass(Map, KeyedCollection); // @pragma Construction function Map(value) { return value === null || value === undefined ? emptyMap() : isMap(value) && !isOrdered(value) ? value : emptyMap().withMutations(function(map ) { var iter = KeyedIterable(value); assertNotInfinite(iter.size); iter.forEach(function(v, k) {return map.set(k, v)}); }); } Map.of = function() {var keyValues = SLICE$0.call(arguments, 0); return emptyMap().withMutations(function(map ) { for (var i = 0; i < keyValues.length; i += 2) { if (i + 1 >= keyValues.length) { throw new Error('Missing value for key: ' + keyValues[i]); } map.set(keyValues[i], keyValues[i + 1]); } }); }; Map.prototype.toString = function() { return this.__toString('Map {', '}'); }; // @pragma Access Map.prototype.get = function(k, notSetValue) { return this._root ? this._root.get(0, undefined, k, notSetValue) : notSetValue; }; // @pragma Modification Map.prototype.set = function(k, v) { return updateMap(this, k, v); }; Map.prototype.setIn = function(keyPath, v) { return this.updateIn(keyPath, NOT_SET, function() {return v}); }; Map.prototype.remove = function(k) { return updateMap(this, k, NOT_SET); }; Map.prototype.deleteIn = function(keyPath) { return this.updateIn(keyPath, function() {return NOT_SET}); }; Map.prototype.update = function(k, notSetValue, updater) { return arguments.length === 1 ? k(this) : this.updateIn([k], notSetValue, updater); }; Map.prototype.updateIn = function(keyPath, notSetValue, updater) { if (!updater) { updater = notSetValue; notSetValue = undefined; } var updatedValue = updateInDeepMap( this, forceIterator(keyPath), notSetValue, updater ); return updatedValue === NOT_SET ? undefined : updatedValue; }; Map.prototype.clear = function() { if (this.size === 0) { return this; } if (this.__ownerID) { this.size = 0; this._root = null; this.__hash = undefined; this.__altered = true; return this; } return emptyMap(); }; // @pragma Composition Map.prototype.merge = function(/*...iters*/) { return mergeIntoMapWith(this, undefined, arguments); }; Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return mergeIntoMapWith(this, merger, iters); }; Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); return this.updateIn( keyPath, emptyMap(), function(m ) {return typeof m.merge === 'function' ? m.merge.apply(m, iters) : iters[iters.length - 1]} ); }; Map.prototype.mergeDeep = function(/*...iters*/) { return mergeIntoMapWith(this, deepMerger, arguments); }; Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return mergeIntoMapWith(this, deepMergerWith(merger), iters); }; Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); return this.updateIn( keyPath, emptyMap(), function(m ) {return typeof m.mergeDeep === 'function' ? m.mergeDeep.apply(m, iters) : iters[iters.length - 1]} ); }; Map.prototype.sort = function(comparator) { // Late binding return OrderedMap(sortFactory(this, comparator)); }; Map.prototype.sortBy = function(mapper, comparator) { // Late binding return OrderedMap(sortFactory(this, comparator, mapper)); }; // @pragma Mutability Map.prototype.withMutations = function(fn) { var mutable = this.asMutable(); fn(mutable); return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; }; Map.prototype.asMutable = function() { return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); }; Map.prototype.asImmutable = function() { return this.__ensureOwner(); }; Map.prototype.wasAltered = function() { return this.__altered; }; Map.prototype.__iterator = function(type, reverse) { return new MapIterator(this, type, reverse); }; Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; var iterations = 0; this._root && this._root.iterate(function(entry ) { iterations++; return fn(entry[1], entry[0], this$0); }, reverse); return iterations; }; Map.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } if (!ownerID) { this.__ownerID = ownerID; this.__altered = false; return this; } return makeMap(this.size, this._root, ownerID, this.__hash); }; function isMap(maybeMap) { return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); } Map.isMap = isMap; var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; var MapPrototype = Map.prototype; MapPrototype[IS_MAP_SENTINEL] = true; MapPrototype[DELETE] = MapPrototype.remove; MapPrototype.removeIn = MapPrototype.deleteIn; // #pragma Trie Nodes function ArrayMapNode(ownerID, entries) { this.ownerID = ownerID; this.entries = entries; } ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { var entries = this.entries; for (var ii = 0, len = entries.length; ii < len; ii++) { if (is(key, entries[ii][0])) { return entries[ii][1]; } } return notSetValue; }; ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { var removed = value === NOT_SET; var entries = this.entries; var idx = 0; for (var len = entries.length; idx < len; idx++) { if (is(key, entries[idx][0])) { break; } } var exists = idx < len; if (exists ? entries[idx][1] === value : removed) { return this; } SetRef(didAlter); (removed || !exists) && SetRef(didChangeSize); if (removed && entries.length === 1) { return; // undefined } if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) { return createNodes(ownerID, entries, key, value); } var isEditable = ownerID && ownerID === this.ownerID; var newEntries = isEditable ? entries : arrCopy(entries); if (exists) { if (removed) { idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); } else { newEntries[idx] = [key, value]; } } else { newEntries.push([key, value]); } if (isEditable) { this.entries = newEntries; return this; } return new ArrayMapNode(ownerID, newEntries); }; function BitmapIndexedNode(ownerID, bitmap, nodes) { this.ownerID = ownerID; this.bitmap = bitmap; this.nodes = nodes; } BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) { if (keyHash === undefined) { keyHash = hash(key); } var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); var bitmap = this.bitmap; return (bitmap & bit) === 0 ? notSetValue : this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); }; BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (keyHash === undefined) { keyHash = hash(key); } var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; var bit = 1 << keyHashFrag; var bitmap = this.bitmap; var exists = (bitmap & bit) !== 0; if (!exists && value === NOT_SET) { return this; } var idx = popCount(bitmap & (bit - 1)); var nodes = this.nodes; var node = exists ? nodes[idx] : undefined; var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); if (newNode === node) { return this; } if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) { return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); } if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { return nodes[idx ^ 1]; } if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) { return newNode; } var isEditable = ownerID && ownerID === this.ownerID; var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; var newNodes = exists ? newNode ? setIn(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable); if (isEditable) { this.bitmap = newBitmap; this.nodes = newNodes; return this; } return new BitmapIndexedNode(ownerID, newBitmap, newNodes); }; function HashArrayMapNode(ownerID, count, nodes) { this.ownerID = ownerID; this.count = count; this.nodes = nodes; } HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { if (keyHash === undefined) { keyHash = hash(key); } var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; var node = this.nodes[idx]; return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; }; HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (keyHash === undefined) { keyHash = hash(key); } var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; var removed = value === NOT_SET; var nodes = this.nodes; var node = nodes[idx]; if (removed && !node) { return this; } var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); if (newNode === node) { return this; } var newCount = this.count; if (!node) { newCount++; } else if (!newNode) { newCount--; if (newCount < MIN_HASH_ARRAY_MAP_SIZE) { return packNodes(ownerID, nodes, newCount, idx); } } var isEditable = ownerID && ownerID === this.ownerID; var newNodes = setIn(nodes, idx, newNode, isEditable); if (isEditable) { this.count = newCount; this.nodes = newNodes; return this; } return new HashArrayMapNode(ownerID, newCount, newNodes); }; function HashCollisionNode(ownerID, keyHash, entries) { this.ownerID = ownerID; this.keyHash = keyHash; this.entries = entries; } HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) { var entries = this.entries; for (var ii = 0, len = entries.length; ii < len; ii++) { if (is(key, entries[ii][0])) { return entries[ii][1]; } } return notSetValue; }; HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (keyHash === undefined) { keyHash = hash(key); } var removed = value === NOT_SET; if (keyHash !== this.keyHash) { if (removed) { return this; } SetRef(didAlter); SetRef(didChangeSize); return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); } var entries = this.entries; var idx = 0; for (var len = entries.length; idx < len; idx++) { if (is(key, entries[idx][0])) { break; } } var exists = idx < len; if (exists ? entries[idx][1] === value : removed) { return this; } SetRef(didAlter); (removed || !exists) && SetRef(didChangeSize); if (removed && len === 2) { return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); } var isEditable = ownerID && ownerID === this.ownerID; var newEntries = isEditable ? entries : arrCopy(entries); if (exists) { if (removed) { idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); } else { newEntries[idx] = [key, value]; } } else { newEntries.push([key, value]); } if (isEditable) { this.entries = newEntries; return this; } return new HashCollisionNode(ownerID, this.keyHash, newEntries); }; function ValueNode(ownerID, keyHash, entry) { this.ownerID = ownerID; this.keyHash = keyHash; this.entry = entry; } ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) { return is(key, this.entry[0]) ? this.entry[1] : notSetValue; }; ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { var removed = value === NOT_SET; var keyMatch = is(key, this.entry[0]); if (keyMatch ? value === this.entry[1] : removed) { return this; } SetRef(didAlter); if (removed) { SetRef(didChangeSize); return; // undefined } if (keyMatch) { if (ownerID && ownerID === this.ownerID) { this.entry[1] = value; return this; } return new ValueNode(ownerID, this.keyHash, [key, value]); } SetRef(didChangeSize); return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]); }; // #pragma Iterators ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function (fn, reverse) { var entries = this.entries; for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { return false; } } } BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function (fn, reverse) { var nodes = this.nodes; for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { var node = nodes[reverse ? maxIndex - ii : ii]; if (node && node.iterate(fn, reverse) === false) { return false; } } } ValueNode.prototype.iterate = function (fn, reverse) { return fn(this.entry); } createClass(MapIterator, Iterator); function MapIterator(map, type, reverse) { this._type = type; this._reverse = reverse; this._stack = map._root && mapIteratorFrame(map._root); } MapIterator.prototype.next = function() { var type = this._type; var stack = this._stack; while (stack) { var node = stack.node; var index = stack.index++; var maxIndex; if (node.entry) { if (index === 0) { return mapIteratorValue(type, node.entry); } } else if (node.entries) { maxIndex = node.entries.length - 1; if (index <= maxIndex) { return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); } } else { maxIndex = node.nodes.length - 1; if (index <= maxIndex) { var subNode = node.nodes[this._reverse ? maxIndex - index : index]; if (subNode) { if (subNode.entry) { return mapIteratorValue(type, subNode.entry); } stack = this._stack = mapIteratorFrame(subNode, stack); } continue; } } stack = this._stack = this._stack.__prev; } return iteratorDone(); }; function mapIteratorValue(type, entry) { return iteratorValue(type, entry[0], entry[1]); } function mapIteratorFrame(node, prev) { return { node: node, index: 0, __prev: prev }; } function makeMap(size, root, ownerID, hash) { var map = Object.create(MapPrototype); map.size = size; map._root = root; map.__ownerID = ownerID; map.__hash = hash; map.__altered = false; return map; } var EMPTY_MAP; function emptyMap() { return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); } function updateMap(map, k, v) { var newRoot; var newSize; if (!map._root) { if (v === NOT_SET) { return map; } newSize = 1; newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); } else { var didChangeSize = MakeRef(CHANGE_LENGTH); var didAlter = MakeRef(DID_ALTER); newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); if (!didAlter.value) { return map; } newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); } if (map.__ownerID) { map.size = newSize; map._root = newRoot; map.__hash = undefined; map.__altered = true; return map; } return newRoot ? makeMap(newSize, newRoot) : emptyMap(); } function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (!node) { if (value === NOT_SET) { return node; } SetRef(didAlter); SetRef(didChangeSize); return new ValueNode(ownerID, keyHash, [key, value]); } return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); } function isLeafNode(node) { return node.constructor === ValueNode || node.constructor === HashCollisionNode; } function mergeIntoNode(node, ownerID, shift, keyHash, entry) { if (node.keyHash === keyHash) { return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); } var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; var newNode; var nodes = idx1 === idx2 ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); } function createNodes(ownerID, entries, key, value) { if (!ownerID) { ownerID = new OwnerID(); } var node = new ValueNode(ownerID, hash(key), [key, value]); for (var ii = 0; ii < entries.length; ii++) { var entry = entries[ii]; node = node.update(ownerID, 0, undefined, entry[0], entry[1]); } return node; } function packNodes(ownerID, nodes, count, excluding) { var bitmap = 0; var packedII = 0; var packedNodes = new Array(count); for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { var node = nodes[ii]; if (node !== undefined && ii !== excluding) { bitmap |= bit; packedNodes[packedII++] = node; } } return new BitmapIndexedNode(ownerID, bitmap, packedNodes); } function expandNodes(ownerID, nodes, bitmap, including, node) { var count = 0; var expandedNodes = new Array(SIZE); for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; } expandedNodes[including] = node; return new HashArrayMapNode(ownerID, count + 1, expandedNodes); } function mergeIntoMapWith(map, merger, iterables) { var iters = []; for (var ii = 0; ii < iterables.length; ii++) { var value = iterables[ii]; var iter = KeyedIterable(value); if (!isIterable(value)) { iter = iter.map(function(v ) {return fromJS(v)}); } iters.push(iter); } return mergeIntoCollectionWith(map, merger, iters); } function deepMerger(existing, value, key) { return existing && existing.mergeDeep && isIterable(value) ? existing.mergeDeep(value) : is(existing, value) ? existing : value; } function deepMergerWith(merger) { return function(existing, value, key) { if (existing && existing.mergeDeepWith && isIterable(value)) { return existing.mergeDeepWith(merger, value); } var nextValue = merger(existing, value, key); return is(existing, nextValue) ? existing : nextValue; }; } function mergeIntoCollectionWith(collection, merger, iters) { iters = iters.filter(function(x ) {return x.size !== 0}); if (iters.length === 0) { return collection; } if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { return collection.constructor(iters[0]); } return collection.withMutations(function(collection ) { var mergeIntoMap = merger ? function(value, key) { collection.update(key, NOT_SET, function(existing ) {return existing === NOT_SET ? value : merger(existing, value, key)} ); } : function(value, key) { collection.set(key, value); } for (var ii = 0; ii < iters.length; ii++) { iters[ii].forEach(mergeIntoMap); } }); } function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { var isNotSet = existing === NOT_SET; var step = keyPathIter.next(); if (step.done) { var existingValue = isNotSet ? notSetValue : existing; var newValue = updater(existingValue); return newValue === existingValue ? existing : newValue; } invariant( isNotSet || (existing && existing.set), 'invalid keyPath' ); var key = step.value; var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); var nextUpdated = updateInDeepMap( nextExisting, keyPathIter, notSetValue, updater ); return nextUpdated === nextExisting ? existing : nextUpdated === NOT_SET ? existing.remove(key) : (isNotSet ? emptyMap() : existing).set(key, nextUpdated); } function popCount(x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0f0f0f0f; x = x + (x >> 8); x = x + (x >> 16); return x & 0x7f; } function setIn(array, idx, val, canEdit) { var newArray = canEdit ? array : arrCopy(array); newArray[idx] = val; return newArray; } function spliceIn(array, idx, val, canEdit) { var newLen = array.length + 1; if (canEdit && idx + 1 === newLen) { array[idx] = val; return array; } var newArray = new Array(newLen); var after = 0; for (var ii = 0; ii < newLen; ii++) { if (ii === idx) { newArray[ii] = val; after = -1; } else { newArray[ii] = array[ii + after]; } } return newArray; } function spliceOut(array, idx, canEdit) { var newLen = array.length - 1; if (canEdit && idx === newLen) { array.pop(); return array; } var newArray = new Array(newLen); var after = 0; for (var ii = 0; ii < newLen; ii++) { if (ii === idx) { after = 1; } newArray[ii] = array[ii + after]; } return newArray; } var MAX_ARRAY_MAP_SIZE = SIZE / 4; var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; createClass(List, IndexedCollection); // @pragma Construction function List(value) { var empty = emptyList(); if (value === null || value === undefined) { return empty; } if (isList(value)) { return value; } var iter = IndexedIterable(value); var size = iter.size; if (size === 0) { return empty; } assertNotInfinite(size); if (size > 0 && size < SIZE) { return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); } return empty.withMutations(function(list ) { list.setSize(size); iter.forEach(function(v, i) {return list.set(i, v)}); }); } List.of = function(/*...values*/) { return this(arguments); }; List.prototype.toString = function() { return this.__toString('List [', ']'); }; // @pragma Access List.prototype.get = function(index, notSetValue) { index = wrapIndex(this, index); if (index >= 0 && index < this.size) { index += this._origin; var node = listNodeFor(this, index); return node && node.array[index & MASK]; } return notSetValue; }; // @pragma Modification List.prototype.set = function(index, value) { return updateList(this, index, value); }; List.prototype.remove = function(index) { return !this.has(index) ? this : index === 0 ? this.shift() : index === this.size - 1 ? this.pop() : this.splice(index, 1); }; List.prototype.insert = function(index, value) { return this.splice(index, 0, value); }; List.prototype.clear = function() { if (this.size === 0) { return this; } if (this.__ownerID) { this.size = this._origin = this._capacity = 0; this._level = SHIFT; this._root = this._tail = null; this.__hash = undefined; this.__altered = true; return this; } return emptyList(); }; List.prototype.push = function(/*...values*/) { var values = arguments; var oldSize = this.size; return this.withMutations(function(list ) { setListBounds(list, 0, oldSize + values.length); for (var ii = 0; ii < values.length; ii++) { list.set(oldSize + ii, values[ii]); } }); }; List.prototype.pop = function() { return setListBounds(this, 0, -1); }; List.prototype.unshift = function(/*...values*/) { var values = arguments; return this.withMutations(function(list ) { setListBounds(list, -values.length); for (var ii = 0; ii < values.length; ii++) { list.set(ii, values[ii]); } }); }; List.prototype.shift = function() { return setListBounds(this, 1); }; // @pragma Composition List.prototype.merge = function(/*...iters*/) { return mergeIntoListWith(this, undefined, arguments); }; List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return mergeIntoListWith(this, merger, iters); }; List.prototype.mergeDeep = function(/*...iters*/) { return mergeIntoListWith(this, deepMerger, arguments); }; List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return mergeIntoListWith(this, deepMergerWith(merger), iters); }; List.prototype.setSize = function(size) { return setListBounds(this, 0, size); }; // @pragma Iteration List.prototype.slice = function(begin, end) { var size = this.size; if (wholeSlice(begin, end, size)) { return this; } return setListBounds( this, resolveBegin(begin, size), resolveEnd(end, size) ); }; List.prototype.__iterator = function(type, reverse) { var index = 0; var values = iterateList(this, reverse); return new Iterator(function() { var value = values(); return value === DONE ? iteratorDone() : iteratorValue(type, index++, value); }); }; List.prototype.__iterate = function(fn, reverse) { var index = 0; var values = iterateList(this, reverse); var value; while ((value = values()) !== DONE) { if (fn(value, index++, this) === false) { break; } } return index; }; List.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } if (!ownerID) { this.__ownerID = ownerID; return this; } return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); }; function isList(maybeList) { return !!(maybeList && maybeList[IS_LIST_SENTINEL]); } List.isList = isList; var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; var ListPrototype = List.prototype; ListPrototype[IS_LIST_SENTINEL] = true; ListPrototype[DELETE] = ListPrototype.remove; ListPrototype.setIn = MapPrototype.setIn; ListPrototype.deleteIn = ListPrototype.removeIn = MapPrototype.removeIn; ListPrototype.update = MapPrototype.update; ListPrototype.updateIn = MapPrototype.updateIn; ListPrototype.mergeIn = MapPrototype.mergeIn; ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; ListPrototype.withMutations = MapPrototype.withMutations; ListPrototype.asMutable = MapPrototype.asMutable; ListPrototype.asImmutable = MapPrototype.asImmutable; ListPrototype.wasAltered = MapPrototype.wasAltered; function VNode(array, ownerID) { this.array = array; this.ownerID = ownerID; } // TODO: seems like these methods are very similar VNode.prototype.removeBefore = function(ownerID, level, index) { if (index === level ? 1 << level : false || this.array.length === 0) { return this; } var originIndex = (index >>> level) & MASK; if (originIndex >= this.array.length) { return new VNode([], ownerID); } var removingFirst = originIndex === 0; var newChild; if (level > 0) { var oldChild = this.array[originIndex]; newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); if (newChild === oldChild && removingFirst) { return this; } } if (removingFirst && !newChild) { return this; } var editable = editableVNode(this, ownerID); if (!removingFirst) { for (var ii = 0; ii < originIndex; ii++) { editable.array[ii] = undefined; } } if (newChild) { editable.array[originIndex] = newChild; } return editable; }; VNode.prototype.removeAfter = function(ownerID, level, index) { if (index === (level ? 1 << level : 0) || this.array.length === 0) { return this; } var sizeIndex = ((index - 1) >>> level) & MASK; if (sizeIndex >= this.array.length) { return this; } var newChild; if (level > 0) { var oldChild = this.array[sizeIndex]; newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); if (newChild === oldChild && sizeIndex === this.array.length - 1) { return this; } } var editable = editableVNode(this, ownerID); editable.array.splice(sizeIndex + 1); if (newChild) { editable.array[sizeIndex] = newChild; } return editable; }; var DONE = {}; function iterateList(list, reverse) { var left = list._origin; var right = list._capacity; var tailPos = getTailOffset(right); var tail = list._tail; return iterateNodeOrLeaf(list._root, list._level, 0); function iterateNodeOrLeaf(node, level, offset) { return level === 0 ? iterateLeaf(node, offset) : iterateNode(node, level, offset); } function iterateLeaf(node, offset) { var array = offset === tailPos ? tail && tail.array : node && node.array; var from = offset > left ? 0 : left - offset; var to = right - offset; if (to > SIZE) { to = SIZE; } return function() { if (from === to) { return DONE; } var idx = reverse ? --to : from++; return array && array[idx]; }; } function iterateNode(node, level, offset) { var values; var array = node && node.array; var from = offset > left ? 0 : (left - offset) >> level; var to = ((right - offset) >> level) + 1; if (to > SIZE) { to = SIZE; } return function() { do { if (values) { var value = values(); if (value !== DONE) { return value; } values = null; } if (from === to) { return DONE; } var idx = reverse ? --to : from++; values = iterateNodeOrLeaf( array && array[idx], level - SHIFT, offset + (idx << level) ); } while (true); }; } } function makeList(origin, capacity, level, root, tail, ownerID, hash) { var list = Object.create(ListPrototype); list.size = capacity - origin; list._origin = origin; list._capacity = capacity; list._level = level; list._root = root; list._tail = tail; list.__ownerID = ownerID; list.__hash = hash; list.__altered = false; return list; } var EMPTY_LIST; function emptyList() { return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); } function updateList(list, index, value) { index = wrapIndex(list, index); if (index !== index) { return list; } if (index >= list.size || index < 0) { return list.withMutations(function(list ) { index < 0 ? setListBounds(list, index).set(0, value) : setListBounds(list, 0, index + 1).set(index, value) }); } index += list._origin; var newTail = list._tail; var newRoot = list._root; var didAlter = MakeRef(DID_ALTER); if (index >= getTailOffset(list._capacity)) { newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); } else { newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); } if (!didAlter.value) { return list; } if (list.__ownerID) { list._root = newRoot; list._tail = newTail; list.__hash = undefined; list.__altered = true; return list; } return makeList(list._origin, list._capacity, list._level, newRoot, newTail); } function updateVNode(node, ownerID, level, index, value, didAlter) { var idx = (index >>> level) & MASK; var nodeHas = node && idx < node.array.length; if (!nodeHas && value === undefined) { return node; } var newNode; if (level > 0) { var lowerNode = node && node.array[idx]; var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); if (newLowerNode === lowerNode) { return node; } newNode = editableVNode(node, ownerID); newNode.array[idx] = newLowerNode; return newNode; } if (nodeHas && node.array[idx] === value) { return node; } SetRef(didAlter); newNode = editableVNode(node, ownerID); if (value === undefined && idx === newNode.array.length - 1) { newNode.array.pop(); } else { newNode.array[idx] = value; } return newNode; } function editableVNode(node, ownerID) { if (ownerID && node && ownerID === node.ownerID) { return node; } return new VNode(node ? node.array.slice() : [], ownerID); } function listNodeFor(list, rawIndex) { if (rawIndex >= getTailOffset(list._capacity)) { return list._tail; } if (rawIndex < 1 << (list._level + SHIFT)) { var node = list._root; var level = list._level; while (node && level > 0) { node = node.array[(rawIndex >>> level) & MASK]; level -= SHIFT; } return node; } } function setListBounds(list, begin, end) { // Sanitize begin & end using this shorthand for ToInt32(argument) // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 if (begin !== undefined) { begin = begin | 0; } if (end !== undefined) { end = end | 0; } var owner = list.__ownerID || new OwnerID(); var oldOrigin = list._origin; var oldCapacity = list._capacity; var newOrigin = oldOrigin + begin; var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; if (newOrigin === oldOrigin && newCapacity === oldCapacity) { return list; } // If it's going to end after it starts, it's empty. if (newOrigin >= newCapacity) { return list.clear(); } var newLevel = list._level; var newRoot = list._root; // New origin might need creating a higher root. var offsetShift = 0; while (newOrigin + offsetShift < 0) { newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); newLevel += SHIFT; offsetShift += 1 << newLevel; } if (offsetShift) { newOrigin += offsetShift; oldOrigin += offsetShift; newCapacity += offsetShift; oldCapacity += offsetShift; } var oldTailOffset = getTailOffset(oldCapacity); var newTailOffset = getTailOffset(newCapacity); // New size might need creating a higher root. while (newTailOffset >= 1 << (newLevel + SHIFT)) { newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); newLevel += SHIFT; } // Locate or create the new tail. var oldTail = list._tail; var newTail = newTailOffset < oldTailOffset ? listNodeFor(list, newCapacity - 1) : newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; // Merge Tail into tree. if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { newRoot = editableVNode(newRoot, owner); var node = newRoot; for (var level = newLevel; level > SHIFT; level -= SHIFT) { var idx = (oldTailOffset >>> level) & MASK; node = node.array[idx] = editableVNode(node.array[idx], owner); } node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; } // If the size has been reduced, there's a chance the tail needs to be trimmed. if (newCapacity < oldCapacity) { newTail = newTail && newTail.removeAfter(owner, 0, newCapacity); } // If the new origin is within the tail, then we do not need a root. if (newOrigin >= newTailOffset) { newOrigin -= newTailOffset; newCapacity -= newTailOffset; newLevel = SHIFT; newRoot = null; newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); // Otherwise, if the root has been trimmed, garbage collect. } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { offsetShift = 0; // Identify the new top root node of the subtree of the old root. while (newRoot) { var beginIndex = (newOrigin >>> newLevel) & MASK; if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { break; } if (beginIndex) { offsetShift += (1 << newLevel) * beginIndex; } newLevel -= SHIFT; newRoot = newRoot.array[beginIndex]; } // Trim the new sides of the new root. if (newRoot && newOrigin > oldOrigin) { newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); } if (newRoot && newTailOffset < oldTailOffset) { newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); } if (offsetShift) { newOrigin -= offsetShift; newCapacity -= offsetShift; } } if (list.__ownerID) { list.size = newCapacity - newOrigin; list._origin = newOrigin; list._capacity = newCapacity; list._level = newLevel; list._root = newRoot; list._tail = newTail; list.__hash = undefined; list.__altered = true; return list; } return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); } function mergeIntoListWith(list, merger, iterables) { var iters = []; var maxSize = 0; for (var ii = 0; ii < iterables.length; ii++) { var value = iterables[ii]; var iter = IndexedIterable(value); if (iter.size > maxSize) { maxSize = iter.size; } if (!isIterable(value)) { iter = iter.map(function(v ) {return fromJS(v)}); } iters.push(iter); } if (maxSize > list.size) { list = list.setSize(maxSize); } return mergeIntoCollectionWith(list, merger, iters); } function getTailOffset(size) { return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); } createClass(OrderedMap, Map); // @pragma Construction function OrderedMap(value) { return value === null || value === undefined ? emptyOrderedMap() : isOrderedMap(value) ? value : emptyOrderedMap().withMutations(function(map ) { var iter = KeyedIterable(value); assertNotInfinite(iter.size); iter.forEach(function(v, k) {return map.set(k, v)}); }); } OrderedMap.of = function(/*...values*/) { return this(arguments); }; OrderedMap.prototype.toString = function() { return this.__toString('OrderedMap {', '}'); }; // @pragma Access OrderedMap.prototype.get = function(k, notSetValue) { var index = this._map.get(k); return index !== undefined ? this._list.get(index)[1] : notSetValue; }; // @pragma Modification OrderedMap.prototype.clear = function() { if (this.size === 0) { return this; } if (this.__ownerID) { this.size = 0; this._map.clear(); this._list.clear(); return this; } return emptyOrderedMap(); }; OrderedMap.prototype.set = function(k, v) { return updateOrderedMap(this, k, v); }; OrderedMap.prototype.remove = function(k) { return updateOrderedMap(this, k, NOT_SET); }; OrderedMap.prototype.wasAltered = function() { return this._map.wasAltered() || this._list.wasAltered(); }; OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; return this._list.__iterate( function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, reverse ); }; OrderedMap.prototype.__iterator = function(type, reverse) { return this._list.fromEntrySeq().__iterator(type, reverse); }; OrderedMap.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } var newMap = this._map.__ensureOwner(ownerID); var newList = this._list.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; this._map = newMap; this._list = newList; return this; } return makeOrderedMap(newMap, newList, ownerID, this.__hash); }; function isOrderedMap(maybeOrderedMap) { return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); } OrderedMap.isOrderedMap = isOrderedMap; OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; function makeOrderedMap(map, list, ownerID, hash) { var omap = Object.create(OrderedMap.prototype); omap.size = map ? map.size : 0; omap._map = map; omap._list = list; omap.__ownerID = ownerID; omap.__hash = hash; return omap; } var EMPTY_ORDERED_MAP; function emptyOrderedMap() { return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); } function updateOrderedMap(omap, k, v) { var map = omap._map; var list = omap._list; var i = map.get(k); var has = i !== undefined; var newMap; var newList; if (v === NOT_SET) { // removed if (!has) { return omap; } if (list.size >= SIZE && list.size >= map.size * 2) { newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); if (omap.__ownerID) { newMap.__ownerID = newList.__ownerID = omap.__ownerID; } } else { newMap = map.remove(k); newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); } } else { if (has) { if (v === list.get(i)[1]) { return omap; } newMap = map; newList = list.set(i, [k, v]); } else { newMap = map.set(k, list.size); newList = list.set(list.size, [k, v]); } } if (omap.__ownerID) { omap.size = newMap.size; omap._map = newMap; omap._list = newList; omap.__hash = undefined; return omap; } return makeOrderedMap(newMap, newList); } createClass(ToKeyedSequence, KeyedSeq); function ToKeyedSequence(indexed, useKeys) { this._iter = indexed; this._useKeys = useKeys; this.size = indexed.size; } ToKeyedSequence.prototype.get = function(key, notSetValue) { return this._iter.get(key, notSetValue); }; ToKeyedSequence.prototype.has = function(key) { return this._iter.has(key); }; ToKeyedSequence.prototype.valueSeq = function() { return this._iter.valueSeq(); }; ToKeyedSequence.prototype.reverse = function() {var this$0 = this; var reversedSequence = reverseFactory(this, true); if (!this._useKeys) { reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; } return reversedSequence; }; ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; var mappedSequence = mapFactory(this, mapper, context); if (!this._useKeys) { mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; } return mappedSequence; }; ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; var ii; return this._iter.__iterate( this._useKeys ? function(v, k) {return fn(v, k, this$0)} : ((ii = reverse ? resolveSize(this) : 0), function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), reverse ); }; ToKeyedSequence.prototype.__iterator = function(type, reverse) { if (this._useKeys) { return this._iter.__iterator(type, reverse); } var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); var ii = reverse ? resolveSize(this) : 0; return new Iterator(function() { var step = iterator.next(); return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value, step); }); }; ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; createClass(ToIndexedSequence, IndexedSeq); function ToIndexedSequence(iter) { this._iter = iter; this.size = iter.size; } ToIndexedSequence.prototype.includes = function(value) { return this._iter.includes(value); }; ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; var iterations = 0; return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); }; ToIndexedSequence.prototype.__iterator = function(type, reverse) { var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); var iterations = 0; return new Iterator(function() { var step = iterator.next(); return step.done ? step : iteratorValue(type, iterations++, step.value, step) }); }; createClass(ToSetSequence, SetSeq); function ToSetSequence(iter) { this._iter = iter; this.size = iter.size; } ToSetSequence.prototype.has = function(key) { return this._iter.includes(key); }; ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); }; ToSetSequence.prototype.__iterator = function(type, reverse) { var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); return new Iterator(function() { var step = iterator.next(); return step.done ? step : iteratorValue(type, step.value, step.value, step); }); }; createClass(FromEntriesSequence, KeyedSeq); function FromEntriesSequence(entries) { this._iter = entries; this.size = entries.size; } FromEntriesSequence.prototype.entrySeq = function() { return this._iter.toSeq(); }; FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; return this._iter.__iterate(function(entry ) { // Check if entry exists first so array access doesn't throw for holes // in the parent iteration. if (entry) { validateEntry(entry); var indexedIterable = isIterable(entry); return fn( indexedIterable ? entry.get(1) : entry[1], indexedIterable ? entry.get(0) : entry[0], this$0 ); } }, reverse); }; FromEntriesSequence.prototype.__iterator = function(type, reverse) { var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); return new Iterator(function() { while (true) { var step = iterator.next(); if (step.done) { return step; } var entry = step.value; // Check if entry exists first so array access doesn't throw for holes // in the parent iteration. if (entry) { validateEntry(entry); var indexedIterable = isIterable(entry); return iteratorValue( type, indexedIterable ? entry.get(0) : entry[0], indexedIterable ? entry.get(1) : entry[1], step ); } } }); }; ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough; function flipFactory(iterable) { var flipSequence = makeSequence(iterable); flipSequence._iter = iterable; flipSequence.size = iterable.size; flipSequence.flip = function() {return iterable}; flipSequence.reverse = function () { var reversedSequence = iterable.reverse.apply(this); // super.reverse() reversedSequence.flip = function() {return iterable.reverse()}; return reversedSequence; }; flipSequence.has = function(key ) {return iterable.includes(key)}; flipSequence.includes = function(key ) {return iterable.has(key)}; flipSequence.cacheResult = cacheResultThrough; flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); } flipSequence.__iteratorUncached = function(type, reverse) { if (type === ITERATE_ENTRIES) { var iterator = iterable.__iterator(type, reverse); return new Iterator(function() { var step = iterator.next(); if (!step.done) { var k = step.value[0]; step.value[0] = step.value[1]; step.value[1] = k; } return step; }); } return iterable.__iterator( type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse ); } return flipSequence; } function mapFactory(iterable, mapper, context) { var mappedSequence = makeSequence(iterable); mappedSequence.size = iterable.size; mappedSequence.has = function(key ) {return iterable.has(key)}; mappedSequence.get = function(key, notSetValue) { var v = iterable.get(key, NOT_SET); return v === NOT_SET ? notSetValue : mapper.call(context, v, key, iterable); }; mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; return iterable.__iterate( function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, reverse ); } mappedSequence.__iteratorUncached = function (type, reverse) { var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); return new Iterator(function() { var step = iterator.next(); if (step.done) { return step; } var entry = step.value; var key = entry[0]; return iteratorValue( type, key, mapper.call(context, entry[1], key, iterable), step ); }); } return mappedSequence; } function reverseFactory(iterable, useKeys) { var reversedSequence = makeSequence(iterable); reversedSequence._iter = iterable; reversedSequence.size = iterable.size; reversedSequence.reverse = function() {return iterable}; if (iterable.flip) { reversedSequence.flip = function () { var flipSequence = flipFactory(iterable); flipSequence.reverse = function() {return iterable.flip()}; return flipSequence; }; } reversedSequence.get = function(key, notSetValue) {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; reversedSequence.has = function(key ) {return iterable.has(useKeys ? key : -1 - key)}; reversedSequence.includes = function(value ) {return iterable.includes(value)}; reversedSequence.cacheResult = cacheResultThrough; reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); }; reversedSequence.__iterator = function(type, reverse) {return iterable.__iterator(type, !reverse)}; return reversedSequence; } function filterFactory(iterable, predicate, context, useKeys) { var filterSequence = makeSequence(iterable); if (useKeys) { filterSequence.has = function(key ) { var v = iterable.get(key, NOT_SET); return v !== NOT_SET && !!predicate.call(context, v, key, iterable); }; filterSequence.get = function(key, notSetValue) { var v = iterable.get(key, NOT_SET); return v !== NOT_SET && predicate.call(context, v, key, iterable) ? v : notSetValue; }; } filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; var iterations = 0; iterable.__iterate(function(v, k, c) { if (predicate.call(context, v, k, c)) { iterations++; return fn(v, useKeys ? k : iterations - 1, this$0); } }, reverse); return iterations; }; filterSequence.__iteratorUncached = function (type, reverse) { var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); var iterations = 0; return new Iterator(function() { while (true) { var step = iterator.next(); if (step.done) { return step; } var entry = step.value; var key = entry[0]; var value = entry[1]; if (predicate.call(context, value, key, iterable)) { return iteratorValue(type, useKeys ? key : iterations++, value, step); } } }); } return filterSequence; } function countByFactory(iterable, grouper, context) { var groups = Map().asMutable(); iterable.__iterate(function(v, k) { groups.update( grouper.call(context, v, k, iterable), 0, function(a ) {return a + 1} ); }); return groups.asImmutable(); } function groupByFactory(iterable, grouper, context) { var isKeyedIter = isKeyed(iterable); var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); iterable.__iterate(function(v, k) { groups.update( grouper.call(context, v, k, iterable), function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} ); }); var coerce = iterableClass(iterable); return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); } function sliceFactory(iterable, begin, end, useKeys) { var originalSize = iterable.size; // Sanitize begin & end using this shorthand for ToInt32(argument) // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 if (begin !== undefined) { begin = begin | 0; } if (end !== undefined) { if (end === Infinity) { end = originalSize; } else { end = end | 0; } } if (wholeSlice(begin, end, originalSize)) { return iterable; } var resolvedBegin = resolveBegin(begin, originalSize); var resolvedEnd = resolveEnd(end, originalSize); // begin or end will be NaN if they were provided as negative numbers and // this iterable's size is unknown. In that case, cache first so there is // a known size and these do not resolve to NaN. if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); } // Note: resolvedEnd is undefined when the original sequence's length is // unknown and this slice did not supply an end and should contain all // elements after resolvedBegin. // In that case, resolvedSize will be NaN and sliceSize will remain undefined. var resolvedSize = resolvedEnd - resolvedBegin; var sliceSize; if (resolvedSize === resolvedSize) { sliceSize = resolvedSize < 0 ? 0 : resolvedSize; } var sliceSeq = makeSequence(iterable); // If iterable.size is undefined, the size of the realized sliceSeq is // unknown at this point unless the number of items to slice is 0 sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; if (!useKeys && isSeq(iterable) && sliceSize >= 0) { sliceSeq.get = function (index, notSetValue) { index = wrapIndex(this, index); return index >= 0 && index < sliceSize ? iterable.get(index + resolvedBegin, notSetValue) : notSetValue; } } sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; if (sliceSize === 0) { return 0; } if (reverse) { return this.cacheResult().__iterate(fn, reverse); } var skipped = 0; var isSkipping = true; var iterations = 0; iterable.__iterate(function(v, k) { if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { iterations++; return fn(v, useKeys ? k : iterations - 1, this$0) !== false && iterations !== sliceSize; } }); return iterations; }; sliceSeq.__iteratorUncached = function(type, reverse) { if (sliceSize !== 0 && reverse) { return this.cacheResult().__iterator(type, reverse); } // Don't bother instantiating parent iterator if taking 0. var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); var skipped = 0; var iterations = 0; return new Iterator(function() { while (skipped++ < resolvedBegin) { iterator.next(); } if (++iterations > sliceSize) { return iteratorDone(); } var step = iterator.next(); if (useKeys || type === ITERATE_VALUES) { return step; } else if (type === ITERATE_KEYS) { return iteratorValue(type, iterations - 1, undefined, step); } else { return iteratorValue(type, iterations - 1, step.value[1], step); } }); } return sliceSeq; } function takeWhileFactory(iterable, predicate, context) { var takeSequence = makeSequence(iterable); takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; if (reverse) { return this.cacheResult().__iterate(fn, reverse); } var iterations = 0; iterable.__iterate(function(v, k, c) {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} ); return iterations; }; takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; if (reverse) { return this.cacheResult().__iterator(type, reverse); } var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); var iterating = true; return new Iterator(function() { if (!iterating) { return iteratorDone(); } var step = iterator.next(); if (step.done) { return step; } var entry = step.value; var k = entry[0]; var v = entry[1]; if (!predicate.call(context, v, k, this$0)) { iterating = false; return iteratorDone(); } return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step); }); }; return takeSequence; } function skipWhileFactory(iterable, predicate, context, useKeys) { var skipSequence = makeSequence(iterable); skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; if (reverse) { return this.cacheResult().__iterate(fn, reverse); } var isSkipping = true; var iterations = 0; iterable.__iterate(function(v, k, c) { if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { iterations++; return fn(v, useKeys ? k : iterations - 1, this$0); } }); return iterations; }; skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; if (reverse) { return this.cacheResult().__iterator(type, reverse); } var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); var skipping = true; var iterations = 0; return new Iterator(function() { var step, k, v; do { step = iterator.next(); if (step.done) { if (useKeys || type === ITERATE_VALUES) { return step; } else if (type === ITERATE_KEYS) { return iteratorValue(type, iterations++, undefined, step); } else { return iteratorValue(type, iterations++, step.value[1], step); } } var entry = step.value; k = entry[0]; v = entry[1]; skipping && (skipping = predicate.call(context, v, k, this$0)); } while (skipping); return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step); }); }; return skipSequence; } function concatFactory(iterable, values) { var isKeyedIterable = isKeyed(iterable); var iters = [iterable].concat(values).map(function(v ) { if (!isIterable(v)) { v = isKeyedIterable ? keyedSeqFromValue(v) : indexedSeqFromValue(Array.isArray(v) ? v : [v]); } else if (isKeyedIterable) { v = KeyedIterable(v); } return v; }).filter(function(v ) {return v.size !== 0}); if (iters.length === 0) { return iterable; } if (iters.length === 1) { var singleton = iters[0]; if (singleton === iterable || isKeyedIterable && isKeyed(singleton) || isIndexed(iterable) && isIndexed(singleton)) { return singleton; } } var concatSeq = new ArraySeq(iters); if (isKeyedIterable) { concatSeq = concatSeq.toKeyedSeq(); } else if (!isIndexed(iterable)) { concatSeq = concatSeq.toSetSeq(); } concatSeq = concatSeq.flatten(true); concatSeq.size = iters.reduce( function(sum, seq) { if (sum !== undefined) { var size = seq.size; if (size !== undefined) { return sum + size; } } }, 0 ); return concatSeq; } function flattenFactory(iterable, depth, useKeys) { var flatSequence = makeSequence(iterable); flatSequence.__iterateUncached = function(fn, reverse) { var iterations = 0; var stopped = false; function flatDeep(iter, currentDepth) {var this$0 = this; iter.__iterate(function(v, k) { if ((!depth || currentDepth < depth) && isIterable(v)) { flatDeep(v, currentDepth + 1); } else if (fn(v, useKeys ? k : iterations++, this$0) === false) { stopped = true; } return !stopped; }, reverse); } flatDeep(iterable, 0); return iterations; } flatSequence.__iteratorUncached = function(type, reverse) { var iterator = iterable.__iterator(type, reverse); var stack = []; var iterations = 0; return new Iterator(function() { while (iterator) { var step = iterator.next(); if (step.done !== false) { iterator = stack.pop(); continue; } var v = step.value; if (type === ITERATE_ENTRIES) { v = v[1]; } if ((!depth || stack.length < depth) && isIterable(v)) { stack.push(iterator); iterator = v.__iterator(type, reverse); } else { return useKeys ? step : iteratorValue(type, iterations++, v, step); } } return iteratorDone(); }); } return flatSequence; } function flatMapFactory(iterable, mapper, context) { var coerce = iterableClass(iterable); return iterable.toSeq().map( function(v, k) {return coerce(mapper.call(context, v, k, iterable))} ).flatten(true); } function interposeFactory(iterable, separator) { var interposedSequence = makeSequence(iterable); interposedSequence.size = iterable.size && iterable.size * 2 -1; interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; var iterations = 0; iterable.__iterate(function(v, k) {return (!iterations || fn(separator, iterations++, this$0) !== false) && fn(v, iterations++, this$0) !== false}, reverse ); return iterations; }; interposedSequence.__iteratorUncached = function(type, reverse) { var iterator = iterable.__iterator(ITERATE_VALUES, reverse); var iterations = 0; var step; return new Iterator(function() { if (!step || iterations % 2) { step = iterator.next(); if (step.done) { return step; } } return iterations % 2 ? iteratorValue(type, iterations++, separator) : iteratorValue(type, iterations++, step.value, step); }); }; return interposedSequence; } function sortFactory(iterable, comparator, mapper) { if (!comparator) { comparator = defaultComparator; } var isKeyedIterable = isKeyed(iterable); var index = 0; var entries = iterable.toSeq().map( function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} ).toArray(); entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( isKeyedIterable ? function(v, i) { entries[i].length = 2; } : function(v, i) { entries[i] = v[1]; } ); return isKeyedIterable ? KeyedSeq(entries) : isIndexed(iterable) ? IndexedSeq(entries) : SetSeq(entries); } function maxFactory(iterable, comparator, mapper) { if (!comparator) { comparator = defaultComparator; } if (mapper) { var entry = iterable.toSeq() .map(function(v, k) {return [v, mapper(v, k, iterable)]}) .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); return entry && entry[0]; } else { return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); } } function maxCompare(comparator, a, b) { var comp = comparator(b, a); // b is considered the new max if the comparator declares them equal, but // they are not equal and b is in fact a nullish value. return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; } function zipWithFactory(keyIter, zipper, iters) { var zipSequence = makeSequence(keyIter); zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); // Note: this a generic base implementation of __iterate in terms of // __iterator which may be more generically useful in the future. zipSequence.__iterate = function(fn, reverse) { /* generic: var iterator = this.__iterator(ITERATE_ENTRIES, reverse); var step; var iterations = 0; while (!(step = iterator.next()).done) { iterations++; if (fn(step.value[1], step.value[0], this) === false) { break; } } return iterations; */ // indexed: var iterator = this.__iterator(ITERATE_VALUES, reverse); var step; var iterations = 0; while (!(step = iterator.next()).done) { if (fn(step.value, iterations++, this) === false) { break; } } return iterations; }; zipSequence.__iteratorUncached = function(type, reverse) { var iterators = iters.map(function(i ) {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} ); var iterations = 0; var isDone = false; return new Iterator(function() { var steps; if (!isDone) { steps = iterators.map(function(i ) {return i.next()}); isDone = steps.some(function(s ) {return s.done}); } if (isDone) { return iteratorDone(); } return iteratorValue( type, iterations++, zipper.apply(null, steps.map(function(s ) {return s.value})) ); }); }; return zipSequence } // #pragma Helper Functions function reify(iter, seq) { return isSeq(iter) ? seq : iter.constructor(seq); } function validateEntry(entry) { if (entry !== Object(entry)) { throw new TypeError('Expected [K, V] tuple: ' + entry); } } function resolveSize(iter) { assertNotInfinite(iter.size); return ensureSize(iter); } function iterableClass(iterable) { return isKeyed(iterable) ? KeyedIterable : isIndexed(iterable) ? IndexedIterable : SetIterable; } function makeSequence(iterable) { return Object.create( ( isKeyed(iterable) ? KeyedSeq : isIndexed(iterable) ? IndexedSeq : SetSeq ).prototype ); } function cacheResultThrough() { if (this._iter.cacheResult) { this._iter.cacheResult(); this.size = this._iter.size; return this; } else { return Seq.prototype.cacheResult.call(this); } } function defaultComparator(a, b) { return a > b ? 1 : a < b ? -1 : 0; } function forceIterator(keyPath) { var iter = getIterator(keyPath); if (!iter) { // Array might not be iterable in this environment, so we need a fallback // to our wrapped type. if (!isArrayLike(keyPath)) { throw new TypeError('Expected iterable or array-like: ' + keyPath); } iter = getIterator(Iterable(keyPath)); } return iter; } createClass(Record, KeyedCollection); function Record(defaultValues, name) { var hasInitialized; var RecordType = function Record(values) { if (values instanceof RecordType) { return values; } if (!(this instanceof RecordType)) { return new RecordType(values); } if (!hasInitialized) { hasInitialized = true; var keys = Object.keys(defaultValues); setProps(RecordTypePrototype, keys); RecordTypePrototype.size = keys.length; RecordTypePrototype._name = name; RecordTypePrototype._keys = keys; RecordTypePrototype._defaultValues = defaultValues; } this._map = Map(values); }; var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); RecordTypePrototype.constructor = RecordType; return RecordType; } Record.prototype.toString = function() { return this.__toString(recordName(this) + ' {', '}'); }; // @pragma Access Record.prototype.has = function(k) { return this._defaultValues.hasOwnProperty(k); }; Record.prototype.get = function(k, notSetValue) { if (!this.has(k)) { return notSetValue; } var defaultVal = this._defaultValues[k]; return this._map ? this._map.get(k, defaultVal) : defaultVal; }; // @pragma Modification Record.prototype.clear = function() { if (this.__ownerID) { this._map && this._map.clear(); return this; } var RecordType = this.constructor; return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); }; Record.prototype.set = function(k, v) { if (!this.has(k)) { throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this)); } if (this._map && !this._map.has(k)) { var defaultVal = this._defaultValues[k]; if (v === defaultVal) { return this; } } var newMap = this._map && this._map.set(k, v); if (this.__ownerID || newMap === this._map) { return this; } return makeRecord(this, newMap); }; Record.prototype.remove = function(k) { if (!this.has(k)) { return this; } var newMap = this._map && this._map.remove(k); if (this.__ownerID || newMap === this._map) { return this; } return makeRecord(this, newMap); }; Record.prototype.wasAltered = function() { return this._map.wasAltered(); }; Record.prototype.__iterator = function(type, reverse) {var this$0 = this; return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); }; Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); }; Record.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } var newMap = this._map && this._map.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; this._map = newMap; return this; } return makeRecord(this, newMap, ownerID); }; var RecordPrototype = Record.prototype; RecordPrototype[DELETE] = RecordPrototype.remove; RecordPrototype.deleteIn = RecordPrototype.removeIn = MapPrototype.removeIn; RecordPrototype.merge = MapPrototype.merge; RecordPrototype.mergeWith = MapPrototype.mergeWith; RecordPrototype.mergeIn = MapPrototype.mergeIn; RecordPrototype.mergeDeep = MapPrototype.mergeDeep; RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; RecordPrototype.setIn = MapPrototype.setIn; RecordPrototype.update = MapPrototype.update; RecordPrototype.updateIn = MapPrototype.updateIn; RecordPrototype.withMutations = MapPrototype.withMutations; RecordPrototype.asMutable = MapPrototype.asMutable; RecordPrototype.asImmutable = MapPrototype.asImmutable; function makeRecord(likeRecord, map, ownerID) { var record = Object.create(Object.getPrototypeOf(likeRecord)); record._map = map; record.__ownerID = ownerID; return record; } function recordName(record) { return record._name || record.constructor.name || 'Record'; } function setProps(prototype, names) { try { names.forEach(setProp.bind(undefined, prototype)); } catch (error) { // Object.defineProperty failed. Probably IE8. } } function setProp(prototype, name) { Object.defineProperty(prototype, name, { get: function() { return this.get(name); }, set: function(value) { invariant(this.__ownerID, 'Cannot set on an immutable record.'); this.set(name, value); } }); } createClass(Set, SetCollection); // @pragma Construction function Set(value) { return value === null || value === undefined ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations(function(set ) { var iter = SetIterable(value); assertNotInfinite(iter.size); iter.forEach(function(v ) {return set.add(v)}); }); } Set.of = function(/*...values*/) { return this(arguments); }; Set.fromKeys = function(value) { return this(KeyedIterable(value).keySeq()); }; Set.prototype.toString = function() { return this.__toString('Set {', '}'); }; // @pragma Access Set.prototype.has = function(value) { return this._map.has(value); }; // @pragma Modification Set.prototype.add = function(value) { return updateSet(this, this._map.set(value, true)); }; Set.prototype.remove = function(value) { return updateSet(this, this._map.remove(value)); }; Set.prototype.clear = function() { return updateSet(this, this._map.clear()); }; // @pragma Composition Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); iters = iters.filter(function(x ) {return x.size !== 0}); if (iters.length === 0) { return this; } if (this.size === 0 && !this.__ownerID && iters.length === 1) { return this.constructor(iters[0]); } return this.withMutations(function(set ) { for (var ii = 0; ii < iters.length; ii++) { SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)}); } }); }; Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); if (iters.length === 0) { return this; } iters = iters.map(function(iter ) {return SetIterable(iter)}); var originalSet = this; return this.withMutations(function(set ) { originalSet.forEach(function(value ) { if (!iters.every(function(iter ) {return iter.includes(value)})) { set.remove(value); } }); }); }; Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); if (iters.length === 0) { return this; } iters = iters.map(function(iter ) {return SetIterable(iter)}); var originalSet = this; return this.withMutations(function(set ) { originalSet.forEach(function(value ) { if (iters.some(function(iter ) {return iter.includes(value)})) { set.remove(value); } }); }); }; Set.prototype.merge = function() { return this.union.apply(this, arguments); }; Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return this.union.apply(this, iters); }; Set.prototype.sort = function(comparator) { // Late binding return OrderedSet(sortFactory(this, comparator)); }; Set.prototype.sortBy = function(mapper, comparator) { // Late binding return OrderedSet(sortFactory(this, comparator, mapper)); }; Set.prototype.wasAltered = function() { return this._map.wasAltered(); }; Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); }; Set.prototype.__iterator = function(type, reverse) { return this._map.map(function(_, k) {return k}).__iterator(type, reverse); }; Set.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } var newMap = this._map.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; this._map = newMap; return this; } return this.__make(newMap, ownerID); }; function isSet(maybeSet) { return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); } Set.isSet = isSet; var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; var SetPrototype = Set.prototype; SetPrototype[IS_SET_SENTINEL] = true; SetPrototype[DELETE] = SetPrototype.remove; SetPrototype.mergeDeep = SetPrototype.merge; SetPrototype.mergeDeepWith = SetPrototype.mergeWith; SetPrototype.withMutations = MapPrototype.withMutations; SetPrototype.asMutable = MapPrototype.asMutable; SetPrototype.asImmutable = MapPrototype.asImmutable; SetPrototype.__empty = emptySet; SetPrototype.__make = makeSet; function updateSet(set, newMap) { if (set.__ownerID) { set.size = newMap.size; set._map = newMap; return set; } return newMap === set._map ? set : newMap.size === 0 ? set.__empty() : set.__make(newMap); } function makeSet(map, ownerID) { var set = Object.create(SetPrototype); set.size = map ? map.size : 0; set._map = map; set.__ownerID = ownerID; return set; } var EMPTY_SET; function emptySet() { return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); } createClass(OrderedSet, Set); // @pragma Construction function OrderedSet(value) { return value === null || value === undefined ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations(function(set ) { var iter = SetIterable(value); assertNotInfinite(iter.size); iter.forEach(function(v ) {return set.add(v)}); }); } OrderedSet.of = function(/*...values*/) { return this(arguments); }; OrderedSet.fromKeys = function(value) { return this(KeyedIterable(value).keySeq()); }; OrderedSet.prototype.toString = function() { return this.__toString('OrderedSet {', '}'); }; function isOrderedSet(maybeOrderedSet) { return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); } OrderedSet.isOrderedSet = isOrderedSet; var OrderedSetPrototype = OrderedSet.prototype; OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; OrderedSetPrototype.__empty = emptyOrderedSet; OrderedSetPrototype.__make = makeOrderedSet; function makeOrderedSet(map, ownerID) { var set = Object.create(OrderedSetPrototype); set.size = map ? map.size : 0; set._map = map; set.__ownerID = ownerID; return set; } var EMPTY_ORDERED_SET; function emptyOrderedSet() { return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); } createClass(Stack, IndexedCollection); // @pragma Construction function Stack(value) { return value === null || value === undefined ? emptyStack() : isStack(value) ? value : emptyStack().unshiftAll(value); } Stack.of = function(/*...values*/) { return this(arguments); }; Stack.prototype.toString = function() { return this.__toString('Stack [', ']'); }; // @pragma Access Stack.prototype.get = function(index, notSetValue) { var head = this._head; index = wrapIndex(this, index); while (head && index--) { head = head.next; } return head ? head.value : notSetValue; }; Stack.prototype.peek = function() { return this._head && this._head.value; }; // @pragma Modification Stack.prototype.push = function(/*...values*/) { if (arguments.length === 0) { return this; } var newSize = this.size + arguments.length; var head = this._head; for (var ii = arguments.length - 1; ii >= 0; ii--) { head = { value: arguments[ii], next: head }; } if (this.__ownerID) { this.size = newSize; this._head = head; this.__hash = undefined; this.__altered = true; return this; } return makeStack(newSize, head); }; Stack.prototype.pushAll = function(iter) { iter = IndexedIterable(iter); if (iter.size === 0) { return this; } assertNotInfinite(iter.size); var newSize = this.size; var head = this._head; iter.reverse().forEach(function(value ) { newSize++; head = { value: value, next: head }; }); if (this.__ownerID) { this.size = newSize; this._head = head; this.__hash = undefined; this.__altered = true; return this; } return makeStack(newSize, head); }; Stack.prototype.pop = function() { return this.slice(1); }; Stack.prototype.unshift = function(/*...values*/) { return this.push.apply(this, arguments); }; Stack.prototype.unshiftAll = function(iter) { return this.pushAll(iter); }; Stack.prototype.shift = function() { return this.pop.apply(this, arguments); }; Stack.prototype.clear = function() { if (this.size === 0) { return this; } if (this.__ownerID) { this.size = 0; this._head = undefined; this.__hash = undefined; this.__altered = true; return this; } return emptyStack(); }; Stack.prototype.slice = function(begin, end) { if (wholeSlice(begin, end, this.size)) { return this; } var resolvedBegin = resolveBegin(begin, this.size); var resolvedEnd = resolveEnd(end, this.size); if (resolvedEnd !== this.size) { // super.slice(begin, end); return IndexedCollection.prototype.slice.call(this, begin, end); } var newSize = this.size - resolvedBegin; var head = this._head; while (resolvedBegin--) { head = head.next; } if (this.__ownerID) { this.size = newSize; this._head = head; this.__hash = undefined; this.__altered = true; return this; } return makeStack(newSize, head); }; // @pragma Mutability Stack.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } if (!ownerID) { this.__ownerID = ownerID; this.__altered = false; return this; } return makeStack(this.size, this._head, ownerID, this.__hash); }; // @pragma Iteration Stack.prototype.__iterate = function(fn, reverse) { if (reverse) { return this.reverse().__iterate(fn); } var iterations = 0; var node = this._head; while (node) { if (fn(node.value, iterations++, this) === false) { break; } node = node.next; } return iterations; }; Stack.prototype.__iterator = function(type, reverse) { if (reverse) { return this.reverse().__iterator(type); } var iterations = 0; var node = this._head; return new Iterator(function() { if (node) { var value = node.value; node = node.next; return iteratorValue(type, iterations++, value); } return iteratorDone(); }); }; function isStack(maybeStack) { return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); } Stack.isStack = isStack; var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; var StackPrototype = Stack.prototype; StackPrototype[IS_STACK_SENTINEL] = true; StackPrototype.withMutations = MapPrototype.withMutations; StackPrototype.asMutable = MapPrototype.asMutable; StackPrototype.asImmutable = MapPrototype.asImmutable; StackPrototype.wasAltered = MapPrototype.wasAltered; function makeStack(size, head, ownerID, hash) { var map = Object.create(StackPrototype); map.size = size; map._head = head; map.__ownerID = ownerID; map.__hash = hash; map.__altered = false; return map; } var EMPTY_STACK; function emptyStack() { return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); } /** * Contributes additional methods to a constructor */ function mixin(ctor, methods) { var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; }; Object.keys(methods).forEach(keyCopier); Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier); return ctor; } Iterable.Iterator = Iterator; mixin(Iterable, { // ### Conversion to other types toArray: function() { assertNotInfinite(this.size); var array = new Array(this.size || 0); this.valueSeq().__iterate(function(v, i) { array[i] = v; }); return array; }, toIndexedSeq: function() { return new ToIndexedSequence(this); }, toJS: function() { return this.toSeq().map( function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value} ).__toJS(); }, toJSON: function() { return this.toSeq().map( function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value} ).__toJS(); }, toKeyedSeq: function() { return new ToKeyedSequence(this, true); }, toMap: function() { // Use Late Binding here to solve the circular dependency. return Map(this.toKeyedSeq()); }, toObject: function() { assertNotInfinite(this.size); var object = {}; this.__iterate(function(v, k) { object[k] = v; }); return object; }, toOrderedMap: function() { // Use Late Binding here to solve the circular dependency. return OrderedMap(this.toKeyedSeq()); }, toOrderedSet: function() { // Use Late Binding here to solve the circular dependency. return OrderedSet(isKeyed(this) ? this.valueSeq() : this); }, toSet: function() { // Use Late Binding here to solve the circular dependency. return Set(isKeyed(this) ? this.valueSeq() : this); }, toSetSeq: function() { return new ToSetSequence(this); }, toSeq: function() { return isIndexed(this) ? this.toIndexedSeq() : isKeyed(this) ? this.toKeyedSeq() : this.toSetSeq(); }, toStack: function() { // Use Late Binding here to solve the circular dependency. return Stack(isKeyed(this) ? this.valueSeq() : this); }, toList: function() { // Use Late Binding here to solve the circular dependency. return List(isKeyed(this) ? this.valueSeq() : this); }, // ### Common JavaScript methods and properties toString: function() { return '[Iterable]'; }, __toString: function(head, tail) { if (this.size === 0) { return head + tail; } return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail; }, // ### ES6 Collection methods (ES6 Array and Map) concat: function() {var values = SLICE$0.call(arguments, 0); return reify(this, concatFactory(this, values)); }, includes: function(searchValue) { return this.some(function(value ) {return is(value, searchValue)}); }, entries: function() { return this.__iterator(ITERATE_ENTRIES); }, every: function(predicate, context) { assertNotInfinite(this.size); var returnValue = true; this.__iterate(function(v, k, c) { if (!predicate.call(context, v, k, c)) { returnValue = false; return false; } }); return returnValue; }, filter: function(predicate, context) { return reify(this, filterFactory(this, predicate, context, true)); }, find: function(predicate, context, notSetValue) { var entry = this.findEntry(predicate, context); return entry ? entry[1] : notSetValue; }, forEach: function(sideEffect, context) { assertNotInfinite(this.size); return this.__iterate(context ? sideEffect.bind(context) : sideEffect); }, join: function(separator) { assertNotInfinite(this.size); separator = separator !== undefined ? '' + separator : ','; var joined = ''; var isFirst = true; this.__iterate(function(v ) { isFirst ? (isFirst = false) : (joined += separator); joined += v !== null && v !== undefined ? v.toString() : ''; }); return joined; }, keys: function() { return this.__iterator(ITERATE_KEYS); }, map: function(mapper, context) { return reify(this, mapFactory(this, mapper, context)); }, reduce: function(reducer, initialReduction, context) { assertNotInfinite(this.size); var reduction; var useFirst; if (arguments.length < 2) { useFirst = true; } else { reduction = initialReduction; } this.__iterate(function(v, k, c) { if (useFirst) { useFirst = false; reduction = v; } else { reduction = reducer.call(context, reduction, v, k, c); } }); return reduction; }, reduceRight: function(reducer, initialReduction, context) { var reversed = this.toKeyedSeq().reverse(); return reversed.reduce.apply(reversed, arguments); }, reverse: function() { return reify(this, reverseFactory(this, true)); }, slice: function(begin, end) { return reify(this, sliceFactory(this, begin, end, true)); }, some: function(predicate, context) { return !this.every(not(predicate), context); }, sort: function(comparator) { return reify(this, sortFactory(this, comparator)); }, values: function() { return this.__iterator(ITERATE_VALUES); }, // ### More sequential methods butLast: function() { return this.slice(0, -1); }, isEmpty: function() { return this.size !== undefined ? this.size === 0 : !this.some(function() {return true}); }, count: function(predicate, context) { return ensureSize( predicate ? this.toSeq().filter(predicate, context) : this ); }, countBy: function(grouper, context) { return countByFactory(this, grouper, context); }, equals: function(other) { return deepEqual(this, other); }, entrySeq: function() { var iterable = this; if (iterable._cache) { // We cache as an entries array, so we can just return the cache! return new ArraySeq(iterable._cache); } var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq(); entriesSequence.fromEntrySeq = function() {return iterable.toSeq()}; return entriesSequence; }, filterNot: function(predicate, context) { return this.filter(not(predicate), context); }, findEntry: function(predicate, context, notSetValue) { var found = notSetValue; this.__iterate(function(v, k, c) { if (predicate.call(context, v, k, c)) { found = [k, v]; return false; } }); return found; }, findKey: function(predicate, context) { var entry = this.findEntry(predicate, context); return entry && entry[0]; }, findLast: function(predicate, context, notSetValue) { return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); }, findLastEntry: function(predicate, context, notSetValue) { return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue); }, findLastKey: function(predicate, context) { return this.toKeyedSeq().reverse().findKey(predicate, context); }, first: function() { return this.find(returnTrue); }, flatMap: function(mapper, context) { return reify(this, flatMapFactory(this, mapper, context)); }, flatten: function(depth) { return reify(this, flattenFactory(this, depth, true)); }, fromEntrySeq: function() { return new FromEntriesSequence(this); }, get: function(searchKey, notSetValue) { return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue); }, getIn: function(searchKeyPath, notSetValue) { var nested = this; // Note: in an ES6 environment, we would prefer: // for (var key of searchKeyPath) { var iter = forceIterator(searchKeyPath); var step; while (!(step = iter.next()).done) { var key = step.value; nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET; if (nested === NOT_SET) { return notSetValue; } } return nested; }, groupBy: function(grouper, context) { return groupByFactory(this, grouper, context); }, has: function(searchKey) { return this.get(searchKey, NOT_SET) !== NOT_SET; }, hasIn: function(searchKeyPath) { return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET; }, isSubset: function(iter) { iter = typeof iter.includes === 'function' ? iter : Iterable(iter); return this.every(function(value ) {return iter.includes(value)}); }, isSuperset: function(iter) { iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter); return iter.isSubset(this); }, keyOf: function(searchValue) { return this.findKey(function(value ) {return is(value, searchValue)}); }, keySeq: function() { return this.toSeq().map(keyMapper).toIndexedSeq(); }, last: function() { return this.toSeq().reverse().first(); }, lastKeyOf: function(searchValue) { return this.toKeyedSeq().reverse().keyOf(searchValue); }, max: function(comparator) { return maxFactory(this, comparator); }, maxBy: function(mapper, comparator) { return maxFactory(this, comparator, mapper); }, min: function(comparator) { return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator); }, minBy: function(mapper, comparator) { return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper); }, rest: function() { return this.slice(1); }, skip: function(amount) { return this.slice(Math.max(0, amount)); }, skipLast: function(amount) { return reify(this, this.toSeq().reverse().skip(amount).reverse()); }, skipWhile: function(predicate, context) { return reify(this, skipWhileFactory(this, predicate, context, true)); }, skipUntil: function(predicate, context) { return this.skipWhile(not(predicate), context); }, sortBy: function(mapper, comparator) { return reify(this, sortFactory(this, comparator, mapper)); }, take: function(amount) { return this.slice(0, Math.max(0, amount)); }, takeLast: function(amount) { return reify(this, this.toSeq().reverse().take(amount).reverse()); }, takeWhile: function(predicate, context) { return reify(this, takeWhileFactory(this, predicate, context)); }, takeUntil: function(predicate, context) { return this.takeWhile(not(predicate), context); }, valueSeq: function() { return this.toIndexedSeq(); }, // ### Hashable Object hashCode: function() { return this.__hash || (this.__hash = hashIterable(this)); } // ### Internal // abstract __iterate(fn, reverse) // abstract __iterator(type, reverse) }); // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; var IterablePrototype = Iterable.prototype; IterablePrototype[IS_ITERABLE_SENTINEL] = true; IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values; IterablePrototype.__toJS = IterablePrototype.toArray; IterablePrototype.__toStringMapper = quoteString; IterablePrototype.inspect = IterablePrototype.toSource = function() { return this.toString(); }; IterablePrototype.chain = IterablePrototype.flatMap; IterablePrototype.contains = IterablePrototype.includes; mixin(KeyedIterable, { // ### More sequential methods flip: function() { return reify(this, flipFactory(this)); }, mapEntries: function(mapper, context) {var this$0 = this; var iterations = 0; return reify(this, this.toSeq().map( function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)} ).fromEntrySeq() ); }, mapKeys: function(mapper, context) {var this$0 = this; return reify(this, this.toSeq().flip().map( function(k, v) {return mapper.call(context, k, v, this$0)} ).flip() ); } }); var KeyedIterablePrototype = KeyedIterable.prototype; KeyedIterablePrototype[IS_KEYED_SENTINEL] = true; KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries; KeyedIterablePrototype.__toJS = IterablePrototype.toObject; KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)}; mixin(IndexedIterable, { // ### Conversion to other types toKeyedSeq: function() { return new ToKeyedSequence(this, false); }, // ### ES6 Collection methods (ES6 Array and Map) filter: function(predicate, context) { return reify(this, filterFactory(this, predicate, context, false)); }, findIndex: function(predicate, context) { var entry = this.findEntry(predicate, context); return entry ? entry[0] : -1; }, indexOf: function(searchValue) { var key = this.keyOf(searchValue); return key === undefined ? -1 : key; }, lastIndexOf: function(searchValue) { var key = this.lastKeyOf(searchValue); return key === undefined ? -1 : key; }, reverse: function() { return reify(this, reverseFactory(this, false)); }, slice: function(begin, end) { return reify(this, sliceFactory(this, begin, end, false)); }, splice: function(index, removeNum /*, ...values*/) { var numArgs = arguments.length; removeNum = Math.max(removeNum | 0, 0); if (numArgs === 0 || (numArgs === 2 && !removeNum)) { return this; } // If index is negative, it should resolve relative to the size of the // collection. However size may be expensive to compute if not cached, so // only call count() if the number is in fact negative. index = resolveBegin(index, index < 0 ? this.count() : this.size); var spliced = this.slice(0, index); return reify( this, numArgs === 1 ? spliced : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) ); }, // ### More collection methods findLastIndex: function(predicate, context) { var entry = this.findLastEntry(predicate, context); return entry ? entry[0] : -1; }, first: function() { return this.get(0); }, flatten: function(depth) { return reify(this, flattenFactory(this, depth, false)); }, get: function(index, notSetValue) { index = wrapIndex(this, index); return (index < 0 || (this.size === Infinity || (this.size !== undefined && index > this.size))) ? notSetValue : this.find(function(_, key) {return key === index}, undefined, notSetValue); }, has: function(index) { index = wrapIndex(this, index); return index >= 0 && (this.size !== undefined ? this.size === Infinity || index < this.size : this.indexOf(index) !== -1 ); }, interpose: function(separator) { return reify(this, interposeFactory(this, separator)); }, interleave: function(/*...iterables*/) { var iterables = [this].concat(arrCopy(arguments)); var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables); var interleaved = zipped.flatten(true); if (zipped.size) { interleaved.size = zipped.size * iterables.length; } return reify(this, interleaved); }, keySeq: function() { return Range(0, this.size); }, last: function() { return this.get(-1); }, skipWhile: function(predicate, context) { return reify(this, skipWhileFactory(this, predicate, context, false)); }, zip: function(/*, ...iterables */) { var iterables = [this].concat(arrCopy(arguments)); return reify(this, zipWithFactory(this, defaultZipper, iterables)); }, zipWith: function(zipper/*, ...iterables */) { var iterables = arrCopy(arguments); iterables[0] = this; return reify(this, zipWithFactory(this, zipper, iterables)); } }); IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true; IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true; mixin(SetIterable, { // ### ES6 Collection methods (ES6 Array and Map) get: function(value, notSetValue) { return this.has(value) ? value : notSetValue; }, includes: function(value) { return this.has(value); }, // ### More sequential methods keySeq: function() { return this.valueSeq(); } }); SetIterable.prototype.has = IterablePrototype.includes; SetIterable.prototype.contains = SetIterable.prototype.includes; // Mixin subclasses mixin(KeyedSeq, KeyedIterable.prototype); mixin(IndexedSeq, IndexedIterable.prototype); mixin(SetSeq, SetIterable.prototype); mixin(KeyedCollection, KeyedIterable.prototype); mixin(IndexedCollection, IndexedIterable.prototype); mixin(SetCollection, SetIterable.prototype); // #pragma Helper functions function keyMapper(v, k) { return k; } function entryMapper(v, k) { return [k, v]; } function not(predicate) { return function() { return !predicate.apply(this, arguments); } } function neg(predicate) { return function() { return -predicate.apply(this, arguments); } } function quoteString(value) { return typeof value === 'string' ? JSON.stringify(value) : String(value); } function defaultZipper() { return arrCopy(arguments); } function defaultNegComparator(a, b) { return a < b ? 1 : a > b ? -1 : 0; } function hashIterable(iterable) { if (iterable.size === Infinity) { return 0; } var ordered = isOrdered(iterable); var keyed = isKeyed(iterable); var h = ordered ? 1 : 0; var size = iterable.__iterate( keyed ? ordered ? function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } : function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } : ordered ? function(v ) { h = 31 * h + hash(v) | 0; } : function(v ) { h = h + hash(v) | 0; } ); return murmurHashOfSize(size, h); } function murmurHashOfSize(size, h) { h = imul(h, 0xCC9E2D51); h = imul(h << 15 | h >>> -15, 0x1B873593); h = imul(h << 13 | h >>> -13, 5); h = (h + 0xE6546B64 | 0) ^ size; h = imul(h ^ h >>> 16, 0x85EBCA6B); h = imul(h ^ h >>> 13, 0xC2B2AE35); h = smi(h ^ h >>> 16); return h; } function hashMerge(a, b) { return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int } var Immutable = { Iterable: Iterable, Seq: Seq, Collection: Collection, Map: Map, OrderedMap: OrderedMap, List: List, Stack: Stack, Set: Set, OrderedSet: OrderedSet, Record: Record, Range: Range, Repeat: Repeat, is: is, fromJS: fromJS }; return Immutable; })); /***/ }), /***/ 4350: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var React = __webpack_require__(6540); var React__default = _interopDefault(React); var UAParser = __webpack_require__(6204); var UA = new UAParser(); var browser = UA.getBrowser(); var cpu = UA.getCPU(); var device = UA.getDevice(); var engine = UA.getEngine(); var os = UA.getOS(); var ua = UA.getUA(); var setDefaults = function setDefaults(p) { var d = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'none'; return p ? p : d; }; var getNavigatorInstance = function getNavigatorInstance() { if (typeof window !== 'undefined') { if (window.navigator || navigator) { return window.navigator || navigator; } } return false; }; var isIOS13Check = function isIOS13Check(type) { var nav = getNavigatorInstance(); return nav && nav.platform && (nav.platform.indexOf(type) !== -1 || nav.platform === 'MacIntel' && nav.maxTouchPoints > 1 && !window.MSStream); }; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } var DEVICE_TYPES = { MOBILE: 'mobile', TABLET: 'tablet', SMART_TV: 'smarttv', CONSOLE: 'console', WEARABLE: 'wearable', BROWSER: undefined }; var BROWSER_TYPES = { CHROME: 'Chrome', FIREFOX: "Firefox", OPERA: "Opera", YANDEX: "Yandex", SAFARI: "Safari", INTERNET_EXPLORER: "Internet Explorer", EDGE: "Edge", CHROMIUM: "Chromium", IE: 'IE', MOBILE_SAFARI: "Mobile Safari", EDGE_CHROMIUM: "Edge Chromium", MIUI: "MIUI Browser" }; var OS_TYPES = { IOS: 'iOS', ANDROID: "Android", WINDOWS_PHONE: "Windows Phone", WINDOWS: 'Windows', MAC_OS: 'Mac OS' }; var initialData = { isMobile: false, isTablet: false, isBrowser: false, isSmartTV: false, isConsole: false, isWearable: false }; var checkType = function checkType(type) { switch (type) { case DEVICE_TYPES.MOBILE: return { isMobile: true }; case DEVICE_TYPES.TABLET: return { isTablet: true }; case DEVICE_TYPES.SMART_TV: return { isSmartTV: true }; case DEVICE_TYPES.CONSOLE: return { isConsole: true }; case DEVICE_TYPES.WEARABLE: return { isWearable: true }; case DEVICE_TYPES.BROWSER: return { isBrowser: true }; default: return initialData; } }; var broPayload = function broPayload(isBrowser, browser, engine, os, ua) { return { isBrowser: isBrowser, browserMajorVersion: setDefaults(browser.major), browserFullVersion: setDefaults(browser.version), browserName: setDefaults(browser.name), engineName: setDefaults(engine.name), engineVersion: setDefaults(engine.version), osName: setDefaults(os.name), osVersion: setDefaults(os.version), userAgent: setDefaults(ua) }; }; var mobilePayload = function mobilePayload(type, device, os, ua) { return _objectSpread2({}, type, { vendor: setDefaults(device.vendor), model: setDefaults(device.model), os: setDefaults(os.name), osVersion: setDefaults(os.version), ua: setDefaults(ua) }); }; var stvPayload = function stvPayload(isSmartTV, engine, os, ua) { return { isSmartTV: isSmartTV, engineName: setDefaults(engine.name), engineVersion: setDefaults(engine.version), osName: setDefaults(os.name), osVersion: setDefaults(os.version), userAgent: setDefaults(ua) }; }; var consolePayload = function consolePayload(isConsole, engine, os, ua) { return { isConsole: isConsole, engineName: setDefaults(engine.name), engineVersion: setDefaults(engine.version), osName: setDefaults(os.name), osVersion: setDefaults(os.version), userAgent: setDefaults(ua) }; }; var wearPayload = function wearPayload(isWearable, engine, os, ua) { return { isWearable: isWearable, engineName: setDefaults(engine.name), engineVersion: setDefaults(engine.version), osName: setDefaults(os.name), osVersion: setDefaults(os.version), userAgent: setDefaults(ua) }; }; var type = checkType(device.type); function deviceDetect() { var isBrowser = type.isBrowser, isMobile = type.isMobile, isTablet = type.isTablet, isSmartTV = type.isSmartTV, isConsole = type.isConsole, isWearable = type.isWearable; if (isBrowser) { return broPayload(isBrowser, browser, engine, os, ua); } if (isSmartTV) { return stvPayload(isSmartTV, engine, os, ua); } if (isConsole) { return consolePayload(isConsole, engine, os, ua); } if (isMobile) { return mobilePayload(type, device, os, ua); } if (isTablet) { return mobilePayload(type, device, os, ua); } if (isWearable) { return wearPayload(isWearable, engine, os, ua); } } var isMobileType = function isMobileType() { return device.type === DEVICE_TYPES.MOBILE; }; var isTabletType = function isTabletType() { return device.type === DEVICE_TYPES.TABLET; }; var isMobileAndTabletType = function isMobileAndTabletType() { switch (device.type) { case DEVICE_TYPES.MOBILE: case DEVICE_TYPES.TABLET: return true; default: return false; } }; var isEdgeChromiumType = function isEdgeChromiumType() { return typeof ua === 'string' && ua.indexOf('Edg/') !== -1; }; var isSmartTVType = function isSmartTVType() { return device.type === DEVICE_TYPES.SMART_TV; }; var isBrowserType = function isBrowserType() { return device.type === DEVICE_TYPES.BROWSER; }; var isWearableType = function isWearableType() { return device.type === DEVICE_TYPES.WEARABLE; }; var isConsoleType = function isConsoleType() { return device.type === DEVICE_TYPES.CONSOLE; }; var isAndroidType = function isAndroidType() { return os.name === OS_TYPES.ANDROID; }; var isWindowsType = function isWindowsType() { return os.name === OS_TYPES.WINDOWS; }; var isMacOsType = function isMacOsType() { return os.name === OS_TYPES.MAC_OS; }; var isWinPhoneType = function isWinPhoneType() { return os.name === OS_TYPES.WINDOWS_PHONE; }; var isIOSType = function isIOSType() { return os.name === OS_TYPES.IOS; }; var isChromeType = function isChromeType() { return browser.name === BROWSER_TYPES.CHROME; }; var isFirefoxType = function isFirefoxType() { return browser.name === BROWSER_TYPES.FIREFOX; }; var isChromiumType = function isChromiumType() { return browser.name === BROWSER_TYPES.CHROMIUM; }; var isEdgeType = function isEdgeType() { return browser.name === BROWSER_TYPES.EDGE; }; var isYandexType = function isYandexType() { return browser.name === BROWSER_TYPES.YANDEX; }; var isSafariType = function isSafariType() { return browser.name === BROWSER_TYPES.SAFARI || browser.name === BROWSER_TYPES.MOBILE_SAFARI; }; var isMobileSafariType = function isMobileSafariType() { return browser.name === BROWSER_TYPES.MOBILE_SAFARI; }; var isOperaType = function isOperaType() { return browser.name === BROWSER_TYPES.OPERA; }; var isIEType = function isIEType() { return browser.name === BROWSER_TYPES.INTERNET_EXPLORER || browser.name === BROWSER_TYPES.IE; }; var isMIUIType = function isMIUIType() { return browser.name === BROWSER_TYPES.MIUI; }; var isElectronType = function isElectronType() { var nav = getNavigatorInstance(); var ua = nav && nav.userAgent.toLowerCase(); return typeof ua === 'string' ? /electron/.test(ua) : false; }; var getIOS13 = function getIOS13() { var nav = getNavigatorInstance(); return nav && (/iPad|iPhone|iPod/.test(nav.platform) || nav.platform === 'MacIntel' && nav.maxTouchPoints > 1) && !window.MSStream; }; var getIPad13 = function getIPad13() { return isIOS13Check('iPad'); }; var getIphone13 = function getIphone13() { return isIOS13Check('iPhone'); }; var getIPod13 = function getIPod13() { return isIOS13Check('iPod'); }; var getBrowserFullVersion = function getBrowserFullVersion() { return setDefaults(browser.version); }; var getBrowserVersion = function getBrowserVersion() { return setDefaults(browser.major); }; var getOsVersion = function getOsVersion() { return setDefaults(os.version); }; var getOsName = function getOsName() { return setDefaults(os.name); }; var getBrowserName = function getBrowserName() { return setDefaults(browser.name); }; var getMobileVendor = function getMobileVendor() { return setDefaults(device.vendor); }; var getMobileModel = function getMobileModel() { return setDefaults(device.model); }; var getEngineName = function getEngineName() { return setDefaults(engine.name); }; var getEngineVersion = function getEngineVersion() { return setDefaults(engine.version); }; var getUseragent = function getUseragent() { return setDefaults(ua); }; var getDeviceType = function getDeviceType() { return setDefaults(device.type, 'browser'); }; var isSmartTV = isSmartTVType(); var isConsole = isConsoleType(); var isWearable = isWearableType(); var isMobileSafari = isMobileSafariType() || getIPad13(); var isChromium = isChromiumType(); var isMobile = isMobileAndTabletType() || getIPad13(); var isMobileOnly = isMobileType(); var isTablet = isTabletType() || getIPad13(); var isBrowser = isBrowserType(); var isAndroid = isAndroidType(); var isWinPhone = isWinPhoneType(); var isIOS = isIOSType() || getIPad13(); var isChrome = isChromeType(); var isFirefox = isFirefoxType(); var isSafari = isSafariType(); var isOpera = isOperaType(); var isIE = isIEType(); var osVersion = getOsVersion(); var osName = getOsName(); var fullBrowserVersion = getBrowserFullVersion(); var browserVersion = getBrowserVersion(); var browserName = getBrowserName(); var mobileVendor = getMobileVendor(); var mobileModel = getMobileModel(); var engineName = getEngineName(); var engineVersion = getEngineVersion(); var getUA = getUseragent(); var isEdge = isEdgeType() || isEdgeChromiumType(); var isYandex = isYandexType(); var deviceType = getDeviceType(); var isIOS13 = getIOS13(); var isIPad13 = getIPad13(); var isIPhone13 = getIphone13(); var isIPod13 = getIPod13(); var isElectron = isElectronType(); var isEdgeChromium = isEdgeChromiumType(); var isLegacyEdge = isEdgeType() && !isEdgeChromiumType(); var isWindows = isWindowsType(); var isMacOs = isMacOsType(); var isMIUI = isMIUIType(); var AndroidView = function AndroidView(_ref) { var renderWithFragment = _ref.renderWithFragment, children = _ref.children, viewClassName = _ref.viewClassName, style = _ref.style; return isAndroid ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var BrowserView = function BrowserView(_ref2) { var renderWithFragment = _ref2.renderWithFragment, children = _ref2.children, viewClassName = _ref2.viewClassName, style = _ref2.style; return isBrowser ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var IEView = function IEView(_ref3) { var renderWithFragment = _ref3.renderWithFragment, children = _ref3.children, viewClassName = _ref3.viewClassName, style = _ref3.style; return isIE ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var IOSView = function IOSView(_ref4) { var renderWithFragment = _ref4.renderWithFragment, children = _ref4.children, viewClassName = _ref4.viewClassName, style = _ref4.style; return isIOS ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var MobileView = function MobileView(_ref5) { var renderWithFragment = _ref5.renderWithFragment, children = _ref5.children, viewClassName = _ref5.viewClassName, style = _ref5.style; return isMobile ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var TabletView = function TabletView(_ref6) { var renderWithFragment = _ref6.renderWithFragment, children = _ref6.children, viewClassName = _ref6.viewClassName, style = _ref6.style; return isTablet ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var WinPhoneView = function WinPhoneView(_ref7) { var renderWithFragment = _ref7.renderWithFragment, children = _ref7.children, viewClassName = _ref7.viewClassName, style = _ref7.style; return isWinPhone ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var MobileOnlyView = function MobileOnlyView(_ref8) { var renderWithFragment = _ref8.renderWithFragment, children = _ref8.children, viewClassName = _ref8.viewClassName, style = _ref8.style; return isMobileOnly ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var SmartTVView = function SmartTVView(_ref9) { var renderWithFragment = _ref9.renderWithFragment, children = _ref9.children, viewClassName = _ref9.viewClassName, style = _ref9.style; return isSmartTV ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var ConsoleView = function ConsoleView(_ref10) { var renderWithFragment = _ref10.renderWithFragment, children = _ref10.children, viewClassName = _ref10.viewClassName, style = _ref10.style; return isConsole ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var WearableView = function WearableView(_ref11) { var renderWithFragment = _ref11.renderWithFragment, children = _ref11.children, viewClassName = _ref11.viewClassName, style = _ref11.style; return isWearable ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; var CustomView = function CustomView(_ref12) { var renderWithFragment = _ref12.renderWithFragment, children = _ref12.children, viewClassName = _ref12.viewClassName, style = _ref12.style, condition = _ref12.condition; return condition ? renderWithFragment ? React__default.createElement(React.Fragment, null, children) : React__default.createElement("div", { className: viewClassName, style: style }, children) : null; }; function withOrientationChange(WrappedComponent) { return ( /*#__PURE__*/ function (_React$Component) { _inherits(_class, _React$Component); function _class(props) { var _this; _classCallCheck(this, _class); _this = _possibleConstructorReturn(this, _getPrototypeOf(_class).call(this, props)); _this.isEventListenerAdded = false; _this.handleOrientationChange = _this.handleOrientationChange.bind(_assertThisInitialized(_this)); _this.onOrientationChange = _this.onOrientationChange.bind(_assertThisInitialized(_this)); _this.onPageLoad = _this.onPageLoad.bind(_assertThisInitialized(_this)); _this.state = { isLandscape: false, isPortrait: false }; return _this; } _createClass(_class, [{ key: "handleOrientationChange", value: function handleOrientationChange() { if (!this.isEventListenerAdded) { this.isEventListenerAdded = true; } var orientation = window.innerWidth > window.innerHeight ? 90 : 0; this.setState({ isPortrait: orientation === 0, isLandscape: orientation === 90 }); } }, { key: "onOrientationChange", value: function onOrientationChange() { this.handleOrientationChange(); } }, { key: "onPageLoad", value: function onPageLoad() { this.handleOrientationChange(); } }, { key: "componentDidMount", value: function componentDidMount() { if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined && isMobile) { if (!this.isEventListenerAdded) { this.handleOrientationChange(); window.addEventListener("load", this.onPageLoad, false); } else { window.removeEventListener("load", this.onPageLoad, false); } window.addEventListener("resize", this.onOrientationChange, false); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.removeEventListener("resize", this.onOrientationChange, false); } }, { key: "render", value: function render() { return React__default.createElement(WrappedComponent, _extends({}, this.props, { isLandscape: this.state.isLandscape, isPortrait: this.state.isPortrait })); } }]); return _class; }(React__default.Component) ); } __webpack_unused_export__ = AndroidView; __webpack_unused_export__ = BrowserView; __webpack_unused_export__ = ConsoleView; __webpack_unused_export__ = CustomView; __webpack_unused_export__ = IEView; __webpack_unused_export__ = IOSView; __webpack_unused_export__ = MobileOnlyView; __webpack_unused_export__ = MobileView; __webpack_unused_export__ = SmartTVView; __webpack_unused_export__ = TabletView; __webpack_unused_export__ = WearableView; __webpack_unused_export__ = WinPhoneView; __webpack_unused_export__ = browserName; __webpack_unused_export__ = browserVersion; __webpack_unused_export__ = deviceDetect; __webpack_unused_export__ = deviceType; __webpack_unused_export__ = engineName; __webpack_unused_export__ = engineVersion; __webpack_unused_export__ = fullBrowserVersion; __webpack_unused_export__ = getUA; exports.m0 = isAndroid; __webpack_unused_export__ = isBrowser; __webpack_unused_export__ = isChrome; __webpack_unused_export__ = isChromium; __webpack_unused_export__ = isConsole; __webpack_unused_export__ = isEdge; __webpack_unused_export__ = isEdgeChromium; __webpack_unused_export__ = isElectron; exports.gm = isFirefox; __webpack_unused_export__ = isIE; exports.un = isIOS; __webpack_unused_export__ = isIOS13; __webpack_unused_export__ = isIPad13; __webpack_unused_export__ = isIPhone13; __webpack_unused_export__ = isIPod13; __webpack_unused_export__ = isLegacyEdge; __webpack_unused_export__ = isMIUI; __webpack_unused_export__ = isMacOs; exports.Fr = isMobile; exports.XF = isMobileOnly; __webpack_unused_export__ = isMobileSafari; __webpack_unused_export__ = isOpera; exports.nr = isSafari; __webpack_unused_export__ = isSmartTV; exports.v1 = isTablet; __webpack_unused_export__ = isWearable; __webpack_unused_export__ = isWinPhone; __webpack_unused_export__ = isWindows; __webpack_unused_export__ = isYandex; __webpack_unused_export__ = mobileModel; __webpack_unused_export__ = mobileVendor; __webpack_unused_export__ = osName; __webpack_unused_export__ = osVersion; exports.LZ = withOrientationChange; /***/ }), /***/ 6302: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { !function(e,t){ true?module.exports=t(__webpack_require__(6540)):0}(this,(e=>(()=>{var t={703:(e,t,n)=>{"use strict";var i=n(414);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,a,o){if(o!==i){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return n.PropTypes=n,n}},697:(e,t,n)=>{e.exports=n(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},590:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,i="function"==typeof Set,r="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(e,o){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(e.constructor!==o.constructor)return!1;var s,l,u,c;if(Array.isArray(e)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(!a(e[l],o[l]))return!1;return!0}if(n&&e instanceof Map&&o instanceof Map){if(e.size!==o.size)return!1;for(c=e.entries();!(l=c.next()).done;)if(!o.has(l.value[0]))return!1;for(c=e.entries();!(l=c.next()).done;)if(!a(l.value[1],o.get(l.value[0])))return!1;return!0}if(i&&e instanceof Set&&o instanceof Set){if(e.size!==o.size)return!1;for(c=e.entries();!(l=c.next()).done;)if(!o.has(l.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(o)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(e[l]!==o[l])return!1;return!0}if(e.constructor===RegExp)return e.source===o.source&&e.flags===o.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===o.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===o.toString();if((s=(u=Object.keys(e)).length)!==Object.keys(o).length)return!1;for(l=s;0!=l--;)if(!Object.prototype.hasOwnProperty.call(o,u[l]))return!1;if(t&&e instanceof Element)return!1;for(l=s;0!=l--;)if(("_owner"!==u[l]&&"__v"!==u[l]&&"__o"!==u[l]||!e.$$typeof)&&!a(e[u[l]],o[u[l]]))return!1;return!0}return e!=e&&o!=o}e.exports=function(e,t){try{return a(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},359:t=>{"use strict";t.exports=e}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(t){var n,i,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t))for(n=0;nnt});var n=i(359),a=i.n(n);const o=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},s="object"==typeof __webpack_require__.g&&__webpack_require__.g&&__webpack_require__.g.Object===Object&&__webpack_require__.g;var l="object"==typeof self&&self&&self.Object===Object&&self;const u=s||l||Function("return this")(),c=function(){return u.Date.now()};var h=/\s/;var d=/^\s+/;const p=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&h.test(e.charAt(t)););return t}(e)+1).replace(d,""):e},f=u.Symbol;var m=Object.prototype,b=m.hasOwnProperty,g=m.toString,v=f?f.toStringTag:void 0;var y=Object.prototype.toString;var w=f?f.toStringTag:void 0;const S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?function(e){var t=b.call(e,v),n=e[v];try{e[v]=void 0;var i=!0}catch(e){}var r=g.call(e);return i&&(t?e[v]=n:delete e[v]),r}(e):function(e){return y.call(e)}(e)};var T=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,E=/^0o[0-7]+$/i,k=parseInt;const I=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==S(e)}(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=p(e);var n=O.test(e);return n||E.test(e)?k(e.slice(2),n?2:8):T.test(e)?NaN:+e};var j=Math.max,x=Math.min;const P=function(e,t,n){var i,r,a,s,l,u,h=0,d=!1,p=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=i,a=r;return i=r=void 0,h=t,s=e.apply(a,n)}function b(e){return h=e,l=setTimeout(v,t),d?m(e):s}function g(e){var n=e-u;return void 0===u||n>=t||n<0||p&&e-h>=a}function v(){var e=c();if(g(e))return y(e);l=setTimeout(v,function(e){var n=t-(e-u);return p?x(n,a-(e-h)):n}(e))}function y(e){return l=void 0,f&&i?m(e):(i=r=void 0,s)}function w(){var e=c(),n=g(e);if(i=arguments,r=this,u=e,n){if(void 0===l)return b(u);if(p)return clearTimeout(l),l=setTimeout(v,t),m(u)}return void 0===l&&(l=setTimeout(v,t)),s}return t=I(t)||0,o(n)&&(d=!!n.leading,a=(p="maxWait"in n)?j(I(n.maxWait)||0,t):a,f="trailing"in n?!!n.trailing:f),w.cancel=function(){void 0!==l&&clearTimeout(l),h=0,i=u=r=l=void 0},w.flush=function(){return void 0===l?s:y(c())},w},_=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),P(e,t,{leading:i,maxWait:t,trailing:r})};var R=i(590),M=i.n(R),L=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,i){return e[0]===t&&(n=i,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(t,n){var i=e(this.__entries__,t);~i?this.__entries__[i][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,i=e(n,t);~i&&n.splice(i,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,i=this.__entries__;n0},e.prototype.connect_=function(){D&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),z?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){D&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;F.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),B=function(e,t){for(var n=0,i=Object.keys(t);n0},e}(),J="undefined"!=typeof WeakMap?new WeakMap:new L,Q=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=N.getInstance(),i=new Y(t,n,this);J.set(this,i)};["observe","unobserve","disconnect"].forEach((function(e){Q.prototype[e]=function(){var t;return(t=J.get(this))[e].apply(t,arguments)}}));const Z=void 0!==W.ResizeObserver?W.ResizeObserver:Q,ee="Left",te="Right",ne="Up",ie="Down",re={delta:10,preventScrollOnSwipe:!1,rotationAngle:0,trackMouse:!1,trackTouch:!0,swipeDuration:1/0,touchEventOptions:{passive:!0}},ae={first:!0,initial:[0,0],start:0,swiping:!1,xy:[0,0]},oe="mousemove",se="mouseup";function le(e,t){if(0===t)return e;const n=Math.PI/180*t;return[e[0]*Math.cos(n)+e[1]*Math.sin(n),e[1]*Math.cos(n)-e[0]*Math.sin(n)]}function ue(e){const{trackMouse:t}=e,i=n.useRef(Object.assign({},ae)),r=n.useRef(Object.assign({},re)),a=n.useRef(Object.assign({},r.current));let o;for(o in a.current=Object.assign({},r.current),r.current=Object.assign(Object.assign({},re),e),re)void 0===r.current[o]&&(r.current[o]=re[o]);const[s,l]=n.useMemo((()=>function(e,t){const n=t=>{const n="touches"in t;n&&t.touches.length>1||e(((e,r)=>{r.trackMouse&&!n&&(document.addEventListener(oe,i),document.addEventListener(se,a));const{clientX:o,clientY:s}=n?t.touches[0]:t,l=le([o,s],r.rotationAngle);return r.onTouchStartOrOnMouseDown&&r.onTouchStartOrOnMouseDown({event:t}),Object.assign(Object.assign(Object.assign({},e),ae),{initial:l.slice(),xy:l,start:t.timeStamp||0})}))},i=t=>{e(((e,n)=>{const i="touches"in t;if(i&&t.touches.length>1)return e;if(t.timeStamp-e.start>n.swipeDuration)return e.swiping?Object.assign(Object.assign({},e),{swiping:!1}):e;const{clientX:r,clientY:a}=i?t.touches[0]:t,[o,s]=le([r,a],n.rotationAngle),l=o-e.xy[0],u=s-e.xy[1],c=Math.abs(l),h=Math.abs(u),d=(t.timeStamp||0)-e.start,p=Math.sqrt(c*c+h*h)/(d||1),f=[l/(d||1),u/(d||1)],m=function(e,t,n,i){return e>t?n>0?te:ee:i>0?ie:ne}(c,h,l,u),b="number"==typeof n.delta?n.delta:n.delta[m.toLowerCase()]||re.delta;if(c{e(((e,n)=>{let i;if(e.swiping&&e.eventData){if(t.timeStamp-e.start{document.removeEventListener(oe,i),document.removeEventListener(se,a),r(e)},o=(e,t)=>{let a=()=>{};if(e&&e.addEventListener){const o=Object.assign(Object.assign({},re.touchEventOptions),t.touchEventOptions),s=[["touchstart",n,o],["touchmove",i,Object.assign(Object.assign({},o),t.preventScrollOnSwipe?{passive:!1}:{})],["touchend",r,o]];s.forEach((([t,n,i])=>e.addEventListener(t,n,i))),a=()=>s.forEach((([t,n])=>e.removeEventListener(t,n)))}return a},s={ref:t=>{null!==t&&e(((e,n)=>{if(e.el===t)return e;const i={};return e.el&&e.el!==t&&e.cleanUpTouch&&(e.cleanUpTouch(),i.cleanUpTouch=void 0),n.trackTouch&&t&&(i.cleanUpTouch=o(t,n)),Object.assign(Object.assign(Object.assign({},e),{el:t}),i)}))}};return t.trackMouse&&(s.onMouseDown=n),[s,o]}((e=>i.current=e(i.current,r.current)),{trackMouse:t})),[t]);return i.current=function(e,t,n,i){return t.trackTouch&&e.el?e.cleanUpTouch?t.preventScrollOnSwipe!==n.preventScrollOnSwipe||t.touchEventOptions.passive!==n.touchEventOptions.passive?(e.cleanUpTouch(),Object.assign(Object.assign({},e),{cleanUpTouch:i(e.el,t)})):e:Object.assign(Object.assign({},e),{cleanUpTouch:i(e.el,t)}):(e.cleanUpTouch&&e.cleanUpTouch(),Object.assign(Object.assign({},e),{cleanUpTouch:void 0}))}(i.current,r.current,a.current,l),s}var ce=i(697);function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function de(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function pe(e){for(var t=1;t=3&&i&&(0===e&&t===r.length-1?a=" ".concat(s):e===r.length-1&&0===t&&(a=" ".concat(o))),a}},{key:"getTranslateXForTwoSlide",value:function(e){var t=this.state,n=t.currentIndex,i=t.currentSlideOffset,r=t.previousIndex,a=n!==r,o=0===e&&0===r,s=1===e&&1===r,l=0===e&&1===n,u=1===e&&0===n,c=0===i,h=-100*n+100*e+i;return i>0?this.direction="left":i<0&&(this.direction="right"),u&&i>0&&(h=-100+i),l&&i<0&&(h=100+i),a?o&&c&&"left"===this.direction?h=100:s&&c&&"right"===this.direction&&(h=-100):(u&&c&&"left"===this.direction&&(h=-100),l&&c&&"right"===this.direction&&(h=100)),h}},{key:"getThumbnailBarHeight",value:function(){return this.isThumbnailVertical()?{height:this.state.gallerySlideWrapperHeight}:{}}},{key:"getSlideStyle",value:function(e){var t=this.state,n=t.currentIndex,i=t.currentSlideOffset,r=t.slideStyle,a=this.props,o=a.infinite,s=a.items,l=a.useTranslate3D,u=a.isRTL,c=-100*n,h=s.length-1,d=(c+100*e)*(u?-1:1)+i;o&&s.length>2&&(0===n&&e===h?d=-100*(u?-1:1)+i:n===h&&0===e&&(d=100*(u?-1:1)+i)),o&&2===s.length&&(d=this.getTranslateXForTwoSlide(e));var p="translate(".concat(d,"%, 0)");return l&&(p="translate3d(".concat(d,"%, 0, 0)")),qe({display:this.isSlideVisible(e)?"inherit":"none",WebkitTransform:p,MozTransform:p,msTransform:p,OTransform:p,transform:p},r)}},{key:"getCurrentIndex",value:function(){return this.state.currentIndex}},{key:"getThumbnailStyle",value:function(){var e,t=this.props,n=t.useTranslate3D,i=t.isRTL,r=this.state,a=r.thumbsTranslate,o=r.thumbsStyle,s=i?-1*a:a;return this.isThumbnailVertical()?(e="translate(0, ".concat(a,"px)"),n&&(e="translate3d(0, ".concat(a,"px, 0)"))):(e="translate(".concat(s,"px, 0)"),n&&(e="translate3d(".concat(s,"px, 0, 0)"))),qe({WebkitTransform:e,MozTransform:e,msTransform:e,OTransform:e,transform:e},o)}},{key:"getSlideItems",value:function(){var e=this,n=this.state.currentIndex,i=this.props,r=i.items,o=i.slideOnThumbnailOver,s=i.onClick,l=i.lazyLoad,u=i.onTouchMove,c=i.onTouchEnd,h=i.onTouchStart,d=i.onMouseOver,p=i.onMouseLeave,f=i.renderItem,m=i.renderThumbInner,b=i.showThumbnails,g=i.showBullets,v=[],y=[],w=[];return r.forEach((function(i,r){var S=e.getAlignmentClassName(r),T=i.originalClass?" ".concat(i.originalClass):"",O=i.thumbnailClass?" ".concat(i.thumbnailClass):"",E=i.renderItem||f||e.renderItem,k=i.renderThumbInner||m||e.renderThumbInner,I=!l||S||e.lazyLoaded[r];I&&l&&!e.lazyLoaded[r]&&(e.lazyLoaded[r]=!0);var j=e.getSlideStyle(r),x=a().createElement("div",{"aria-label":"Go to Slide ".concat(r+1),key:"slide-".concat(r),tabIndex:"-1",className:"image-gallery-slide ".concat(S," ").concat(T),style:j,onClick:s,onKeyUp:e.handleSlideKeyUp,onTouchMove:u,onTouchEnd:c,onTouchStart:h,onMouseOver:d,onFocus:d,onMouseLeave:p,role:"button"},I?E(i):a().createElement("div",{style:{height:"100%"}}));if(v.push(x),b&&i.thumbnail){var P=t("image-gallery-thumbnail",O,{active:n===r});y.push(a().createElement("button",{key:"thumbnail-".concat(r),type:"button",tabIndex:"0","aria-pressed":n===r?"true":"false","aria-label":"Go to Slide ".concat(r+1),className:P,onMouseLeave:o?e.onThumbnailMouseLeave:null,onMouseOver:function(t){return e.handleThumbnailMouseOver(t,r)},onFocus:function(t){return e.handleThumbnailMouseOver(t,r)},onKeyUp:function(t){return e.handleThumbnailKeyUp(t,r)},onClick:function(t){return e.onThumbnailClick(t,r)}},k(i)))}if(g){var _=t("image-gallery-bullet",i.bulletClass,{active:n===r});w.push(a().createElement("button",{type:"button",key:"bullet-".concat(r),className:_,onClick:function(t){return e.onBulletClick(t,r)},"aria-pressed":n===r?"true":"false","aria-label":"Go to Slide ".concat(r+1)}))}})),{slides:v,thumbnails:y,bullets:w}}},{key:"ignoreIsTransitioning",value:function(){var e=this.props.items,t=this.state,n=t.previousIndex,i=t.currentIndex,r=e.length-1;return Math.abs(n-i)>1&&!(0===n&&i===r)&&!(n===r&&0===i)}},{key:"isFirstOrLastSlide",value:function(e){return e===this.props.items.length-1||0===e}},{key:"slideIsTransitioning",value:function(e){var t=this.state,n=t.isTransitioning,i=t.previousIndex,r=t.currentIndex;return n&&!(e===i||e===r)}},{key:"isSlideVisible",value:function(e){return!this.slideIsTransitioning(e)||this.ignoreIsTransitioning()&&!this.isFirstOrLastSlide(e)}},{key:"slideThumbnailBar",value:function(){var e=this.state,t=e.currentIndex,n=e.isSwipingThumbnail,i=-this.getThumbsTranslate(t);n||(0===t?this.setState({thumbsTranslate:0,thumbsSwipedTranslate:0}):this.setState({thumbsTranslate:i,thumbsSwipedTranslate:i}))}},{key:"canSlide",value:function(){return this.props.items.length>=2}},{key:"canSlideLeft",value:function(){return this.props.infinite||this.canSlidePrevious()}},{key:"canSlideRight",value:function(){return this.props.infinite||this.canSlideNext()}},{key:"canSlidePrevious",value:function(){return this.state.currentIndex>0}},{key:"canSlideNext",value:function(){return this.state.currentIndex=100&&(f=100);var m={transition:"transform ".concat(d,"ms ease-out")};this.setState({currentSlideOffset:p*f,slideStyle:m})}}}else c||this.setState({swipingUpDown:!0})}},{key:"handleThumbnailSwiping",value:function(e){var t=e.event,n=e.absX,i=e.absY,r=e.dir,a=this.props,o=a.stopPropagation,s=a.swipingThumbnailTransitionDuration,l=this.state,u=l.thumbsSwipedTranslate,c=l.thumbnailsWrapperHeight,h=l.thumbnailsWrapperWidth,d=l.swipingUpDown,p=l.swipingLeftRight;if(this.isThumbnailVertical()){if((r===ee||r===te||p)&&!d)return void(p||this.setState({swipingLeftRight:!0}));r!==ne&&r!==ie||d||this.setState({swipingUpDown:!0})}else{if((r===ne||r===ie||d)&&!p)return void(d||this.setState({swipingUpDown:!0}));r!==ee&&r!==te||p||this.setState({swipingLeftRight:!0})}var f,m,b,g,v,y=this.thumbnails&&this.thumbnails.current;if(this.isThumbnailVertical()?(f=u+(r===ie?i:-i),m=y.scrollHeight-c+20,b=Math.abs(f)>m,g=f>20,v=y.scrollHeight<=c):(f=u+(r===te?n:-n),m=y.scrollWidth-h+20,b=Math.abs(f)>m,g=f>20,v=y.scrollWidth<=h),!v&&(r!==ee&&r!==ne||!b)&&(r!==te&&r!==ie||!g)){o&&t.stopPropagation();var w={transition:"transform ".concat(s,"ms ease-out")};this.setState({thumbsTranslate:f,thumbsStyle:w})}}},{key:"handleOnThumbnailSwiped",value:function(){var e=this.state.thumbsTranslate,t=this.props.slideDuration;this.resetSwipingDirection(),this.setState({isSwipingThumbnail:!0,thumbsSwipedTranslate:e,thumbsStyle:{transition:"all ".concat(t,"ms ease-out")}})}},{key:"sufficientSwipe",value:function(){var e=this.state.currentSlideOffset,t=this.props.swipeThreshold;return Math.abs(e)>t}},{key:"resetSwipingDirection",value:function(){var e=this.state,t=e.swipingUpDown,n=e.swipingLeftRight;t&&this.setState({swipingUpDown:!1}),n&&this.setState({swipingLeftRight:!1})}},{key:"handleOnSwiped",value:function(e){var t=e.event,n=e.dir,i=e.velocity,r=this.props,a=r.disableSwipe,o=r.stopPropagation,s=r.flickThreshold;if(!a){var l=this.props.isRTL;o&&t.stopPropagation(),this.resetSwipingDirection();var u=(n===ee?1:-1)*(l?-1:1),c=i>s&&!(n===ne||n===ie);this.handleOnSwipedTo(u,c)}}},{key:"handleOnSwipedTo",value:function(e,t){var n=this.state,i=n.currentIndex,r=n.isTransitioning,a=i;!this.sufficientSwipe()&&!t||r||(a+=e),(-1===e&&!this.canSlideLeft()||1===e&&!this.canSlideRight())&&(a=i),this.unthrottledSlideToIndex(a)}},{key:"handleTouchMove",value:function(e){this.state.swipingLeftRight&&e.preventDefault()}},{key:"handleMouseDown",value:function(){this.imageGallery.current.classList.add("image-gallery-using-mouse")}},{key:"handleKeyDown",value:function(e){var t=this.props,n=t.disableKeyDown,i=t.useBrowserFullscreen,r=this.state.isFullscreen;if(this.imageGallery.current.classList.remove("image-gallery-using-mouse"),!n)switch(parseInt(e.keyCode||e.which||0,10)){case 37:this.canSlideLeft()&&!this.playPauseIntervalId&&this.slideLeft(e);break;case 39:this.canSlideRight()&&!this.playPauseIntervalId&&this.slideRight(e);break;case 27:r&&!i&&this.exitFullScreen()}}},{key:"handleImageError",value:function(e){var t=this.props.onErrorImageURL;t&&-1===e.target.src.indexOf(t)&&(e.target.src=t)}},{key:"removeThumbnailsResizeObserver",value:function(){this.resizeThumbnailWrapperObserver&&this.thumbnailsWrapper&&this.thumbnailsWrapper.current&&(this.resizeThumbnailWrapperObserver.unobserve(this.thumbnailsWrapper.current),this.resizeThumbnailWrapperObserver=null)}},{key:"removeResizeObserver",value:function(){this.resizeSlideWrapperObserver&&this.imageGallerySlideWrapper&&this.imageGallerySlideWrapper.current&&(this.resizeSlideWrapperObserver.unobserve(this.imageGallerySlideWrapper.current),this.resizeSlideWrapperObserver=null),this.removeThumbnailsResizeObserver()}},{key:"handleResize",value:function(){var e=this.state.currentIndex;this.imageGallery&&(this.imageGallery&&this.imageGallery.current&&this.setState({galleryWidth:this.imageGallery.current.offsetWidth}),this.imageGallerySlideWrapper&&this.imageGallerySlideWrapper.current&&this.setState({gallerySlideWrapperHeight:this.imageGallerySlideWrapper.current.offsetHeight}),this.setThumbsTranslate(-this.getThumbsTranslate(e)))}},{key:"initSlideWrapperResizeObserver",value:function(e){var t=this;e&&!e.current||(this.resizeSlideWrapperObserver=new Z(P((function(e){e&&e.forEach((function(e){t.setState({thumbnailsWrapperWidth:e.contentRect.width},t.handleResize)}))}),50)),this.resizeSlideWrapperObserver.observe(e.current))}},{key:"initThumbnailWrapperResizeObserver",value:function(e){var t=this;e&&!e.current||(this.resizeThumbnailWrapperObserver=new Z(P((function(e){e&&e.forEach((function(e){t.setState({thumbnailsWrapperHeight:e.contentRect.height},t.handleResize)}))}),50)),this.resizeThumbnailWrapperObserver.observe(e.current))}},{key:"toggleFullScreen",value:function(){this.state.isFullscreen?this.exitFullScreen():this.fullScreen()}},{key:"togglePlay",value:function(){this.playPauseIntervalId?this.pause():this.play()}},{key:"handleScreenChange",value:function(){var e=this.props,t=e.onScreenChange,n=e.useBrowserFullscreen,i=document.fullscreenElement||document.msFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement,r=this.imageGallery.current===i;t&&t(r),n&&this.setState({isFullscreen:r})}},{key:"slideToIndex",value:function(e,t){var n=this.state,i=n.currentIndex,r=n.isTransitioning,a=this.props,o=a.items,s=a.slideDuration,l=a.onBeforeSlide;if(!r){t&&this.playPauseIntervalId&&(this.pause(!1),this.play(!1));var u=o.length-1,c=e;e<0?c=u:e>u&&(c=0),l&&c!==i&&l(c),this.setState({previousIndex:i,currentIndex:c,isTransitioning:c!==i,currentSlideOffset:0,slideStyle:{transition:"all ".concat(s,"ms ease-out")}},this.onSliding)}}},{key:"slideLeft",value:function(e){var t=this.props.isRTL;this.slideTo(e,t?"right":"left")}},{key:"slideRight",value:function(e){var t=this.props.isRTL;this.slideTo(e,t?"left":"right")}},{key:"slideTo",value:function(e,t){var n=this.state,i=n.currentIndex,r=n.isTransitioning,a=this.props.items,o=i+("left"===t?-1:1);r||(2===a.length?this.slideToIndexWithStyleReset(o,e):this.slideToIndex(o,e))}},{key:"slideToIndexWithStyleReset",value:function(e,t){var n=this,i=this.state,r=i.currentIndex,a=i.currentSlideOffset;this.setState({currentSlideOffset:a+(r>e?.001:-.001),slideStyle:{transition:"none"}},(function(){window.setTimeout((function(){return n.slideToIndex(e,t)}),25)}))}},{key:"handleThumbnailMouseOver",value:function(e,t){this.props.slideOnThumbnailOver&&this.onThumbnailMouseOver(e,t)}},{key:"handleThumbnailKeyUp",value:function(e,t){et(e)&&this.onThumbnailClick(e,t)}},{key:"handleSlideKeyUp",value:function(e){et(e)&&(0,this.props.onClick)(e)}},{key:"isThumbnailVertical",value:function(){var e=this.props.thumbnailPosition;return"left"===e||"right"===e}},{key:"addScreenChangeEvent",value:function(){var e=this;Qe.forEach((function(t){document.addEventListener(t,e.handleScreenChange)}))}},{key:"removeScreenChangeEvent",value:function(){var e=this;Qe.forEach((function(t){document.removeEventListener(t,e.handleScreenChange)}))}},{key:"fullScreen",value:function(){var e=this.props.useBrowserFullscreen,t=this.imageGallery.current;e?t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():this.setModalFullscreen(!0):this.setModalFullscreen(!0),this.setState({isFullscreen:!0})}},{key:"exitFullScreen",value:function(){var e=this.state.isFullscreen,t=this.props.useBrowserFullscreen;e&&(t?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this.setModalFullscreen(!1):this.setModalFullscreen(!1),this.setState({isFullscreen:!1}))}},{key:"pauseOrPlay",value:function(){var e=this.props.infinite,t=this.state.currentIndex;e||this.canSlideRight()?this.slideToIndex(t+1):this.pause()}},{key:"play",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.props,n=t.onPlay,i=t.slideInterval,r=t.slideDuration,a=this.state.currentIndex;this.playPauseIntervalId||(this.setState({isPlaying:!0}),this.playPauseIntervalId=window.setInterval(this.pauseOrPlay,Math.max(i,r)),n&&e&&n(a))}},{key:"pause",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.props.onPause,n=this.state.currentIndex;this.playPauseIntervalId&&(window.clearInterval(this.playPauseIntervalId),this.playPauseIntervalId=null,this.setState({isPlaying:!1}),t&&e&&t(n))}},{key:"isImageLoaded",value:function(e){return!!this.loadedImages[e.original]||(this.loadedImages[e.original]=!0,!1)}},{key:"handleImageLoaded",value:function(e,t){var n=this.props.onImageLoad;!this.loadedImages[t]&&n&&(this.loadedImages[t]=!0,n(e))}},{key:"renderItem",value:function(e){var t=this.state.isFullscreen,n=this.props.onImageError||this.handleImageError;return a().createElement(ge,{description:e.description,fullscreen:e.fullscreen,handleImageLoaded:this.handleImageLoaded,isFullscreen:t,onImageError:n,original:e.original,originalAlt:e.originalAlt,originalHeight:e.originalHeight,originalWidth:e.originalWidth,originalTitle:e.originalTitle,sizes:e.sizes,loading:e.loading,srcSet:e.srcSet})}},{key:"renderThumbInner",value:function(e){var t=this.props.onThumbnailError||this.handleImageError;return a().createElement("span",{className:"image-gallery-thumbnail-inner"},a().createElement("img",{className:"image-gallery-thumbnail-image",src:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth,alt:e.thumbnailAlt,title:e.thumbnailTitle,loading:e.thumbnailLoading,onError:t}),e.thumbnailLabel&&a().createElement("div",{className:"image-gallery-thumbnail-label"},e.thumbnailLabel))}},{key:"render",value:function(){var e=this.state,n=e.currentIndex,i=e.isFullscreen,r=e.modalFullscreen,o=e.isPlaying,s=this.props,l=s.additionalClass,u=s.disableThumbnailSwipe,c=s.indexSeparator,h=s.isRTL,d=s.items,p=s.thumbnailPosition,f=s.renderFullscreenButton,m=s.renderCustomControls,b=s.renderLeftNav,g=s.renderRightNav,v=s.showBullets,y=s.showFullscreenButton,w=s.showIndex,S=s.showThumbnails,T=s.showNav,O=s.showPlayButton,E=s.renderPlayPauseButton,k=this.getThumbnailStyle(),I=this.getSlideItems(),j=I.slides,x=I.thumbnails,P=I.bullets,_=t("image-gallery-slide-wrapper",this.getThumbnailPositionClassName(p),{"image-gallery-rtl":h}),R=a().createElement("div",{ref:this.imageGallerySlideWrapper,className:_},m&&m(),this.canSlide()?a().createElement(a().Fragment,null,T&&a().createElement(a().Fragment,null,b(this.slideLeft,!this.canSlideLeft()),g(this.slideRight,!this.canSlideRight())),a().createElement(Ae,{className:"image-gallery-swipe",delta:0,onSwiping:this.handleSwiping,onSwiped:this.handleOnSwiped},a().createElement("div",{className:"image-gallery-slides"},j))):a().createElement("div",{className:"image-gallery-slides"},j),O&&E(this.togglePlay,o),v&&a().createElement("div",{className:"image-gallery-bullets"},a().createElement("div",{className:"image-gallery-bullets-container",role:"navigation","aria-label":"Bullet Navigation"},P)),y&&f(this.toggleFullScreen,i),w&&a().createElement("div",{className:"image-gallery-index"},a().createElement("span",{className:"image-gallery-index-current"},n+1),a().createElement("span",{className:"image-gallery-index-separator"},c),a().createElement("span",{className:"image-gallery-index-total"},d.length))),M=t("image-gallery",l,{"fullscreen-modal":r}),L=t("image-gallery-content",this.getThumbnailPositionClassName(p),{fullscreen:i}),D=t("image-gallery-thumbnails-wrapper",this.getThumbnailPositionClassName(p),{"thumbnails-wrapper-rtl":!this.isThumbnailVertical()&&h},{"thumbnails-swipe-horizontal":!this.isThumbnailVertical()&&!u},{"thumbnails-swipe-vertical":this.isThumbnailVertical()&&!u});return a().createElement("div",{ref:this.imageGallery,className:M,"aria-live":"polite"},a().createElement("div",{className:L},("bottom"===p||"right"===p)&&R,S&&x.length>0?a().createElement(Ae,{className:D,delta:0,onSwiping:!u&&this.handleThumbnailSwiping,onSwiped:!u&&this.handleOnThumbnailSwiped},a().createElement("div",{className:"image-gallery-thumbnails",ref:this.thumbnailsWrapper,style:this.getThumbnailBarHeight()},a().createElement("nav",{ref:this.thumbnails,className:"image-gallery-thumbnails-container",style:k,"aria-label":"Thumbnail Navigation"},x))):null,("top"===p||"left"===p)&&R))}}],i&&He(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),l}(a().Component);tt.propTypes={flickThreshold:ce.number,items:(0,ce.arrayOf)((0,ce.shape)({bulletClass:ce.string,bulletOnClick:ce.func,description:ce.string,original:ce.string,originalHeight:ce.number,originalWidth:ce.number,loading:ce.string,thumbnailHeight:ce.number,thumbnailWidth:ce.number,thumbnailLoading:ce.string,fullscreen:ce.string,originalAlt:ce.string,originalTitle:ce.string,thumbnail:ce.string,thumbnailAlt:ce.string,thumbnailLabel:ce.string,thumbnailTitle:ce.string,originalClass:ce.string,thumbnailClass:ce.string,renderItem:ce.func,renderThumbInner:ce.func,imageSet:Ze,srcSet:ce.string,sizes:ce.string})).isRequired,showNav:ce.bool,autoPlay:ce.bool,lazyLoad:ce.bool,infinite:ce.bool,showIndex:ce.bool,showBullets:ce.bool,showThumbnails:ce.bool,showPlayButton:ce.bool,showFullscreenButton:ce.bool,disableThumbnailScroll:ce.bool,disableKeyDown:ce.bool,disableSwipe:ce.bool,disableThumbnailSwipe:ce.bool,useBrowserFullscreen:ce.bool,onErrorImageURL:ce.string,indexSeparator:ce.string,thumbnailPosition:(0,ce.oneOf)(["top","bottom","left","right"]),startIndex:ce.number,slideDuration:ce.number,slideInterval:ce.number,slideOnThumbnailOver:ce.bool,swipeThreshold:ce.number,swipingTransitionDuration:ce.number,swipingThumbnailTransitionDuration:ce.number,onSlide:ce.func,onBeforeSlide:ce.func,onScreenChange:ce.func,onPause:ce.func,onPlay:ce.func,onClick:ce.func,onImageLoad:ce.func,onImageError:ce.func,onTouchMove:ce.func,onTouchEnd:ce.func,onTouchStart:ce.func,onMouseOver:ce.func,onMouseLeave:ce.func,onBulletClick:ce.func,onThumbnailError:ce.func,onThumbnailClick:ce.func,renderCustomControls:ce.func,renderLeftNav:ce.func,renderRightNav:ce.func,renderPlayPauseButton:ce.func,renderFullscreenButton:ce.func,renderItem:ce.func,renderThumbInner:ce.func,stopPropagation:ce.bool,additionalClass:ce.string,useTranslate3D:ce.bool,isRTL:ce.bool,useWindowKeyDown:ce.bool},tt.defaultProps={onErrorImageURL:"",additionalClass:"",showNav:!0,autoPlay:!1,lazyLoad:!1,infinite:!0,showIndex:!1,showBullets:!1,showThumbnails:!0,showPlayButton:!0,showFullscreenButton:!0,disableThumbnailScroll:!1,disableKeyDown:!1,disableSwipe:!1,disableThumbnailSwipe:!1,useTranslate3D:!0,isRTL:!1,useBrowserFullscreen:!0,flickThreshold:.4,stopPropagation:!1,indexSeparator:" / ",thumbnailPosition:"bottom",startIndex:0,slideDuration:450,swipingTransitionDuration:0,swipingThumbnailTransitionDuration:0,onSlide:null,onBeforeSlide:null,onScreenChange:null,onPause:null,onPlay:null,onClick:null,onImageLoad:null,onImageError:null,onTouchMove:null,onTouchEnd:null,onTouchStart:null,onMouseOver:null,onMouseLeave:null,onBulletClick:null,onThumbnailError:null,onThumbnailClick:null,renderCustomControls:null,renderThumbInner:null,renderItem:null,slideInterval:3e3,slideOnThumbnailOver:!1,swipeThreshold:30,renderLeftNav:function(e,t){return a().createElement(Pe,{onClick:e,disabled:t})},renderRightNav:function(e,t){return a().createElement(Re,{onClick:e,disabled:t})},renderPlayPauseButton:function(e,t){return a().createElement(Le,{onClick:e,isPlaying:t})},renderFullscreenButton:function(e,t){return a().createElement(je,{onClick:e,isFullscreen:t})},useWindowKeyDown:!0};const nt=tt})(),r})())); /***/ }), /***/ 5301: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /** * This is a straight rip-off of the React.js ReactPropTypes.js proptype validators, * modified to make it possible to validate Immutable.js data. * ImmutableTypes.listOf is patterned after React.PropTypes.arrayOf, but for Immutable.List * ImmutableTypes.shape is based on React.PropTypes.shape, but for any Immutable.Iterable */ var Immutable = __webpack_require__(3096); var ANONYMOUS = "<>"; var ImmutablePropTypes; if (false) {} else { var productionTypeChecker = function productionTypeChecker() { invariant(false, "ImmutablePropTypes type checking code is stripped in production."); }; productionTypeChecker.isRequired = productionTypeChecker; var getProductionTypeChecker = function getProductionTypeChecker() { return productionTypeChecker; }; ImmutablePropTypes = { listOf: getProductionTypeChecker, mapOf: getProductionTypeChecker, orderedMapOf: getProductionTypeChecker, setOf: getProductionTypeChecker, orderedSetOf: getProductionTypeChecker, stackOf: getProductionTypeChecker, iterableOf: getProductionTypeChecker, recordOf: getProductionTypeChecker, shape: getProductionTypeChecker, contains: getProductionTypeChecker, mapContains: getProductionTypeChecker, orderedMapContains: getProductionTypeChecker, // Primitive Types list: productionTypeChecker, map: productionTypeChecker, orderedMap: productionTypeChecker, set: productionTypeChecker, orderedSet: productionTypeChecker, stack: productionTypeChecker, seq: productionTypeChecker, record: productionTypeChecker, iterable: productionTypeChecker }; } ImmutablePropTypes.iterable.indexed = createIterableSubclassTypeChecker("Indexed", Immutable.Iterable.isIndexed); ImmutablePropTypes.iterable.keyed = createIterableSubclassTypeChecker("Keyed", Immutable.Iterable.isKeyed); function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return "array"; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return "object"; } if (propValue instanceof Immutable.Iterable) { return "Immutable." + propValue.toSource().split(" ")[0]; } return propType; } function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { rest[_key - 6] = arguments[_key]; } propFullName = propFullName || propName; componentName = componentName || ANONYMOUS; if (props[propName] == null) { var locationName = location; if (isRequired) { return new Error("Required " + locationName + " `" + propFullName + "` was not specified in " + ("`" + componentName + "`.")); } } else { return validate.apply(undefined, [props, propName, componentName, location, propFullName].concat(rest)); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createImmutableTypeChecker(immutableClassName, immutableClassTypeValidator) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!immutableClassTypeValidator(propValue)) { var propType = getPropType(propValue); return new Error("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `" + immutableClassName + "`.")); } return null; } return createChainableTypeChecker(validate); } function createIterableSubclassTypeChecker(subclassName, validator) { return createImmutableTypeChecker("Iterable." + subclassName, function (propValue) { return Immutable.Iterable.isIterable(propValue) && validator(propValue); }); } function createIterableTypeChecker(typeChecker, immutableClassName, immutableClassTypeValidator) { function validate(props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { rest[_key - 5] = arguments[_key]; } var propValue = props[propName]; if (!immutableClassTypeValidator(propValue)) { var locationName = location; var propType = getPropType(propValue); return new Error("Invalid " + locationName + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an Immutable.js " + immutableClassName + ".")); } if (typeof typeChecker !== "function") { return new Error("Invalid typeChecker supplied to `" + componentName + "` " + ("for propType `" + propFullName + "`, expected a function.")); } var propValues = propValue.valueSeq().toArray(); for (var i = 0, len = propValues.length; i < len; i++) { var error = typeChecker.apply(undefined, [propValues, i, componentName, location, "" + propFullName + "[" + i + "]"].concat(rest)); if (error instanceof Error) { return error; } } } return createChainableTypeChecker(validate); } function createKeysTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { rest[_key - 5] = arguments[_key]; } var propValue = props[propName]; if (typeof typeChecker !== "function") { return new Error("Invalid keysTypeChecker (optional second argument) supplied to `" + componentName + "` " + ("for propType `" + propFullName + "`, expected a function.")); } var keys = propValue.keySeq().toArray(); for (var i = 0, len = keys.length; i < len; i++) { var error = typeChecker.apply(undefined, [keys, i, componentName, location, "" + propFullName + " -> key(" + keys[i] + ")"].concat(rest)); if (error instanceof Error) { return error; } } } return createChainableTypeChecker(validate); } function createListOfTypeChecker(typeChecker) { return createIterableTypeChecker(typeChecker, "List", Immutable.List.isList); } function createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, immutableClassName, immutableClassTypeValidator) { function validate() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return createIterableTypeChecker(valuesTypeChecker, immutableClassName, immutableClassTypeValidator).apply(undefined, args) || keysTypeChecker && createKeysTypeChecker(keysTypeChecker).apply(undefined, args); } return createChainableTypeChecker(validate); } function createMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) { return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, "Map", Immutable.Map.isMap); } function createOrderedMapOfTypeChecker(valuesTypeChecker, keysTypeChecker) { return createMapOfTypeCheckerFactory(valuesTypeChecker, keysTypeChecker, "OrderedMap", Immutable.OrderedMap.isOrderedMap); } function createSetOfTypeChecker(typeChecker) { return createIterableTypeChecker(typeChecker, "Set", Immutable.Set.isSet); } function createOrderedSetOfTypeChecker(typeChecker) { return createIterableTypeChecker(typeChecker, "OrderedSet", Immutable.OrderedSet.isOrderedSet); } function createStackOfTypeChecker(typeChecker) { return createIterableTypeChecker(typeChecker, "Stack", Immutable.Stack.isStack); } function createIterableOfTypeChecker(typeChecker) { return createIterableTypeChecker(typeChecker, "Iterable", Immutable.Iterable.isIterable); } function createRecordOfTypeChecker(recordKeys) { function validate(props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { rest[_key - 5] = arguments[_key]; } var propValue = props[propName]; if (!(propValue instanceof Immutable.Record)) { var propType = getPropType(propValue); var locationName = location; return new Error("Invalid " + locationName + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected an Immutable.js Record.")); } for (var key in recordKeys) { var checker = recordKeys[key]; if (!checker) { continue; } var mutablePropValue = propValue.toObject(); var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, "" + propFullName + "." + key].concat(rest)); if (error) { return error; } } } return createChainableTypeChecker(validate); } // there is some irony in the fact that shapeTypes is a standard hash and not an immutable collection function createShapeTypeChecker(shapeTypes) { var immutableClassName = arguments[1] === undefined ? "Iterable" : arguments[1]; var immutableClassTypeValidator = arguments[2] === undefined ? Immutable.Iterable.isIterable : arguments[2]; function validate(props, propName, componentName, location, propFullName) { for (var _len = arguments.length, rest = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) { rest[_key - 5] = arguments[_key]; } var propValue = props[propName]; if (!immutableClassTypeValidator(propValue)) { var propType = getPropType(propValue); var locationName = location; return new Error("Invalid " + locationName + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected an Immutable.js " + immutableClassName + ".")); } var mutablePropValue = propValue.toObject(); for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue; } var error = checker.apply(undefined, [mutablePropValue, key, componentName, location, "" + propFullName + "." + key].concat(rest)); if (error) { return error; } } } return createChainableTypeChecker(validate); } function createShapeChecker(shapeTypes) { return createShapeTypeChecker(shapeTypes); } function createMapContainsChecker(shapeTypes) { return createShapeTypeChecker(shapeTypes, "Map", Immutable.Map.isMap); } function createOrderedMapContainsChecker(shapeTypes) { return createShapeTypeChecker(shapeTypes, "OrderedMap", Immutable.OrderedMap.isOrderedMap); } module.exports = ImmutablePropTypes; /***/ }), /***/ 8618: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); var _postcssValueParser = __webpack_require__(5482); var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); var _parser = __webpack_require__(4579); var _reducer = __webpack_require__(6018); var _reducer2 = _interopRequireDefault(_reducer); var _stringifier = __webpack_require__(2459); var _stringifier2 = _interopRequireDefault(_stringifier); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // eslint-disable-line var MATCH_CALC = /((?:\-[a-z]+\-)?calc)/; exports["default"] = function (value) { var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5; return (0, _postcssValueParser2.default)(value).walk(function (node) { // skip anything which isn't a calc() function if (node.type !== 'function' || !MATCH_CALC.test(node.value)) return; // stringify calc expression and produce an AST var contents = _postcssValueParser2.default.stringify(node.nodes); // skip constant() and env() if (contents.indexOf('constant') >= 0 || contents.indexOf('env') >= 0) return; var ast = _parser.parser.parse(contents); // reduce AST to its simplest form, that is, either to a single value // or a simplified calc expression var reducedAst = (0, _reducer2.default)(ast, precision); // stringify AST and write it back node.type = 'word'; node.value = (0, _stringifier2.default)(node.value, reducedAst, precision); }, true).toString(); }; module.exports = exports['default']; /***/ }), /***/ 6293: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); var _cssUnitConverter = __webpack_require__(2480); var _cssUnitConverter2 = _interopRequireDefault(_cssUnitConverter); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function convertNodes(left, right, precision) { switch (left.type) { case 'LengthValue': case 'AngleValue': case 'TimeValue': case 'FrequencyValue': case 'ResolutionValue': return convertAbsoluteLength(left, right, precision); default: return { left: left, right: right }; } } function convertAbsoluteLength(left, right, precision) { if (right.type === left.type) { right = { type: left.type, value: (0, _cssUnitConverter2.default)(right.value, right.unit, left.unit, precision), unit: left.unit }; } return { left: left, right: right }; } exports["default"] = convertNodes; module.exports = exports['default']; /***/ }), /***/ 6018: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.flip = flip; var _convert = __webpack_require__(6293); var _convert2 = _interopRequireDefault(_convert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function reduce(node, precision) { if (node.type === "MathExpression") return reduceMathExpression(node, precision); if (node.type === "Calc") return reduce(node.value, precision); return node; } function isEqual(left, right) { return left.type === right.type && left.value === right.value; } function isValueType(type) { switch (type) { case 'LengthValue': case 'AngleValue': case 'TimeValue': case 'FrequencyValue': case 'ResolutionValue': case 'EmValue': case 'ExValue': case 'ChValue': case 'RemValue': case 'VhValue': case 'VwValue': case 'VminValue': case 'VmaxValue': case 'PercentageValue': case 'Value': return true; } return false; } function convertMathExpression(node, precision) { var nodes = (0, _convert2.default)(node.left, node.right, precision); var left = reduce(nodes.left, precision); var right = reduce(nodes.right, precision); if (left.type === "MathExpression" && right.type === "MathExpression") { if (left.operator === '/' && right.operator === '*' || left.operator === '-' && right.operator === '+' || left.operator === '*' && right.operator === '/' || left.operator === '+' && right.operator === '-') { if (isEqual(left.right, right.right)) nodes = (0, _convert2.default)(left.left, right.left, precision);else if (isEqual(left.right, right.left)) nodes = (0, _convert2.default)(left.left, right.right, precision); left = reduce(nodes.left, precision); right = reduce(nodes.right, precision); } } node.left = left; node.right = right; return node; } function flip(operator) { return operator === '+' ? '-' : '+'; } function flipValue(node) { if (isValueType(node.type)) node.value = -node.value;else if (node.type == 'MathExpression') { node.left = flipValue(node.left); node.right = flipValue(node.right); } return node; } function reduceAddSubExpression(node, precision) { var _node = node, left = _node.left, right = _node.right, op = _node.operator; if (left.type === 'CssVariable' || right.type === 'CssVariable') return node; // something + 0 => something // something - 0 => something if (right.value === 0) return left; // 0 + something => something if (left.value === 0 && op === "+") return right; // 0 - something => -something if (left.value === 0 && op === "-") return flipValue(right); // value + value // value - value if (left.type === right.type && isValueType(left.type)) { node = Object.assign({}, left); if (op === "+") node.value = left.value + right.value;else node.value = left.value - right.value; } // value (expr) if (isValueType(left.type) && (right.operator === '+' || right.operator === '-') && right.type === 'MathExpression') { // value + (value + something) => (value + value) + something // value + (value - something) => (value + value) - something // value - (value + something) => (value - value) - something // value - (value - something) => (value - value) + something if (left.type === right.left.type) { node = Object.assign({}, node); node.left = reduce({ type: 'MathExpression', operator: op, left: left, right: right.left }, precision); node.right = right.right; node.operator = op === '-' ? flip(right.operator) : right.operator; return reduce(node, precision); } // value + (something + value) => (value + value) + something // value + (something - value) => (value - value) + something // value - (something + value) => (value - value) - something // value - (something - value) => (value + value) - something else if (left.type === right.right.type) { node = Object.assign({}, node); node.left = reduce({ type: 'MathExpression', operator: op === '-' ? flip(right.operator) : right.operator, left: left, right: right.right }, precision); node.right = right.left; return reduce(node, precision); } } // (expr) value if (left.type === 'MathExpression' && (left.operator === '+' || left.operator === '-') && isValueType(right.type)) { // (value + something) + value => (value + value) + something // (value - something) + value => (value + value) - something // (value + something) - value => (value - value) + something // (value - something) - value => (value - value) - something if (right.type === left.left.type) { node = Object.assign({}, left); node.left = reduce({ type: 'MathExpression', operator: op, left: left.left, right: right }, precision); return reduce(node, precision); } // (something + value) + value => something + (value + value) // (something - value1) + value2 => something - (value2 - value1) // (something + value) - value => something + (value - value) // (something - value) - value => something - (value + value) else if (right.type === left.right.type) { node = Object.assign({}, left); if (left.operator === '-') { node.right = reduce({ type: 'MathExpression', operator: op === '-' ? '+' : '-', left: right, right: left.right }, precision); node.operator = op === '-' ? '-' : '+'; } else { node.right = reduce({ type: 'MathExpression', operator: op, left: left.right, right: right }, precision); } if (node.right.value < 0) { node.right.value *= -1; node.operator = node.operator === '-' ? '+' : '-'; } return reduce(node, precision); } } return node; } function reduceDivisionExpression(node, precision) { if (!isValueType(node.right.type)) return node; if (node.right.type !== 'Value') throw new Error("Cannot divide by \"" + node.right.unit + "\", number expected"); if (node.right.value === 0) throw new Error('Cannot divide by zero'); // (expr) / value if (node.left.type === 'MathExpression') { if (isValueType(node.left.left.type) && isValueType(node.left.right.type)) { node.left.left.value /= node.right.value; node.left.right.value /= node.right.value; return reduce(node.left, precision); } return node; } // something / value else if (isValueType(node.left.type)) { node.left.value /= node.right.value; return node.left; } return node; } function reduceMultiplicationExpression(node) { // (expr) * value if (node.left.type === 'MathExpression' && node.right.type === 'Value') { if (isValueType(node.left.left.type) && isValueType(node.left.right.type)) { node.left.left.value *= node.right.value; node.left.right.value *= node.right.value; return node.left; } } // something * value else if (isValueType(node.left.type) && node.right.type === 'Value') { node.left.value *= node.right.value; return node.left; } // value * (expr) else if (node.left.type === 'Value' && node.right.type === 'MathExpression') { if (isValueType(node.right.left.type) && isValueType(node.right.right.type)) { node.right.left.value *= node.left.value; node.right.right.value *= node.left.value; return node.right; } } // value * something else if (node.left.type === 'Value' && isValueType(node.right.type)) { node.right.value *= node.left.value; return node.right; } return node; } function reduceMathExpression(node, precision) { node = convertMathExpression(node, precision); switch (node.operator) { case "+": case "-": return reduceAddSubExpression(node, precision); case "/": return reduceDivisionExpression(node, precision); case "*": return reduceMultiplicationExpression(node); } return node; } exports["default"] = reduce; /***/ }), /***/ 2459: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = function (calc, node, precision) { var str = stringify(node, precision); if (node.type === "MathExpression") { // if calc expression couldn't be resolved to a single value, re-wrap it as // a calc() str = calc + "(" + str + ")"; } return str; }; var _reducer = __webpack_require__(6018); var order = { "*": 0, "/": 0, "+": 1, "-": 1 }; function round(value, prec) { if (prec !== false) { var precision = Math.pow(10, prec); return Math.round(value * precision) / precision; } return value; } function stringify(node, prec) { switch (node.type) { case "MathExpression": { var left = node.left, right = node.right, op = node.operator; var str = ""; if (left.type === 'MathExpression' && order[op] < order[left.operator]) str += "(" + stringify(left, prec) + ")";else str += stringify(left, prec); str += " " + node.operator + " "; if (right.type === 'MathExpression' && order[op] < order[right.operator]) { str += "(" + stringify(right, prec) + ")"; } else if (right.type === 'MathExpression' && op === "-" && ["+", "-"].includes(right.operator)) { // fix #52 : a-(b+c) = a-b-c right.operator = (0, _reducer.flip)(right.operator); str += stringify(right, prec); } else { str += stringify(right, prec); } return str; } case "Value": return round(node.value, prec); case 'CssVariable': if (node.fallback) { return "var(" + node.value + ", " + stringify(node.fallback, prec, true) + ")"; } return "var(" + node.value + ")"; case 'Calc': if (node.prefix) { return "-" + node.prefix + "-calc(" + stringify(node.value, prec) + ")"; } return "calc(" + stringify(node.value, prec) + ")"; default: return round(node.value, prec) + node.unit; } } module.exports = exports["default"]; /***/ }), /***/ 4579: /***/ (function(__unused_webpack_module, exports) { /* parser generated by jison 0.6.1-215 */ /* * Returns a Parser object of the following structure: * * Parser: { * yy: {} The so-called "shared state" or rather the *source* of it; * the real "shared state" `yy` passed around to * the rule actions, etc. is a derivative/copy of this one, * not a direct reference! * } * * Parser.prototype: { * yy: {}, * EOF: 1, * TERROR: 2, * * trace: function(errorMessage, ...), * * JisonParserError: function(msg, hash), * * quoteName: function(name), * Helper function which can be overridden by user code later on: put suitable * quotes around literal IDs in a description string. * * originalQuoteName: function(name), * The basic quoteName handler provided by JISON. * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function * at the end of the `parse()`. * * describeSymbol: function(symbol), * Return a more-or-less human-readable description of the given symbol, when * available, or the symbol itself, serving as its own 'description' for lack * of something better to serve up. * * Return NULL when the symbol is unknown to the parser. * * symbols_: {associative list: name ==> number}, * terminals_: {associative list: number ==> name}, * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), * * The function parameters and `this` have the following value/meaning: * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) * to store/reference the rule value `$$` and location info `@$`. * * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets * to see the same object via the `this` reference, i.e. if you wish to carry custom * data from one reduce action through to the next within a single parse run, then you * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. * * `this.yy` is a direct reference to the `yy` shared state object. * * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` * object at `parse()` start and are therefore available to the action code via the * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from * the %parse-param` list. * * - `yytext` : reference to the lexer value which belongs to the last lexer token used * to match this rule. This is *not* the look-ahead token, but the last token * that's actually part of this rule. * * Formulated another way, `yytext` is the value of the token immediately preceeding * the current look-ahead token. * Caveats apply for rules which don't require look-ahead, such as epsilon rules. * * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. * * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. * * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. * * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead * of an empty object when no suitable location info can be provided. * * - `yystate` : the current parser state number, used internally for dispatching and * executing the action code chunk matching the rule currently being reduced. * * - `yysp` : the current state stack position (a.k.a. 'stack pointer') * * This one comes in handy when you are going to do advanced things to the parser * stacks, all of which are accessible from your action code (see the next entries below). * * Also note that you can access this and other stack index values using the new double-hash * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things * related to the first rule term, just like you have `$1`, `@1` and `#1`. * This is made available to write very advanced grammar action rules, e.g. when you want * to investigate the parse state stack in your action code, which would, for example, * be relevant when you wish to implement error diagnostics and reporting schemes similar * to the work described here: * * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. * In Journées Francophones des Languages Applicatifs. * * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. * * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. * * This one comes in handy when you are going to do advanced things to the parser * stacks, all of which are accessible from your action code (see the next entries below). * * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. * constructs. * * - `yylstack`: reference to the parser token location stack. Also accessed via * the `@1` etc. constructs. * * WARNING: since jison 0.4.18-186 this array MAY contain slots which are * UNDEFINED rather than an empty (location) object, when the lexer/parser * action code did not provide a suitable location info object when such a * slot was filled! * * - `yystack` : reference to the parser token id stack. Also accessed via the * `#1` etc. constructs. * * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might * want access this array for your own purposes, such as error analysis as mentioned above! * * Note that this stack stores the current stack of *tokens*, that is the sequence of * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* * (lexer tokens *shifted* onto the stack until the rule they belong to is found and * *reduced*. * * - `yysstack`: reference to the parser state stack. This one carries the internal parser * *states* such as the one in `yystate`, which are used to represent * the parser state machine in the *parse table*. *Very* *internal* stuff, * what can I say? If you access this one, you're clearly doing wicked things * * - `...` : the extra arguments you specified in the `%parse-param` statement in your * grammar definition file. * * table: [...], * State transition table * ---------------------- * * index levels are: * - `state` --> hash table * - `symbol` --> action (number or array) * * If the `action` is an array, these are the elements' meaning: * - index [0]: 1 = shift, 2 = reduce, 3 = accept * - index [1]: GOTO `state` * * If the `action` is a number, it is the GOTO `state` * * defaultActions: {...}, * * parseError: function(str, hash, ExceptionClass), * yyError: function(str, ...), * yyRecovering: function(), * yyErrOk: function(), * yyClearIn: function(), * * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), * Helper function **which will be set up during the first invocation of the `parse()` method**. * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. * See it's use in this parser kernel in many places; example usage: * * var infoObj = parser.constructParseErrorInfo('fail!', null, * parser.collect_expected_token_set(state), true); * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); * * originalParseError: function(str, hash, ExceptionClass), * The basic `parseError` handler provided by JISON. * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function * at the end of the `parse()`. * * options: { ... parser %options ... }, * * parse: function(input[, args...]), * Parse the given `input` and return the parsed value (or `true` when none was provided by * the root action, in which case the parser is acting as a *matcher*). * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: * these extra `args...` are added verbatim to the `yy` object reference as member variables. * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with * any attributes already added to `yy` by the jison run-time; * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), * Helper function **which will be set up during the first invocation of the `parse()` method**. * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and * the internal parser gets properly garbage collected under these particular circumstances. * * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), * Helper function **which will be set up during the first invocation of the `parse()` method**. * This helper API can be invoked to calculate a spanning `yylloc` location info object. * * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case * this function will attempt to obtain a suitable location marker by inspecting the location stack * backwards. * * For more info see the documentation comment further below, immediately above this function's * implementation. * * lexer: { * yy: {...}, A reference to the so-called "shared state" `yy` once * received via a call to the `.setInput(input, yy)` lexer API. * EOF: 1, * ERROR: 2, * JisonLexerError: function(msg, hash), * parseError: function(str, hash, ExceptionClass), * setInput: function(input, [yy]), * input: function(), * unput: function(str), * more: function(), * reject: function(), * less: function(n), * pastInput: function(n), * upcomingInput: function(n), * showPosition: function(), * test_match: function(regex_match_array, rule_index, ...), * next: function(...), * lex: function(...), * begin: function(condition), * pushState: function(condition), * popState: function(), * topState: function(), * _currentRules: function(), * stateStackSize: function(), * cleanupAfterLex: function() * * options: { ... lexer %options ... }, * * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), * rules: [...], * conditions: {associative list: name ==> set}, * } * } * * * token location info (@$, _$, etc.): { * first_line: n, * last_line: n, * first_column: n, * last_column: n, * range: [start_number, end_number] * (where the numbers are indexes into the input string, zero-based) * } * * --- * * The `parseError` function receives a 'hash' object with these members for lexer and * parser errors: * * { * text: (matched text) * token: (the produced terminal token, if any) * token_id: (the produced terminal token numeric ID, if any) * line: (yylineno) * loc: (yylloc) * } * * parser (grammar) errors will also provide these additional members: * * { * expected: (array describing the set of expected tokens; * may be UNDEFINED when we cannot easily produce such a set) * state: (integer (or array when the table includes grammar collisions); * represents the current internal state of the parser kernel. * can, for example, be used to pass to the `collect_expected_token_set()` * API to obtain the expected token set) * action: (integer; represents the current internal action which will be executed) * new_state: (integer; represents the next/planned internal state, once the current * action has executed) * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule * available for this particular error) * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, * for instance, for advanced error analysis and reporting) * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, * for instance, for advanced error analysis and reporting) * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, * for instance, for advanced error analysis and reporting) * yy: (object: the current parser internal "shared state" `yy` * as is also available in the rule actions; this can be used, * for instance, for advanced error analysis and reporting) * lexer: (reference to the current lexer instance used by the parser) * parser: (reference to the current parser instance) * } * * while `this` will reference the current parser instance. * * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* * instance, while these additional `hash` fields will also be provided: * * { * lexer: (reference to the current lexer instance which reported the error) * } * * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired * from either the parser or lexer, `this` will still reference the related *parser* * instance, while these additional `hash` fields will also be provided: * * { * exception: (reference to the exception thrown) * } * * Please do note that in the latter situation, the `expected` field will be omitted as * this type of failure is assumed not to be due to *parse errors* but rather due to user * action code in either parser or lexer failing unexpectedly. * * --- * * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. * These options are available: * * ### options which are global for all parser instances * * Parser.pre_parse: function(yy) * optional: you can specify a pre_parse() function in the chunk following * the grammar, i.e. after the last `%%`. * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } * optional: you can specify a post_parse() function in the chunk following * the grammar, i.e. after the last `%%`. When it does not return any value, * the parser will return the original `retval`. * * ### options which can be set up per parser instance * * yy: { * pre_parse: function(yy) * optional: is invoked before the parse cycle starts (and before the first * invocation of `lex()`) but immediately after the invocation of * `parser.pre_parse()`). * post_parse: function(yy, retval, parseInfo) { return retval; } * optional: is invoked when the parse terminates due to success ('accept') * or failure (even when exceptions are thrown). * `retval` contains the return value to be produced by `Parser.parse()`; * this function can override the return value by returning another. * When it does not return any value, the parser will return the original * `retval`. * This function is invoked immediately before `parser.post_parse()`. * * parseError: function(str, hash, ExceptionClass) * optional: overrides the default `parseError` function. * quoteName: function(name), * optional: overrides the default `quoteName` function. * } * * parser.lexer.options: { * pre_lex: function() * optional: is invoked before the lexer is invoked to produce another token. * `this` refers to the Lexer object. * post_lex: function(token) { return token; } * optional: is invoked when the lexer has produced a token `token`; * this function can override the returned token value by returning another. * When it does not return any (truthy) value, the lexer will return * the original `token`. * `this` refers to the Lexer object. * * ranges: boolean * optional: `true` ==> token location info will include a .range[] member. * flex: boolean * optional: `true` ==> flex-like lexing behaviour where the rules are tested * exhaustively to find the longest match. * backtrack_lexer: boolean * optional: `true` ==> lexer regexes are tested in order and for invoked; * the lexer terminates the scan when a token is returned by the action code. * xregexp: boolean * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer * rule regexes have been written as standard JavaScript RegExp expressions. * } */ var parser = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility // with userland code which might access the derived class in a 'classic' way. function JisonParserError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, writable: false, value: 'JisonParserError' }); if (msg == null) msg = '???'; Object.defineProperty(this, 'message', { enumerable: false, writable: true, value: msg }); this.hash = hash; var stacktrace; if (hash && hash.exception instanceof Error) { var ex2 = hash.exception; this.message = ex2.message || msg; stacktrace = ex2.stack; } if (!stacktrace) { if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { stacktrace = (new Error(msg)).stack; } } if (stacktrace) { Object.defineProperty(this, 'stack', { enumerable: false, writable: false, value: stacktrace }); } } if (typeof Object.setPrototypeOf === 'function') { Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); } else { JisonParserError.prototype = Object.create(Error.prototype); } JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; // helper: reconstruct the productions[] table function bp(s) { var rv = []; var p = s.pop; var r = s.rule; for (var i = 0, l = p.length; i < l; i++) { rv.push([ p[i], r[i] ]); } return rv; } // helper: reconstruct the defaultActions[] table function bda(s) { var rv = {}; var d = s.idx; var g = s.goto; for (var i = 0, l = d.length; i < l; i++) { var j = d[i]; rv[j] = g[i]; } return rv; } // helper: reconstruct the 'goto' table function bt(s) { var rv = []; var d = s.len; var y = s.symbol; var t = s.type; var a = s.state; var m = s.mode; var g = s.goto; for (var i = 0, l = d.length; i < l; i++) { var n = d[i]; var q = {}; for (var j = 0; j < n; j++) { var z = y.shift(); switch (t.shift()) { case 2: q[z] = [ m.shift(), g.shift() ]; break; case 0: q[z] = a.shift(); break; default: // type === 1: accept q[z] = [ 3 ]; } } rv.push(q); } return rv; } // helper: runlength encoding with increment step: code, length: step (default step = 0) // `this` references an array function s(c, l, a) { a = a || 0; for (var i = 0; i < l; i++) { this.push(c); c += a; } } // helper: duplicate sequence from *relative* offset and length. // `this` references an array function c(i, l) { i = this.length - i; for (l += i; i < l; i++) { this.push(this[i]); } } // helper: unpack an array using helpers and data, all passed in an array argument 'a'. function u(a) { var rv = []; for (var i = 0, l = a.length; i < l; i++) { var e = a[i]; // Is this entry a helper function? if (typeof e === 'function') { i++; e.apply(rv, a[i]); } else { rv.push(e); } } return rv; } var parser = { // Code Generator Information Report // --------------------------------- // // Options: // // default action mode: ............. ["classic","merge"] // test-compile action mode: ........ "parser:*,lexer:*" // try..catch: ...................... true // default resolve on conflict: ..... true // on-demand look-ahead: ............ false // error recovery token skip maximum: 3 // yyerror in parse actions is: ..... NOT recoverable, // yyerror in lexer actions and other non-fatal lexer are: // .................................. NOT recoverable, // debug grammar/output: ............ false // has partial LR conflict upgrade: true // rudimentary token-stack support: false // parser table compression mode: ... 2 // export debug tables: ............. false // export *all* tables: ............. false // module type: ..................... commonjs // parser engine type: .............. lalr // output main() in the module: ..... true // has user-specified main(): ....... false // has user-specified require()/import modules for main(): // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false // uses yytext: ..................... false // uses yylloc: ..................... false // uses ParseError API: ............. false // uses YYERROR: .................... false // uses YYRECOVERING: ............... false // uses YYERROK: .................... false // uses YYCLEARIN: .................. false // tracks rule values: .............. true // assigns rule values: ............. true // uses location tracking: .......... false // assigns location: ................ false // uses yystack: .................... false // uses yysstack: ................... false // uses yysp: ....................... true // uses yyrulelength: ............... false // uses yyMergeLocationInfo API: .... false // has error recovery: .............. false // has error reporting: ............. false // // --------- END OF REPORT ----------- trace: function no_op_trace() { }, JisonParserError: JisonParserError, yy: {}, options: { type: "lalr", hasPartialLrUpgradeOnConflict: true, errorRecoveryTokenDiscardCount: 3 }, symbols_: { "$accept": 0, "$end": 1, "ADD": 3, "ANGLE": 16, "CHS": 22, "COMMA": 14, "CSS_CPROP": 13, "CSS_VAR": 12, "DIV": 6, "EMS": 20, "EOF": 1, "EXS": 21, "FREQ": 18, "LENGTH": 15, "LPAREN": 7, "MUL": 5, "NESTED_CALC": 9, "NUMBER": 11, "PERCENTAGE": 28, "PREFIX": 10, "REMS": 23, "RES": 19, "RPAREN": 8, "SUB": 4, "TIME": 17, "VHS": 24, "VMAXS": 27, "VMINS": 26, "VWS": 25, "css_value": 33, "css_variable": 32, "error": 2, "expression": 29, "math_expression": 30, "value": 31 }, terminals_: { 1: "EOF", 2: "error", 3: "ADD", 4: "SUB", 5: "MUL", 6: "DIV", 7: "LPAREN", 8: "RPAREN", 9: "NESTED_CALC", 10: "PREFIX", 11: "NUMBER", 12: "CSS_VAR", 13: "CSS_CPROP", 14: "COMMA", 15: "LENGTH", 16: "ANGLE", 17: "TIME", 18: "FREQ", 19: "RES", 20: "EMS", 21: "EXS", 22: "CHS", 23: "REMS", 24: "VHS", 25: "VWS", 26: "VMINS", 27: "VMAXS", 28: "PERCENTAGE" }, TERROR: 2, EOF: 1, // internals: defined here so the object *structure* doesn't get modified by parse() et al, // thus helping JIT compilers like Chrome V8. originalQuoteName: null, originalParseError: null, cleanupAfterParse: null, constructParseErrorInfo: null, yyMergeLocationInfo: null, __reentrant_call_depth: 0, // INTERNAL USE ONLY __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup __error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, //yyErrOk: 0, //yyClearIn: 0, // Helper APIs // ----------- // Helper function which can be overridden by user code later on: put suitable quotes around // literal IDs in a description string. quoteName: function parser_quoteName(id_str) { return '"' + id_str + '"'; }, // Return the name of the given symbol (terminal or non-terminal) as a string, when available. // // Return NULL when the symbol is unknown to the parser. getSymbolName: function parser_getSymbolName(symbol) { if (this.terminals_[symbol]) { return this.terminals_[symbol]; } // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: // // parser.getSymbolName(#$) // // to obtain a human-readable name of the current grammar rule. var s = this.symbols_; for (var key in s) { if (s[key] === symbol) { return key; } } return null; }, // Return a more-or-less human-readable description of the given symbol, when available, // or the symbol itself, serving as its own 'description' for lack of something better to serve up. // // Return NULL when the symbol is unknown to the parser. describeSymbol: function parser_describeSymbol(symbol) { if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { return this.terminal_descriptions_[symbol]; } else if (symbol === this.EOF) { return 'end of input'; } var id = this.getSymbolName(symbol); if (id) { return this.quoteName(id); } return null; }, // Produce a (more or less) human-readable list of expected tokens at the point of failure. // // The produced list may contain token or token set descriptions instead of the tokens // themselves to help turning this output into something that easier to read by humans // unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, // expected terminals and nonterminals is produced. // // The returned list (array) will not contain any duplicate entries. collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { var TERROR = this.TERROR; var tokenset = []; var check = {}; // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { return [ this.state_descriptions_[state] ]; } for (var p in this.table[state]) { p = +p; if (p !== TERROR) { var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } return tokenset; }, productions_: bp({ pop: u([ 29, s, [30, 10], 31, 31, 32, 32, s, [33, 15] ]), rule: u([ 2, s, [3, 5], 4, 7, s, [1, 4], 2, 4, 6, s, [1, 14], 2 ]) }), performAction: function parser__PerformAction(yystate /* action[1] */, yysp, yyvstack) { /* this == yyval */ // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! var yy = this.yy; var yyparser = yy.parser; var yylexer = yy.lexer; switch (yystate) { case 0: /*! Production:: $accept : expression $end */ // default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-): this.$ = yyvstack[yysp - 1]; // END of default action (generated by JISON mode classic/merge :: 1,VT,VA,-,-,-,-,-,-) break; case 1: /*! Production:: expression : math_expression EOF */ // default action (generated by JISON mode classic/merge :: 2,VT,VA,-,-,-,-,-,-): this.$ = yyvstack[yysp - 1]; // END of default action (generated by JISON mode classic/merge :: 2,VT,VA,-,-,-,-,-,-) return yyvstack[yysp - 1]; break; case 2: /*! Production:: math_expression : math_expression ADD math_expression */ case 3: /*! Production:: math_expression : math_expression SUB math_expression */ case 4: /*! Production:: math_expression : math_expression MUL math_expression */ case 5: /*! Production:: math_expression : math_expression DIV math_expression */ this.$ = { type: 'MathExpression', operator: yyvstack[yysp - 1], left: yyvstack[yysp - 2], right: yyvstack[yysp] }; break; case 6: /*! Production:: math_expression : LPAREN math_expression RPAREN */ this.$ = yyvstack[yysp - 1]; break; case 7: /*! Production:: math_expression : NESTED_CALC LPAREN math_expression RPAREN */ this.$ = { type: 'Calc', value: yyvstack[yysp - 1] }; break; case 8: /*! Production:: math_expression : SUB PREFIX SUB NESTED_CALC LPAREN math_expression RPAREN */ this.$ = { type: 'Calc', value: yyvstack[yysp - 1], prefix: yyvstack[yysp - 5] }; break; case 9: /*! Production:: math_expression : css_variable */ case 10: /*! Production:: math_expression : css_value */ case 11: /*! Production:: math_expression : value */ this.$ = yyvstack[yysp]; break; case 12: /*! Production:: value : NUMBER */ this.$ = { type: 'Value', value: parseFloat(yyvstack[yysp]) }; break; case 13: /*! Production:: value : SUB NUMBER */ this.$ = { type: 'Value', value: parseFloat(yyvstack[yysp]) * -1 }; break; case 14: /*! Production:: css_variable : CSS_VAR LPAREN CSS_CPROP RPAREN */ this.$ = { type: 'CssVariable', value: yyvstack[yysp - 1] }; break; case 15: /*! Production:: css_variable : CSS_VAR LPAREN CSS_CPROP COMMA math_expression RPAREN */ this.$ = { type: 'CssVariable', value: yyvstack[yysp - 3], fallback: yyvstack[yysp - 1] }; break; case 16: /*! Production:: css_value : LENGTH */ this.$ = { type: 'LengthValue', value: parseFloat(yyvstack[yysp]), unit: /[a-z]+/.exec(yyvstack[yysp])[0] }; break; case 17: /*! Production:: css_value : ANGLE */ this.$ = { type: 'AngleValue', value: parseFloat(yyvstack[yysp]), unit: /[a-z]+/.exec(yyvstack[yysp])[0] }; break; case 18: /*! Production:: css_value : TIME */ this.$ = { type: 'TimeValue', value: parseFloat(yyvstack[yysp]), unit: /[a-z]+/.exec(yyvstack[yysp])[0] }; break; case 19: /*! Production:: css_value : FREQ */ this.$ = { type: 'FrequencyValue', value: parseFloat(yyvstack[yysp]), unit: /[a-z]+/.exec(yyvstack[yysp])[0] }; break; case 20: /*! Production:: css_value : RES */ this.$ = { type: 'ResolutionValue', value: parseFloat(yyvstack[yysp]), unit: /[a-z]+/.exec(yyvstack[yysp])[0] }; break; case 21: /*! Production:: css_value : EMS */ this.$ = { type: 'EmValue', value: parseFloat(yyvstack[yysp]), unit: 'em' }; break; case 22: /*! Production:: css_value : EXS */ this.$ = { type: 'ExValue', value: parseFloat(yyvstack[yysp]), unit: 'ex' }; break; case 23: /*! Production:: css_value : CHS */ this.$ = { type: 'ChValue', value: parseFloat(yyvstack[yysp]), unit: 'ch' }; break; case 24: /*! Production:: css_value : REMS */ this.$ = { type: 'RemValue', value: parseFloat(yyvstack[yysp]), unit: 'rem' }; break; case 25: /*! Production:: css_value : VHS */ this.$ = { type: 'VhValue', value: parseFloat(yyvstack[yysp]), unit: 'vh' }; break; case 26: /*! Production:: css_value : VWS */ this.$ = { type: 'VwValue', value: parseFloat(yyvstack[yysp]), unit: 'vw' }; break; case 27: /*! Production:: css_value : VMINS */ this.$ = { type: 'VminValue', value: parseFloat(yyvstack[yysp]), unit: 'vmin' }; break; case 28: /*! Production:: css_value : VMAXS */ this.$ = { type: 'VmaxValue', value: parseFloat(yyvstack[yysp]), unit: 'vmax' }; break; case 29: /*! Production:: css_value : PERCENTAGE */ this.$ = { type: 'PercentageValue', value: parseFloat(yyvstack[yysp]), unit: '%' }; break; case 30: /*! Production:: css_value : SUB css_value */ var prev = yyvstack[yysp]; prev.value *= -1; this.$ = prev; break; } }, table: bt({ len: u([ 24, 1, 5, 23, 1, 18, s, [0, 3], 1, s, [0, 16], s, [23, 4], c, [28, 3], 0, 0, 16, 1, 6, 6, s, [0, 3], 5, 1, 2, c, [37, 3], c, [20, 3], 5, 0, 0 ]), symbol: u([ 4, 7, 9, 11, 12, s, [15, 19, 1], 1, 1, s, [3, 4, 1], c, [30, 19], c, [29, 4], 7, 4, 10, 11, c, [22, 14], c, [19, 3], c, [43, 22], c, [23, 69], c, [139, 4], 8, c, [51, 24], 4, c, [138, 15], 13, c, [186, 5], 8, c, [6, 6], c, [5, 5], 9, 8, 14, c, [159, 47], c, [60, 10] ]), type: u([ s, [2, 19], s, [0, 5], 1, s, [2, 24], s, [0, 4], c, [22, 19], c, [43, 42], c, [23, 70], c, [28, 25], c, [45, 25], c, [113, 54] ]), state: u([ 1, 2, 8, 6, 7, 30, c, [4, 3], 33, 37, c, [5, 3], 38, c, [4, 3], 39, c, [4, 3], 40, c, [4, 3], 42, c, [21, 4], 50, c, [5, 3], 51, c, [4, 3] ]), mode: u([ s, [1, 179], s, [2, 3], c, [5, 5], c, [6, 4], s, [1, 57] ]), goto: u([ 5, 3, 4, 24, s, [9, 15, 1], s, [25, 5, 1], c, [24, 19], 31, 35, 32, 34, c, [18, 14], 36, c, [38, 19], c, [19, 57], c, [118, 4], 41, c, [24, 19], 43, 35, c, [16, 14], 44, s, [2, 3], 28, 29, 2, s, [3, 3], 28, 29, 3, c, [53, 4], s, [45, 5, 1], c, [100, 42], 52, c, [5, 4], 53 ]) }), defaultActions: bda({ idx: u([ 6, 7, 8, s, [10, 16, 1], 33, 34, 39, 40, 41, 45, 47, 52, 53 ]), goto: u([ 9, 10, 11, s, [16, 14, 1], 12, 1, 30, 13, s, [4, 4, 1], 14, 15, 8 ]) }), parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable) { if (typeof this.trace === 'function') { this.trace(str); } hash.destroy(); // destroy... well, *almost*! } else { if (typeof this.trace === 'function') { this.trace(str); } if (!ExceptionClass) { ExceptionClass = this.JisonParserError; } throw new ExceptionClass(str, hash); } }, parse: function parse(input) { var self = this; var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) var sstack = new Array(128); // state stack: stores states (column storage) var vstack = new Array(128); // semantic value stack var table = this.table; var sp = 0; // 'stack pointer': index into the stacks var symbol = 0; var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; var NO_ACTION = [0, 54 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { lexer = this.__lexer__; } else { lexer = this.__lexer__ = Object.create(this.lexer); } var sharedState_yy = { parseError: undefined, quoteName: undefined, lexer: undefined, parser: undefined, pre_parse: undefined, post_parse: undefined, pre_lex: undefined, post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; var ASSERT; if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; function shallow_copy_noclobber(dst, src) { for (var k in src) { if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { dst[k] = src[k]; } } } // copy state shallow_copy_noclobber(sharedState_yy, this.yy); sharedState_yy.lexer = lexer; sharedState_yy.parser = this; // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; } return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); }; } else { this.parseError = this.originalParseError; } // Does the shared state override the default `quoteName` that already comes with this instance? if (typeof sharedState_yy.quoteName === 'function') { this.quoteName = function quoteNameAlt(id_str) { return sharedState_yy.quoteName.call(this, id_str); }; } else { this.quoteName = this.originalQuoteName; } // set up the cleanup function; make it an API so that external code can re-use this one in case of // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which // case this parse() API method doesn't come with a `finally { ... }` block any more! // // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `sharedState`, etc. references will be *wrong*! this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { var rv; if (invoke_post_methods) { var hash; if (sharedState_yy.post_parse || this.post_parse) { // create an error hash info instance: we re-use this API in a **non-error situation** // as this one delivers all parser internals ready for access by userland code. hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); } if (sharedState_yy.post_parse) { rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); if (typeof rv !== 'undefined') resultValue = rv; } if (this.post_parse) { rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); if (typeof rv !== 'undefined') resultValue = rv; } // cleanup: if (hash && hash.destroy) { hash.destroy(); } } if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. // clean up the lingering lexer structures as well: if (lexer.cleanupAfterLex) { lexer.cleanupAfterLex(do_not_nuke_errorinfos); } // prevent lingering circular references from causing memory leaks: if (sharedState_yy) { sharedState_yy.lexer = undefined; sharedState_yy.parser = undefined; if (lexer.yy === sharedState_yy) { lexer.yy = undefined; } } sharedState_yy = undefined; this.parseError = this.originalParseError; this.quoteName = this.originalQuoteName; // nuke the vstack[] array at least as that one will still reference obsoleted user values. // To be safe, we nuke the other internal stack columns as well... stack.length = 0; // fastest way to nuke an array without overly bothering the GC sstack.length = 0; vstack.length = 0; sp = 0; // nuke the error hash info instances created during this run. // Userland code must COPY any data/references // in the error hash instance(s) it is more permanently interested in. if (!do_not_nuke_errorinfos) { for (var i = this.__error_infos.length - 1; i >= 0; i--) { var el = this.__error_infos[i]; if (el && typeof el.destroy === 'function') { el.destroy(); } } this.__error_infos.length = 0; } return resultValue; }; // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `lexer`, `sharedState`, etc. references will be *wrong*! this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { var pei = { errStr: msg, exception: ex, text: lexer.match, value: lexer.yytext, token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, expected: expected, recoverable: recoverable, state: state, action: action, new_state: newState, symbol_stack: stack, state_stack: sstack, value_stack: vstack, stack_pointer: sp, yy: sharedState_yy, lexer: lexer, parser: this, // and make sure the error info doesn't stay due to potential // ref cycle via userland code manipulations. // These would otherwise all be memory leak opportunities! // // Note that only array and object references are nuked as those // constitute the set of elements which can produce a cyclic ref. // The rest of the members is kept intact as they are harmless. destroy: function destructParseErrorInfo() { // remove cyclic references added to error info: // info.yy = null; // info.lexer = null; // info.value = null; // info.value_stack = null; // ... var rec = !!this.recoverable; for (var key in this) { if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } this.recoverable = rec; } }; // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! this.__error_infos.push(pei); return pei; }; function getNonTerminalFromCode(symbol) { var tokenName = self.getSymbolName(symbol); if (!tokenName) { tokenName = symbol; } return tokenName; } function stdLex() { var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token || EOF; } function fastLex() { var token = lexer.fastLex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token || EOF; } var lex = stdLex; var state, action, r, t; var yyval = { $: true, _$: undefined, yy: sharedState_yy }; var p; var yyrulelen; var this_production; var newState; var retval = false; try { this.__reentrant_call_depth++; lexer.setInput(input, sharedState_yy); // NOTE: we *assume* no lexer pre/post handlers are set up *after* // this initial `setInput()` call: hence we can now check and decide // whether we'll go with the standard, slower, lex() API or the // `fast_lex()` one: if (typeof lexer.canIUse === 'function') { var lexerInfo = lexer.canIUse(); if (lexerInfo.fastLex && typeof fastLex === 'function') { lex = fastLex; } } vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; ++sp; if (this.pre_parse) { this.pre_parse.call(this, sharedState_yy); } if (sharedState_yy.pre_parse) { sharedState_yy.pre_parse.call(this, sharedState_yy); } newState = sstack[sp - 1]; for (;;) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; // use default actions if available if (this.defaultActions[state]) { action = 2; newState = this.defaultActions[state]; } else { // The single `==` condition below covers both these `===` comparisons in a single // operation: // // if (symbol === null || typeof symbol === 'undefined') ... if (!symbol) { symbol = lex(); } // read action for current state and first input t = (table[state] && table[state][symbol]) || NO_ACTION; newState = t[1]; action = t[0]; // handle parse error if (!action) { var errStr; var errSymbolDescr = (this.describeSymbol(symbol) || symbol); var expected = this.collect_expected_token_set(state); // Report error if (typeof lexer.yylineno === 'number') { errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; } else { errStr = 'Parse error: '; } if (typeof lexer.showPosition === 'function') { errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; } if (expected.length) { errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; } else { errStr += 'Unexpected ' + errSymbolDescr; } // we cannot recover from the error! p = this.constructParseErrorInfo(errStr, null, expected, false); r = this.parseError(p.errStr, p, this.JisonParserError); if (typeof r !== 'undefined') { retval = r; } break; } } switch (action) { // catch misc. parse failures: default: // this shouldn't happen, unless resolve defaults are off if (action instanceof Array) { p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); r = this.parseError(p.errStr, p, this.JisonParserError); if (typeof r !== 'undefined') { retval = r; } break; } // Another case of better safe than sorry: in case state transitions come out of another error recovery process // or a buggy LUT (LookUp Table): p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); r = this.parseError(p.errStr, p, this.JisonParserError); if (typeof r !== 'undefined') { retval = r; } break; // shift: case 1: stack[sp] = symbol; vstack[sp] = lexer.yytext; sstack[sp] = newState; // push state ++sp; symbol = 0; // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: continue; // reduce: case 2: this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... yyrulelen = this_production[1]; r = this.performAction.call(yyval, newState, sp - 1, vstack); if (typeof r !== 'undefined') { retval = r; break; } // pop off stack sp -= yyrulelen; // don't overwrite the `symbol` variable: use a local var to speed things up: var ntsymbol = this_production[0]; // push nonterminal (reduce) stack[sp] = ntsymbol; vstack[sp] = yyval.$; // goto new state = table[STATE][NONTERMINAL] newState = table[sstack[sp - 1]][ntsymbol]; sstack[sp] = newState; ++sp; continue; // accept: case 3: if (sp !== -2) { retval = true; // Return the `$accept` rule's `$$` result, if available. // // Also note that JISON always adds this top-most `$accept` rule (with implicit, // default, action): // // $accept: $end // %{ $$ = $1; @$ = @1; %} // // which, combined with the parse kernel's `$accept` state behaviour coded below, // will produce the `$$` value output of the rule as the parse result, // IFF that result is *not* `undefined`. (See also the parser kernel code.) // // In code: // // %{ // @$ = @1; // if location tracking support is included // if (typeof $1 !== 'undefined') // return $1; // else // return true; // the default parse result if the rule actions don't produce anything // %} sp--; if (typeof vstack[sp] !== 'undefined') { retval = vstack[sp]; } } break; } // break out of loop: we accept or fail with error break; } } catch (ex) { // report exceptions through the parseError callback too, but keep the exception intact // if it is a known parser or lexer error which has been thrown by parseError() already: if (ex instanceof this.JisonParserError) { throw ex; } else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { throw ex; } p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); retval = false; r = this.parseError(p.errStr, p, this.JisonParserError); if (typeof r !== 'undefined') { retval = r; } } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; } // /finally return retval; } }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; /* lexer generated by jison-lex 0.6.1-215 */ /* * Returns a Lexer object of the following structure: * * Lexer: { * yy: {} The so-called "shared state" or rather the *source* of it; * the real "shared state" `yy` passed around to * the rule actions, etc. is a direct reference! * * This "shared context" object was passed to the lexer by way of * the `lexer.setInput(str, yy)` API before you may use it. * * This "shared context" object is passed to the lexer action code in `performAction()` * so userland code in the lexer actions may communicate with the outside world * and/or other lexer rules' actions in more or less complex ways. * * } * * Lexer.prototype: { * EOF: 1, * ERROR: 2, * * yy: The overall "shared context" object reference. * * JisonLexerError: function(msg, hash), * * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), * * The function parameters and `this` have the following value/meaning: * - `this` : reference to the `lexer` instance. * `yy_` is an alias for `this` lexer instance reference used internally. * * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer * by way of the `lexer.setInput(str, yy)` API before. * * Note: * The extra arguments you specified in the `%parse-param` statement in your * **parser** grammar definition file are passed to the lexer via this object * reference as member variables. * * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. * * - `YY_START`: the current lexer "start condition" state. * * parseError: function(str, hash, ExceptionClass), * * constructLexErrorInfo: function(error_message, is_recoverable), * Helper function. * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. * See it's use in this lexer kernel in many places; example usage: * * var infoObj = lexer.constructParseErrorInfo('fail!', true); * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); * * options: { ... lexer %options ... }, * * lex: function(), * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: * these extra `args...` are added verbatim to the `yy` object reference as member variables. * * WARNING: * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with * any attributes already added to `yy` by the **parser** or the jison run-time; * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * * cleanupAfterLex: function(do_not_nuke_errorinfos), * Helper function. * * This helper API is invoked when the **parse process** has completed: it is the responsibility * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. * * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. * * setInput: function(input, [yy]), * * * input: function(), * * * unput: function(str), * * * more: function(), * * * reject: function(), * * * less: function(n), * * * pastInput: function(n), * * * upcomingInput: function(n), * * * showPosition: function(), * * * test_match: function(regex_match_array, rule_index), * * * next: function(), * * * begin: function(condition), * * * pushState: function(condition), * * * popState: function(), * * * topState: function(), * * * _currentRules: function(), * * * stateStackSize: function(), * * * performAction: function(yy, yy_, yyrulenumber, YY_START), * * * rules: [...], * * * conditions: {associative list: name ==> set}, * } * * * token location info (`yylloc`): { * first_line: n, * last_line: n, * first_column: n, * last_column: n, * range: [start_number, end_number] * (where the numbers are indexes into the input string, zero-based) * } * * --- * * The `parseError` function receives a 'hash' object with these members for lexer errors: * * { * text: (matched text) * token: (the produced terminal token, if any) * token_id: (the produced terminal token numeric ID, if any) * line: (yylineno) * loc: (yylloc) * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule * available for this particular error) * yy: (object: the current parser internal "shared state" `yy` * as is also available in the rule actions; this can be used, * for instance, for advanced error analysis and reporting) * lexer: (reference to the current lexer instance used by the parser) * } * * while `this` will reference the current lexer instance. * * When `parseError` is invoked by the lexer, the default implementation will * attempt to invoke `yy.parser.parseError()`; when this callback is not provided * it will try to invoke `yy.parseError()` instead. When that callback is also not * provided, a `JisonLexerError` exception will be thrown containing the error * message and `hash`, as constructed by the `constructLexErrorInfo()` API. * * Note that the lexer's `JisonLexerError` error class is passed via the * `ExceptionClass` argument, which is invoked to construct the exception * instance to be thrown, so technically `parseError` will throw the object * produced by the `new ExceptionClass(str, hash)` JavaScript expression. * * --- * * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. * These options are available: * * (Options are permanent.) * * yy: { * parseError: function(str, hash, ExceptionClass) * optional: overrides the default `parseError` function. * } * * lexer.options: { * pre_lex: function() * optional: is invoked before the lexer is invoked to produce another token. * `this` refers to the Lexer object. * post_lex: function(token) { return token; } * optional: is invoked when the lexer has produced a token `token`; * this function can override the returned token value by returning another. * When it does not return any (truthy) value, the lexer will return * the original `token`. * `this` refers to the Lexer object. * * WARNING: the next set of options are not meant to be changed. They echo the abilities of * the lexer as per when it was compiled! * * ranges: boolean * optional: `true` ==> token location info will include a .range[] member. * flex: boolean * optional: `true` ==> flex-like lexing behaviour where the rules are tested * exhaustively to find the longest match. * backtrack_lexer: boolean * optional: `true` ==> lexer regexes are tested in order and for invoked; * the lexer terminates the scan when a token is returned by the action code. * xregexp: boolean * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the * `XRegExp` library. When this %option has not been specified at compile time, all lexer * rule regexes have been written as standard JavaScript RegExp expressions. * } */ var lexer = function() { /** * See also: * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility * with userland code which might access the derived class in a 'classic' way. * * @public * @constructor * @nocollapse */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, writable: false, value: 'JisonLexerError' }); if (msg == null) msg = '???'; Object.defineProperty(this, 'message', { enumerable: false, writable: true, value: msg }); this.hash = hash; var stacktrace; if (hash && hash.exception instanceof Error) { var ex2 = hash.exception; this.message = ex2.message || msg; stacktrace = ex2.stack; } if (!stacktrace) { if (Error.hasOwnProperty('captureStackTrace')) { // V8 Error.captureStackTrace(this, this.constructor); } else { stacktrace = new Error(msg).stack; } } if (stacktrace) { Object.defineProperty(this, 'stack', { enumerable: false, writable: false, value: stacktrace }); } } if (typeof Object.setPrototypeOf === 'function') { Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); } else { JisonLexerError.prototype = Object.create(Error.prototype); } JisonLexerError.prototype.constructor = JisonLexerError; JisonLexerError.prototype.name = 'JisonLexerError'; var lexer = { // Code Generator Information Report // --------------------------------- // // Options: // // backtracking: .................... false // location.ranges: ................. false // location line+column tracking: ... true // // // Forwarded Parser Analysis flags: // // uses yyleng: ..................... false // uses yylineno: ................... false // uses yytext: ..................... false // uses yylloc: ..................... false // uses lexer values: ............... true / true // location tracking: ............... false // location assignment: ............. false // // // Lexer Analysis flags: // // uses yyleng: ..................... ??? // uses yylineno: ................... ??? // uses yytext: ..................... ??? // uses yylloc: ..................... ??? // uses ParseError API: ............. ??? // uses yyerror: .................... ??? // uses location tracking & editing: ??? // uses more() API: ................. ??? // uses unput() API: ................ ??? // uses reject() API: ............... ??? // uses less() API: ................. ??? // uses display APIs pastInput(), upcomingInput(), showPosition(): // ............................. ??? // uses describeYYLLOC() API: ....... ??? // // --------- END OF REPORT ----------- EOF: 1, ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator // options: {}, /// <-- injected by the code generator // yy: ..., /// <-- injected by setInput() __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use done: false, /// INTERNAL USE ONLY _backtrack: false, /// INTERNAL USE ONLY _input: '', /// INTERNAL USE ONLY _more: false, /// INTERNAL USE ONLY _signaled_error_token: false, /// INTERNAL USE ONLY conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. * * @public * @this {RegExpLexer} */ constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { msg = '' + msg; // heuristic to determine if the error message already contains a (partial) source code dump // as produced by either `showPosition()` or `prettyPrintRange()`: if (show_input_position == undefined) { show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); } if (this.yylloc && show_input_position) { if (typeof this.prettyPrintRange === 'function') { var pretty_src = this.prettyPrintRange(this.yylloc); if (!/\n\s*$/.test(msg)) { msg += '\n'; } msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); } else if (typeof this.showPosition === 'function') { var pos_str = this.showPosition(); if (pos_str) { if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { msg += '\n' + pos_str; } else { msg += pos_str; } } } } /** @constructor */ var pei = { errStr: msg, recoverable: !!recoverable, text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, yy: this.yy, lexer: this, /** * and make sure the error info doesn't stay due to potential * ref cycle via userland code manipulations. * These would otherwise all be memory leak opportunities! * * Note that only array and object references are nuked as those * constitute the set of elements which can produce a cyclic ref. * The rest of the members is kept intact as they are harmless. * * @public * @this {LexErrorInfo} */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: // info.yy = null; // info.lexer = null; // ... var rec = !!this.recoverable; for (var key in this) { if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } this.recoverable = rec; } }; // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! this.__error_infos.push(pei); return pei; }, /** * handler which is invoked when a lexer error occurs. * * @public * @this {RegExpLexer} */ parseError: function lexer_parseError(str, hash, ExceptionClass) { if (!ExceptionClass) { ExceptionClass = this.JisonLexerError; } if (this.yy) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; } else if (typeof this.yy.parseError === 'function') { return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; } } throw new ExceptionClass(str, hash); }, /** * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. * * @public * @this {RegExpLexer} */ yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } var p = this.constructLexErrorInfo( 'Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable ); // Add any extra args to the hash under the name `extra_error_attributes`: var args = Array.prototype.slice.call(arguments, 1); if (args.length) { p.extra_error_attributes = args; } return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; }, /** * final cleanup function for when we have completed lexing the input; * make it an API so that external code can use this one once userland * code has decided it's time to destroy any lingering lexer error * hash object instances and the like: this function helps to clean * up these constructs, which *may* carry cyclic references which would * otherwise prevent the instances from being properly and timely * garbage-collected, i.e. this function helps prevent memory leaks! * * @public * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. // Userland code must COPY any data/references // in the error hash instance(s) it is more permanently interested in. if (!do_not_nuke_errorinfos) { for (var i = this.__error_infos.length - 1; i >= 0; i--) { var el = this.__error_infos[i]; if (el && typeof el.destroy === 'function') { el.destroy(); } } this.__error_infos.length = 0; } return this; }, /** * clear the lexer token context; intended for internal use only * * @public * @this {RegExpLexer} */ clear: function lexer_clear() { this.yytext = ''; this.yyleng = 0; this.match = ''; // - DO NOT reset `this.matched` this.matches = false; this._more = false; this._backtrack = false; var col = (this.yylloc ? this.yylloc.last_column : 0); this.yylloc = { first_line: this.yylineno + 1, first_column: col, last_line: this.yylineno + 1, last_column: col, range: [this.offset, this.offset] }; }, /** * resets the lexer, sets new input * * @public * @this {RegExpLexer} */ setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; // also check if we've fully initialized the lexer instance, // including expansion work to be done to go from a loaded // lexer to a usable lexer: if (!this.__decompressed) { // step 1: decompress the regex list: var rules = this.rules; for (var i = 0, len = rules.length; i < len; i++) { var rule_re = rules[i]; // compression: is the RE an xref to another RE slot in the rules[] table? if (typeof rule_re === 'number') { rules[i] = rules[rule_re]; } } // step 2: unfold the conditions[] set to make these ready for use: var conditions = this.conditions; for (var k in conditions) { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { var idx = rule_ids[i]; var rule_re = rules[idx]; rule_regexes[i + 1] = rule_re; rule_new_ids[i + 1] = idx; } spec.rules = rule_new_ids; spec.__rule_regexes = rule_regexes; spec.__rule_count = len; } this.__decompressed = true; } this._input = input || ''; this.clear(); this._signaled_error_token = false; this.done = false; this.yylineno = 0; this.matched = ''; this.conditionStack = ['INITIAL']; this.__currentRuleSet__ = null; this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0, range: [0, 0] }; this.offset = 0; return this; }, /** * edit the remaining input via user-specified callback. * This can be used to forward-adjust the input-to-parse, * e.g. inserting macro expansions and alike in the * input which has yet to be lexed. * The behaviour of this API contrasts the `unput()` et al * APIs as those act on the *consumed* input, while this * one allows one to manipulate the future, without impacting * the current `yyloc` cursor location or any history. * * Use this API to help implement C-preprocessor-like * `#include` statements, etc. * * The provided callback must be synchronous and is * expected to return the edited input (string). * * The `cpsArg` argument value is passed to the callback * as-is. * * `callback` interface: * `function callback(input, cpsArg)` * * - `input` will carry the remaining-input-to-lex string * from the lexer. * - `cpsArg` is `cpsArg` passed into this API. * * The `this` reference for the callback will be set to * reference this lexer instance so that userland code * in the callback can easily and quickly access any lexer * API. * * When the callback returns a non-string-type falsey value, * we assume the callback did not edit the input and we * will using the input as-is. * * When the callback returns a non-string-type value, it * is converted to a string for lexing via the `"" + retval` * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html * -- that way any returned object's `toValue()` and `toString()` * methods will be invoked in a proper/desirable order.) * * @public * @this {RegExpLexer} */ editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { var rv = callback.call(this, this._input, cpsArg); if (typeof rv !== 'string') { if (rv) { this._input = '' + rv; } // else: keep `this._input` as is. } else { this._input = rv; } return this; }, /** * consumes and returns one char from the input * * @public * @this {RegExpLexer} */ input: function lexer_input() { if (!this._input) { //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) return null; } var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; // Count the linenumber up when we hit the LF (or a stand-alone CR). // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo // and we advance immediately past the LF as well, returning both together as if // it was all a single 'character' only. var slice_len = 1; var lines = false; if (ch === '\n') { lines = true; } else if (ch === '\r') { lines = true; var ch2 = this._input[1]; if (ch2 === '\n') { slice_len++; ch += ch2; this.yytext += ch2; this.yyleng++; this.offset++; this.match += ch2; this.matched += ch2; this.yylloc.range[1]++; } } if (lines) { this.yylineno++; this.yylloc.last_line++; this.yylloc.last_column = 0; } else { this.yylloc.last_column++; } this.yylloc.range[1]++; this._input = this._input.slice(slice_len); return ch; }, /** * unshifts one char (or an entire string) into the input * * @public * @this {RegExpLexer} */ unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.yyleng = this.yytext.length; this.offset -= len; this.match = this.match.substr(0, this.match.length - len); this.matched = this.matched.substr(0, this.matched.length - len); if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; // Get last entirely matched line into the `pre_lines[]` array's // last index slot; we don't mind when other previously // matched lines end up in the array too. var pre = this.match; var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { pre = this.matched; pre_lines = pre.split(/(?:\r\n?|\n)/g); } this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; } else { this.yylloc.last_column -= len; } this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; this.done = false; return this; }, /** * cache matched text and append it on next action * * @public * @this {RegExpLexer} */ more: function lexer_more() { this._more = true; return this; }, /** * signal the lexer that this rule fails to match the input, so the * next matching rule (regex) should be tested instead. * * @public * @this {RegExpLexer} */ reject: function lexer_reject() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. var lineno_msg = ''; if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } var p = this.constructLexErrorInfo( 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false ); this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } return this; }, /** * retain first n characters of the match * * @public * @this {RegExpLexer} */ less: function lexer_less(n) { return this.unput(this.match.slice(n)); }, /** * return (part of the) already matched input, i.e. for error * messages. * * Limit the returned string length to `maxSize` (default: 20). * * Limit the returned string to the `maxLines` number of lines of * input (default: 1). * * Negative limit values equal *unlimited*. * * @public * @this {RegExpLexer} */ pastInput: function lexer_pastInput(maxSize, maxLines) { var past = this.matched.substring(0, this.matched.length - this.match.length); if (maxSize < 0) maxSize = past.length; else if (!maxSize) maxSize = 20; if (maxLines < 0) maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; // `substr` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: past = past.substr(-maxSize * 2 - 2); // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: var a = past.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(-maxLines); past = a.join('\n'); // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis prefix... if (past.length > maxSize) { past = '...' + past.substr(-maxSize); } return past; }, /** * return (part of the) upcoming input, i.e. for error messages. * * Limit the returned string length to `maxSize` (default: 20). * * Limit the returned string to the `maxLines` number of lines of input (default: 1). * * Negative limit values equal *unlimited*. * * > ### NOTE ### * > * > *"upcoming input"* is defined as the whole of the both * > the *currently lexed* input, together with any remaining input * > following that. *"currently lexed"* input is the input * > already recognized by the lexer but not yet returned with * > the lexer token. This happens when you are invoking this API * > from inside any lexer rule action code block. * > * * @public * @this {RegExpLexer} */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; if (maxSize < 0) maxSize = next.length + this._input.length; else if (!maxSize) maxSize = 20; if (maxLines < 0) maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; // `substring` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: var a = next.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(0, maxLines); next = a.join('\n'); // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis postfix... if (next.length > maxSize) { next = next.substring(0, maxSize) + '...'; } return next; }, /** * return a string which displays the character position where the * lexing error occurred, i.e. for error messages * * @public * @this {RegExpLexer} */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); var c = new Array(pre.length + 1).join('-'); return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; }, /** * return an YYLLOC info object derived off the given context (actual, preceding, following, current). * Use this method when the given `actual` location is not guaranteed to exist (i.e. when * it MAY be NULL) and you MUST have a valid location info object anyway: * then we take the given context of the `preceding` and `following` locations, IFF those are available, * and reconstruct the `actual` location info from those. * If this fails, the heuristic is to take the `current` location, IFF available. * If this fails as well, we assume the sought location is at/around the current lexer position * and then produce that one as a response. DO NOTE that these heuristic/derived location info * values MAY be inaccurate! * * NOTE: `deriveLocationInfo()` ALWAYS produces a location info object *copy* of `actual`, not just * a *reference* hence all input location objects can be assumed to be 'constant' (function has no side-effects). * * @public * @this {RegExpLexer} */ deriveLocationInfo: function lexer_deriveYYLLOC(actual, preceding, following, current) { var loc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0, range: [0, 0] }; if (actual) { loc.first_line = actual.first_line | 0; loc.last_line = actual.last_line | 0; loc.first_column = actual.first_column | 0; loc.last_column = actual.last_column | 0; if (actual.range) { loc.range[0] = actual.range[0] | 0; loc.range[1] = actual.range[1] | 0; } } if (loc.first_line <= 0 || loc.last_line < loc.first_line) { // plan B: heuristic using preceding and following: if (loc.first_line <= 0 && preceding) { loc.first_line = preceding.last_line | 0; loc.first_column = preceding.last_column | 0; if (preceding.range) { loc.range[0] = actual.range[1] | 0; } } if ((loc.last_line <= 0 || loc.last_line < loc.first_line) && following) { loc.last_line = following.first_line | 0; loc.last_column = following.first_column | 0; if (following.range) { loc.range[1] = actual.range[0] | 0; } } // plan C?: see if the 'current' location is useful/sane too: if (loc.first_line <= 0 && current && (loc.last_line <= 0 || current.last_line <= loc.last_line)) { loc.first_line = current.first_line | 0; loc.first_column = current.first_column | 0; if (current.range) { loc.range[0] = current.range[0] | 0; } } if (loc.last_line <= 0 && current && (loc.first_line <= 0 || current.first_line >= loc.first_line)) { loc.last_line = current.last_line | 0; loc.last_column = current.last_column | 0; if (current.range) { loc.range[1] = current.range[1] | 0; } } } // sanitize: fix last_line BEFORE we fix first_line as we use the 'raw' value of the latter // or plan D heuristics to produce a 'sensible' last_line value: if (loc.last_line <= 0) { if (loc.first_line <= 0) { loc.first_line = this.yylloc.first_line; loc.last_line = this.yylloc.last_line; loc.first_column = this.yylloc.first_column; loc.last_column = this.yylloc.last_column; loc.range[0] = this.yylloc.range[0]; loc.range[1] = this.yylloc.range[1]; } else { loc.last_line = this.yylloc.last_line; loc.last_column = this.yylloc.last_column; loc.range[1] = this.yylloc.range[1]; } } if (loc.first_line <= 0) { loc.first_line = loc.last_line; loc.first_column = 0; // loc.last_column; loc.range[1] = loc.range[0]; } if (loc.first_column < 0) { loc.first_column = 0; } if (loc.last_column < 0) { loc.last_column = (loc.first_column > 0 ? loc.first_column : 80); } return loc; }, /** * return a string which displays the lines & columns of input which are referenced * by the given location info range, plus a few lines of context. * * This function pretty-prints the indicated section of the input, with line numbers * and everything! * * This function is very useful to provide highly readable error reports, while * the location range may be specified in various flexible ways: * * - `loc` is the location info object which references the area which should be * displayed and 'marked up': these lines & columns of text are marked up by `^` * characters below each character in the entire input range. * * - `context_loc` is the *optional* location info object which instructs this * pretty-printer how much *leading* context should be displayed alongside * the area referenced by `loc`. This can help provide context for the displayed * error, etc. * * When this location info is not provided, a default context of 3 lines is * used. * * - `context_loc2` is another *optional* location info object, which serves * a similar purpose to `context_loc`: it specifies the amount of *trailing* * context lines to display in the pretty-print output. * * When this location info is not provided, a default context of 1 line only is * used. * * Special Notes: * * - when the `loc`-indicated range is very large (about 5 lines or more), then * only the first and last few lines of this block are printed while a * `...continued...` message will be printed between them. * * This serves the purpose of not printing a huge amount of text when the `loc` * range happens to be huge: this way a manageable & readable output results * for arbitrary large ranges. * * - this function can display lines of input which whave not yet been lexed. * `prettyPrintRange()` can access the entire input! * * @public * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { loc = this.deriveLocationInfo(loc, context_loc, context_loc2); const CONTEXT = 3; const CONTEXT_TAIL = 1; const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; var ws_prefix = new Array(lineno_display_width).join(' '); var nonempty_line_indexes = []; var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); var offset = 2 + 1; var len = 0; if (lno === loc.first_line) { offset += loc.first_column; len = Math.max( 2, ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 ); } else if (lno === loc.last_line) { len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { len = Math.max(2, line.length + 1); } if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } } rv = rv.replace(/\t/g, ' '); return rv; }); // now make sure we don't print an overly large amount of error area: limit it // to the top and bottom line count: if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); } return rv.join('\n'); }, /** * helper function, used to produce a human readable description as a string, given * the input `yylloc` location object. * * Set `display_range_too` to TRUE to include the string character index position(s) * in the description if the `yylloc.range` is available. * * @public * @this {RegExpLexer} */ describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; var l2 = yylloc.last_line; var c1 = yylloc.first_column; var c2 = yylloc.last_column; var dl = l2 - l1; var dc = c2 - c1; var rv; if (dl === 0) { rv = 'line ' + l1 + ', '; if (dc <= 1) { rv += 'column ' + c1; } else { rv += 'columns ' + c1 + ' .. ' + c2; } } else { rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; } if (yylloc.range && display_range_too) { var r1 = yylloc.range[0]; var r2 = yylloc.range[1] - 1; if (r2 <= r1) { rv += ' {String Offset: ' + r1 + '}'; } else { rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; } } return rv; }, /** * test the lexed token: return FALSE when not a match, otherwise return token. * * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` * contains the actually matched text string. * * Also move the input cursor forward and update the match collectors: * * - `yytext` * - `yyleng` * - `match` * - `matches` * - `yylloc` * - `offset` * * @public * @this {RegExpLexer} */ test_match: function lexer_test_match(match, indexed_rule) { var token, lines, backup, match_str, match_str_len; if (this.options.backtrack_lexer) { // save context backup = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, last_line: this.yylloc.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column, range: this.yylloc.range.slice(0) }, yytext: this.yytext, match: this.match, matches: this.matches, matched: this.matched, yyleng: this.yyleng, offset: this.offset, _more: this._more, _input: this._input, //_signaled_error_token: this._signaled_error_token, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; } match_str = match[0]; match_str_len = match_str.length; // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { lines = match_str.split(/(?:\r\n?|\n)/g); if (lines.length > 1) { this.yylineno += lines.length - 1; this.yylloc.last_line = this.yylineno + 1; this.yylloc.last_column = lines[lines.length - 1].length; } else { this.yylloc.last_column += match_str_len; } // } this.yytext += match_str; this.match += match_str; this.matched += match_str; this.matches = match; this.yyleng = this.yytext.length; this.yylloc.range[1] += match_str_len; // previous lex rules MAY have invoked the `more()` API rather than producing a token: // those rules will already have moved this `offset` forward matching their match lengths, // hence we must only add our own match length now: this.offset += match_str_len; this._more = false; this._backtrack = false; this._input = this._input.slice(match_str_len); // calling this method: // // function lexer__performAction(yy, yyrulenumber, YY_START) {...} token = this.performAction.call( this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ ); // otherwise, when the action codes are all simple return token statements: //token = this.simpleCaseActionClusters[indexed_rule]; if (this.done && this._input) { this.done = false; } if (token) { return token; } else if (this._backtrack) { // recover context for (var k in backup) { this[k] = backup[k]; } this.__currentRuleSet__ = null; return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { // produce one 'error' token as `.parseError()` in `reject()` // did not guarantee a failure signal by throwing an exception! token = this._signaled_error_token; this._signaled_error_token = false; return token; } return false; }, /** * return next match in input * * @public * @this {RegExpLexer} */ next: function lexer_next() { if (this.done) { this.clear(); return this.EOF; } if (!this._input) { this.done = true; } var token, match, tempMatch, index; if (!this._more) { this.clear(); } var spec = this.__currentRuleSet__; if (!spec) { // Update the ruleset cache as we apparently encountered a state change or just started lexing. // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps // speed up those activities a tiny bit. spec = this.__currentRuleSet__ = this._currentRules(); // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { var lineno_msg = ''; if (this.options.trackPosition) { lineno_msg = ' on line ' + (this.yylineno + 1); } var p = this.constructLexErrorInfo( 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false ); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } } var rule_ids = spec.rules; var regexes = spec.__rule_regexes; var len = spec.__rule_count; // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! for (var i = 1; i <= len; i++) { tempMatch = this._input.match(regexes[i]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rule_ids[i]); if (token !== false) { return token; } else if (this._backtrack) { match = undefined; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } } else if (!this.options.flex) { break; } } } if (match) { token = this.test_match(match, rule_ids[index]); if (token !== false) { return token; } // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } if (!this._input) { this.done = true; this.clear(); return this.EOF; } else { var lineno_msg = ''; if (this.options.trackPosition) { lineno_msg = ' on line ' + (this.yylineno + 1); } var p = this.constructLexErrorInfo( 'Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable ); var pendingInput = this._input; var activeCondition = this.topState(); var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` // has not consumed/modified any pending input or changed state in the error handler: if (!this.matches && // and make sure the input has been modified/consumed ... pendingInput === this._input && // ...or the lexer state has been modified significantly enough // to merit a non-consuming error handling action right now. activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } return token; } }, /** * return next match that has a token * * @public * @this {RegExpLexer} */ lex: function lexer_lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: if (typeof this.pre_lex === 'function') { r = this.pre_lex.call(this, 0); } if (typeof this.options.pre_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.pre_lex.call(this, r) || r; } if (this.yy && typeof this.yy.pre_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.yy.pre_lex.call(this, r) || r; } while (!r) { r = this.next(); } if (this.yy && typeof this.yy.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.yy.post_lex.call(this, r) || r; } if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; } if (typeof this.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.post_lex.call(this, r) || r; } return r; }, /** * return next match that has a token. Identical to the `lex()` API but does not invoke any of the * `pre_lex()` nor any of the `post_lex()` callbacks. * * @public * @this {RegExpLexer} */ fastLex: function lexer_fastLex() { var r; while (!r) { r = this.next(); } return r; }, /** * return info about the lexer state that can help a parser or other lexer API user to use the * most efficient means available. This API is provided to aid run-time performance for larger * systems which employ this lexer. * * @public * @this {RegExpLexer} */ canIUse: function lexer_canIUse() { var rv = { fastLex: !(typeof this.pre_lex === 'function' || typeof this.options.pre_lex === 'function' || this.yy && typeof this.yy.pre_lex === 'function' || this.yy && typeof this.yy.post_lex === 'function' || typeof this.options.post_lex === 'function' || typeof this.post_lex === 'function') && typeof this.fastLex === 'function' }; return rv; }, /** * backwards compatible alias for `pushState()`; * the latter is symmetrical with `popState()` and we advise to use * those APIs in any modern lexer code, rather than `begin()`. * * @public * @this {RegExpLexer} */ begin: function lexer_begin(condition) { return this.pushState(condition); }, /** * activates a new lexer condition state (pushes the new lexer * condition state onto the condition stack) * * @public * @this {RegExpLexer} */ pushState: function lexer_pushState(condition) { this.conditionStack.push(condition); this.__currentRuleSet__ = null; return this; }, /** * pop the previously active lexer condition state off the condition * stack * * @public * @this {RegExpLexer} */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; if (n > 0) { this.__currentRuleSet__ = null; return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, /** * return the currently active lexer condition state; when an index * argument is provided it produces the N-th previous condition state, * if available * * @public * @this {RegExpLexer} */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; } else { return 'INITIAL'; } }, /** * (internal) determine the lexer rule set which is active for the * currently active lexer condition state * * @public * @this {RegExpLexer} */ _currentRules: function lexer__currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; } else { return this.conditions['INITIAL']; } }, /** * return the number of states currently on the stack * * @public * @this {RegExpLexer} */ stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, options: { trackPosition: true }, JisonLexerError: JisonLexerError, performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { var yy_ = this; var YYSTATE = YY_START; switch (yyrulenumber) { case 1: /*! Conditions:: INITIAL */ /*! Rule:: \s+ */ /* skip whitespace */ break; default: return this.simpleCaseActionClusters[yyrulenumber]; } }, simpleCaseActionClusters: { /*! Conditions:: INITIAL */ /*! Rule:: (--[0-9a-z-A-Z-]*) */ 0: 13, /*! Conditions:: INITIAL */ /*! Rule:: \* */ 2: 5, /*! Conditions:: INITIAL */ /*! Rule:: \/ */ 3: 6, /*! Conditions:: INITIAL */ /*! Rule:: \+ */ 4: 3, /*! Conditions:: INITIAL */ /*! Rule:: - */ 5: 4, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)px\b */ 6: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)cm\b */ 7: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)mm\b */ 8: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)in\b */ 9: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)pt\b */ 10: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)pc\b */ 11: 15, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)deg\b */ 12: 16, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)grad\b */ 13: 16, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)rad\b */ 14: 16, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)turn\b */ 15: 16, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)s\b */ 16: 17, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ms\b */ 17: 17, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)Hz\b */ 18: 18, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)kHz\b */ 19: 18, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dpi\b */ 20: 19, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dpcm\b */ 21: 19, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dppx\b */ 22: 19, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)em\b */ 23: 20, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ex\b */ 24: 21, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ch\b */ 25: 22, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)rem\b */ 26: 23, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vw\b */ 27: 25, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vh\b */ 28: 24, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vmin\b */ 29: 26, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vmax\b */ 30: 27, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)% */ 31: 28, /*! Conditions:: INITIAL */ /*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)\b */ 32: 11, /*! Conditions:: INITIAL */ /*! Rule:: (calc) */ 33: 9, /*! Conditions:: INITIAL */ /*! Rule:: (var) */ 34: 12, /*! Conditions:: INITIAL */ /*! Rule:: ([a-z]+) */ 35: 10, /*! Conditions:: INITIAL */ /*! Rule:: \( */ 36: 7, /*! Conditions:: INITIAL */ /*! Rule:: \) */ 37: 8, /*! Conditions:: INITIAL */ /*! Rule:: , */ 38: 14, /*! Conditions:: INITIAL */ /*! Rule:: $ */ 39: 1 }, rules: [ /* 0: */ /^(?:(--[\d\-A-Za-z]*))/, /* 1: */ /^(?:\s+)/, /* 2: */ /^(?:\*)/, /* 3: */ /^(?:\/)/, /* 4: */ /^(?:\+)/, /* 5: */ /^(?:-)/, /* 6: */ /^(?:(\d+(\.\d*)?|\.\d+)px\b)/, /* 7: */ /^(?:(\d+(\.\d*)?|\.\d+)cm\b)/, /* 8: */ /^(?:(\d+(\.\d*)?|\.\d+)mm\b)/, /* 9: */ /^(?:(\d+(\.\d*)?|\.\d+)in\b)/, /* 10: */ /^(?:(\d+(\.\d*)?|\.\d+)pt\b)/, /* 11: */ /^(?:(\d+(\.\d*)?|\.\d+)pc\b)/, /* 12: */ /^(?:(\d+(\.\d*)?|\.\d+)deg\b)/, /* 13: */ /^(?:(\d+(\.\d*)?|\.\d+)grad\b)/, /* 14: */ /^(?:(\d+(\.\d*)?|\.\d+)rad\b)/, /* 15: */ /^(?:(\d+(\.\d*)?|\.\d+)turn\b)/, /* 16: */ /^(?:(\d+(\.\d*)?|\.\d+)s\b)/, /* 17: */ /^(?:(\d+(\.\d*)?|\.\d+)ms\b)/, /* 18: */ /^(?:(\d+(\.\d*)?|\.\d+)Hz\b)/, /* 19: */ /^(?:(\d+(\.\d*)?|\.\d+)kHz\b)/, /* 20: */ /^(?:(\d+(\.\d*)?|\.\d+)dpi\b)/, /* 21: */ /^(?:(\d+(\.\d*)?|\.\d+)dpcm\b)/, /* 22: */ /^(?:(\d+(\.\d*)?|\.\d+)dppx\b)/, /* 23: */ /^(?:(\d+(\.\d*)?|\.\d+)em\b)/, /* 24: */ /^(?:(\d+(\.\d*)?|\.\d+)ex\b)/, /* 25: */ /^(?:(\d+(\.\d*)?|\.\d+)ch\b)/, /* 26: */ /^(?:(\d+(\.\d*)?|\.\d+)rem\b)/, /* 27: */ /^(?:(\d+(\.\d*)?|\.\d+)vw\b)/, /* 28: */ /^(?:(\d+(\.\d*)?|\.\d+)vh\b)/, /* 29: */ /^(?:(\d+(\.\d*)?|\.\d+)vmin\b)/, /* 30: */ /^(?:(\d+(\.\d*)?|\.\d+)vmax\b)/, /* 31: */ /^(?:(\d+(\.\d*)?|\.\d+)%)/, /* 32: */ /^(?:(\d+(\.\d*)?|\.\d+)\b)/, /* 33: */ /^(?:(calc))/, /* 34: */ /^(?:(var))/, /* 35: */ /^(?:([a-z]+))/, /* 36: */ /^(?:\()/, /* 37: */ /^(?:\))/, /* 38: */ /^(?:,)/, /* 39: */ /^(?:$)/ ], conditions: { 'INITIAL': { rules: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ], inclusive: true } } }; return lexer; }(); parser.lexer = lexer; function Parser() { this.yy = {}; } Parser.prototype = parser; parser.Parser = Parser; return new Parser(); })(); if (true) { exports.parser = parser; exports.Parser = parser.Parser; exports.parse = function () { return parser.parse.apply(parser, arguments); }; } /***/ }), /***/ 6204: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* UAParser.js v0.7.36 Copyright © 2012-2021 Faisal Salman MIT License */ (function(window,undefined){"use strict";var LIBVERSION="0.7.36",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded",UA_MAX_LENGTH=350;var AMAZON="Amazon",APPLE="Apple",ASUS="ASUS",BLACKBERRY="BlackBerry",BROWSER="Browser",CHROME="Chrome",EDGE="Edge",FIREFOX="Firefox",GOOGLE="Google",HUAWEI="Huawei",LG="LG",MICROSOFT="Microsoft",MOTOROLA="Motorola",OPERA="Opera",SAMSUNG="Samsung",SHARP="Sharp",SONY="Sony",VIERA="Viera",XIAOMI="Xiaomi",ZEBRA="Zebra",FACEBOOK="Facebook",CHROMIUM_OS="Chromium OS",MAC_OS="Mac OS";var extend=function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},enumerize=function(arr){var enums={};for(var i=0;i0){if(q.length===2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length===3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length===4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},strMapper=function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j2){_device[MODEL]="iPad";_device[TYPE]=TABLET}return _device};this.getEngine=function(){var _engine={};_engine[NAME]=undefined;_engine[VERSION]=undefined;rgxMapper.call(_engine,_ua,_rgxmap.engine);return _engine};this.getOS=function(){var _os={};_os[NAME]=undefined;_os[VERSION]=undefined;rgxMapper.call(_os,_ua,_rgxmap.os);if(_isSelfNav&&!_os[NAME]&&_uach&&_uach.platform!="Unknown"){_os[NAME]=_uach.platform.replace(/chrome os/i,CHROMIUM_OS).replace(/macos/i,MAC_OS)}return _os};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return _ua};this.setUA=function(ua){_ua=typeof ua===STR_TYPE&&ua.length>UA_MAX_LENGTH?trim(ua,UA_MAX_LENGTH):ua;return this};this.setUA(_ua);return this};UAParser.VERSION=LIBVERSION;UAParser.BROWSER=enumerize([NAME,VERSION,MAJOR]);UAParser.CPU=enumerize([ARCHITECTURE]);UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,CONSOLE,MOBILE,SMARTTV,TABLET,WEARABLE,EMBEDDED]);UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]);if(typeof exports!==UNDEF_TYPE){if("object"!==UNDEF_TYPE&&module.exports){exports=module.exports=UAParser}exports.UAParser=UAParser}else{if("function"===FUNC_TYPE&&__webpack_require__.amdO){!(__WEBPACK_AMD_DEFINE_RESULT__ = (function(){return UAParser}).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))}else if(typeof window!==UNDEF_TYPE){window.UAParser=UAParser}}var $=typeof window!==UNDEF_TYPE&&(window.jQuery||window.Zepto);if($&&!$.ua){var parser=new UAParser;$.ua=parser.getResult();$.ua.get=function(){return parser.getUA()};$.ua.set=function(ua){parser.setUA(ua);var result=parser.getResult();for(var prop in result){$.ua[prop]=result[prop]}}}})(typeof window==="object"?window:this); /***/ }), /***/ 8315: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; "use client"; var _interopRequireDefault = __webpack_require__(4994); __webpack_unused_export__ = ({ value: true }); exports.A = void 0; var _createSvgIcon = _interopRequireDefault(__webpack_require__(9650)); var _jsxRuntime = __webpack_require__(4848); var _default = exports.A = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }), 'Close'); /***/ }), /***/ 9650: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; 'use client'; Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "default", ({ enumerable: true, get: function () { return _utils.createSvgIcon; } })); var _utils = __webpack_require__(6147); /***/ }), /***/ 4434: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ styles_createTheme; } }); // UNUSED EXPORTS: createMuiTheme // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js var objectWithoutPropertiesLoose = __webpack_require__(8587); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js var formatMuiErrorMessage = __webpack_require__(799); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/deepmerge/deepmerge.js var deepmerge = __webpack_require__(3479); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js + 5 modules var defaultSxConfig = __webpack_require__(9058); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js var styleFunctionSx = __webpack_require__(2733); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/createTheme.js + 2 modules var createTheme = __webpack_require__(9731); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/createMixins.js function createMixins(breakpoints, mixins) { return (0,esm_extends/* default */.A)({ toolbar: { minHeight: 56, [breakpoints.up('xs')]: { '@media (orientation: landscape)': { minHeight: 48 } }, [breakpoints.up('sm')]: { minHeight: 64 } } }, mixins); } // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/colorManipulator.js var colorManipulator = __webpack_require__(2937); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/common.js const common = { black: '#000', white: '#fff' }; /* harmony default export */ var colors_common = (common); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/grey.js const grey = { 50: '#fafafa', 100: '#f5f5f5', 200: '#eeeeee', 300: '#e0e0e0', 400: '#bdbdbd', 500: '#9e9e9e', 600: '#757575', 700: '#616161', 800: '#424242', 900: '#212121', A100: '#f5f5f5', A200: '#eeeeee', A400: '#bdbdbd', A700: '#616161' }; /* harmony default export */ var colors_grey = (grey); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/purple.js const purple = { 50: '#f3e5f5', 100: '#e1bee7', 200: '#ce93d8', 300: '#ba68c8', 400: '#ab47bc', 500: '#9c27b0', 600: '#8e24aa', 700: '#7b1fa2', 800: '#6a1b9a', 900: '#4a148c', A100: '#ea80fc', A200: '#e040fb', A400: '#d500f9', A700: '#aa00ff' }; /* harmony default export */ var colors_purple = (purple); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/red.js const red = { 50: '#ffebee', 100: '#ffcdd2', 200: '#ef9a9a', 300: '#e57373', 400: '#ef5350', 500: '#f44336', 600: '#e53935', 700: '#d32f2f', 800: '#c62828', 900: '#b71c1c', A100: '#ff8a80', A200: '#ff5252', A400: '#ff1744', A700: '#d50000' }; /* harmony default export */ var colors_red = (red); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/orange.js const orange = { 50: '#fff3e0', 100: '#ffe0b2', 200: '#ffcc80', 300: '#ffb74d', 400: '#ffa726', 500: '#ff9800', 600: '#fb8c00', 700: '#f57c00', 800: '#ef6c00', 900: '#e65100', A100: '#ffd180', A200: '#ffab40', A400: '#ff9100', A700: '#ff6d00' }; /* harmony default export */ var colors_orange = (orange); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/blue.js const blue = { 50: '#e3f2fd', 100: '#bbdefb', 200: '#90caf9', 300: '#64b5f6', 400: '#42a5f5', 500: '#2196f3', 600: '#1e88e5', 700: '#1976d2', 800: '#1565c0', 900: '#0d47a1', A100: '#82b1ff', A200: '#448aff', A400: '#2979ff', A700: '#2962ff' }; /* harmony default export */ var colors_blue = (blue); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/lightBlue.js const lightBlue = { 50: '#e1f5fe', 100: '#b3e5fc', 200: '#81d4fa', 300: '#4fc3f7', 400: '#29b6f6', 500: '#03a9f4', 600: '#039be5', 700: '#0288d1', 800: '#0277bd', 900: '#01579b', A100: '#80d8ff', A200: '#40c4ff', A400: '#00b0ff', A700: '#0091ea' }; /* harmony default export */ var colors_lightBlue = (lightBlue); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/colors/green.js const green = { 50: '#e8f5e9', 100: '#c8e6c9', 200: '#a5d6a7', 300: '#81c784', 400: '#66bb6a', 500: '#4caf50', 600: '#43a047', 700: '#388e3c', 800: '#2e7d32', 900: '#1b5e20', A100: '#b9f6ca', A200: '#69f0ae', A400: '#00e676', A700: '#00c853' }; /* harmony default export */ var colors_green = (green); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/createPalette.js const _excluded = ["mode", "contrastThreshold", "tonalOffset"]; const light = { // The colors used to style the text. text: { // The most important text. primary: 'rgba(0, 0, 0, 0.87)', // Secondary text. secondary: 'rgba(0, 0, 0, 0.6)', // Disabled text have even lower visual prominence. disabled: 'rgba(0, 0, 0, 0.38)' }, // The color used to divide different elements. divider: 'rgba(0, 0, 0, 0.12)', // The background colors used to style the surfaces. // Consistency between these values is important. background: { paper: colors_common.white, default: colors_common.white }, // The colors used to style the action elements. action: { // The color of an active action like an icon button. active: 'rgba(0, 0, 0, 0.54)', // The color of an hovered action. hover: 'rgba(0, 0, 0, 0.04)', hoverOpacity: 0.04, // The color of a selected action. selected: 'rgba(0, 0, 0, 0.08)', selectedOpacity: 0.08, // The color of a disabled action. disabled: 'rgba(0, 0, 0, 0.26)', // The background color of a disabled action. disabledBackground: 'rgba(0, 0, 0, 0.12)', disabledOpacity: 0.38, focus: 'rgba(0, 0, 0, 0.12)', focusOpacity: 0.12, activatedOpacity: 0.12 } }; const dark = { text: { primary: colors_common.white, secondary: 'rgba(255, 255, 255, 0.7)', disabled: 'rgba(255, 255, 255, 0.5)', icon: 'rgba(255, 255, 255, 0.5)' }, divider: 'rgba(255, 255, 255, 0.12)', background: { paper: '#121212', default: '#121212' }, action: { active: colors_common.white, hover: 'rgba(255, 255, 255, 0.08)', hoverOpacity: 0.08, selected: 'rgba(255, 255, 255, 0.16)', selectedOpacity: 0.16, disabled: 'rgba(255, 255, 255, 0.3)', disabledBackground: 'rgba(255, 255, 255, 0.12)', disabledOpacity: 0.38, focus: 'rgba(255, 255, 255, 0.12)', focusOpacity: 0.12, activatedOpacity: 0.24 } }; function addLightOrDark(intent, direction, shade, tonalOffset) { const tonalOffsetLight = tonalOffset.light || tonalOffset; const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5; if (!intent[direction]) { if (intent.hasOwnProperty(shade)) { intent[direction] = intent[shade]; } else if (direction === 'light') { intent.light = (0,colorManipulator/* lighten */.a)(intent.main, tonalOffsetLight); } else if (direction === 'dark') { intent.dark = (0,colorManipulator/* darken */.e$)(intent.main, tonalOffsetDark); } } } function getDefaultPrimary(mode = 'light') { if (mode === 'dark') { return { main: colors_blue[200], light: colors_blue[50], dark: colors_blue[400] }; } return { main: colors_blue[700], light: colors_blue[400], dark: colors_blue[800] }; } function getDefaultSecondary(mode = 'light') { if (mode === 'dark') { return { main: colors_purple[200], light: colors_purple[50], dark: colors_purple[400] }; } return { main: colors_purple[500], light: colors_purple[300], dark: colors_purple[700] }; } function getDefaultError(mode = 'light') { if (mode === 'dark') { return { main: colors_red[500], light: colors_red[300], dark: colors_red[700] }; } return { main: colors_red[700], light: colors_red[400], dark: colors_red[800] }; } function getDefaultInfo(mode = 'light') { if (mode === 'dark') { return { main: colors_lightBlue[400], light: colors_lightBlue[300], dark: colors_lightBlue[700] }; } return { main: colors_lightBlue[700], light: colors_lightBlue[500], dark: colors_lightBlue[900] }; } function getDefaultSuccess(mode = 'light') { if (mode === 'dark') { return { main: colors_green[400], light: colors_green[300], dark: colors_green[700] }; } return { main: colors_green[800], light: colors_green[500], dark: colors_green[900] }; } function getDefaultWarning(mode = 'light') { if (mode === 'dark') { return { main: colors_orange[400], light: colors_orange[300], dark: colors_orange[700] }; } return { main: '#ed6c02', // closest to orange[800] that pass 3:1. light: colors_orange[500], dark: colors_orange[900] }; } function createPalette(palette) { const { mode = 'light', contrastThreshold = 3, tonalOffset = 0.2 } = palette, other = (0,objectWithoutPropertiesLoose/* default */.A)(palette, _excluded); const primary = palette.primary || getDefaultPrimary(mode); const secondary = palette.secondary || getDefaultSecondary(mode); const error = palette.error || getDefaultError(mode); const info = palette.info || getDefaultInfo(mode); const success = palette.success || getDefaultSuccess(mode); const warning = palette.warning || getDefaultWarning(mode); // Use the same logic as // Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59 // and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54 function getContrastText(background) { const contrastText = (0,colorManipulator/* getContrastRatio */.eM)(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary; if (false) {} return contrastText; } const augmentColor = ({ color, name, mainShade = 500, lightShade = 300, darkShade = 700 }) => { color = (0,esm_extends/* default */.A)({}, color); if (!color.main && color[mainShade]) { color.main = color[mainShade]; } if (!color.hasOwnProperty('main')) { throw new Error( false ? 0 : (0,formatMuiErrorMessage/* default */.A)(11, name ? ` (${name})` : '', mainShade)); } if (typeof color.main !== 'string') { throw new Error( false ? 0 : (0,formatMuiErrorMessage/* default */.A)(12, name ? ` (${name})` : '', JSON.stringify(color.main))); } addLightOrDark(color, 'light', lightShade, tonalOffset); addLightOrDark(color, 'dark', darkShade, tonalOffset); if (!color.contrastText) { color.contrastText = getContrastText(color.main); } return color; }; const modes = { dark, light }; if (false) {} const paletteOutput = (0,deepmerge/* default */.A)((0,esm_extends/* default */.A)({ // A collection of common colors. common: (0,esm_extends/* default */.A)({}, colors_common), // prevent mutable object. // The palette mode, can be light or dark. mode, // The colors used to represent primary interface elements for a user. primary: augmentColor({ color: primary, name: 'primary' }), // The colors used to represent secondary interface elements for a user. secondary: augmentColor({ color: secondary, name: 'secondary', mainShade: 'A400', lightShade: 'A200', darkShade: 'A700' }), // The colors used to represent interface elements that the user should be made aware of. error: augmentColor({ color: error, name: 'error' }), // The colors used to represent potentially dangerous actions or important messages. warning: augmentColor({ color: warning, name: 'warning' }), // The colors used to present information to the user that is neutral and not necessarily important. info: augmentColor({ color: info, name: 'info' }), // The colors used to indicate the successful completion of an action that user triggered. success: augmentColor({ color: success, name: 'success' }), // The grey colors. grey: colors_grey, // Used by `getContrastText()` to maximize the contrast between // the background and the text. contrastThreshold, // Takes a background color and returns the text color that maximizes the contrast. getContrastText, // Generate a rich color object. augmentColor, // Used by the functions below to shift a color's luminance by approximately // two indexes within its tonal palette. // E.g., shift from Red 500 to Red 300 or Red 700. tonalOffset }, modes[mode]), other); return paletteOutput; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/createTypography.js const createTypography_excluded = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"]; function round(value) { return Math.round(value * 1e5) / 1e5; } const caseAllCaps = { textTransform: 'uppercase' }; const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif'; /** * @see @link{https://m2.material.io/design/typography/the-type-system.html} * @see @link{https://m2.material.io/design/typography/understanding-typography.html} */ function createTypography(palette, typography) { const _ref = typeof typography === 'function' ? typography(palette) : typography, { fontFamily = defaultFontFamily, // The default font size of the Material Specification. fontSize = 14, // px fontWeightLight = 300, fontWeightRegular = 400, fontWeightMedium = 500, fontWeightBold = 700, // Tell MUI what's the font-size on the html element. // 16px is the default font-size used by browsers. htmlFontSize = 16, // Apply the CSS properties to all the variants. allVariants, pxToRem: pxToRem2 } = _ref, other = (0,objectWithoutPropertiesLoose/* default */.A)(_ref, createTypography_excluded); if (false) {} const coef = fontSize / 14; const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`); const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => (0,esm_extends/* default */.A)({ fontFamily, fontWeight, fontSize: pxToRem(size), // Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/ lineHeight }, fontFamily === defaultFontFamily ? { letterSpacing: `${round(letterSpacing / size)}em` } : {}, casing, allVariants); const variants = { h1: buildVariant(fontWeightLight, 96, 1.167, -1.5), h2: buildVariant(fontWeightLight, 60, 1.2, -0.5), h3: buildVariant(fontWeightRegular, 48, 1.167, 0), h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25), h5: buildVariant(fontWeightRegular, 24, 1.334, 0), h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15), subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15), subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1), body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15), body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15), button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps), caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4), overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps), // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types. inherit: { fontFamily: 'inherit', fontWeight: 'inherit', fontSize: 'inherit', lineHeight: 'inherit', letterSpacing: 'inherit' } }; return (0,deepmerge/* default */.A)((0,esm_extends/* default */.A)({ htmlFontSize, pxToRem, fontFamily, fontSize, fontWeightLight, fontWeightRegular, fontWeightMedium, fontWeightBold }, variants), other, { clone: false // No need to clone deep }); } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/shadows.js const shadowKeyUmbraOpacity = 0.2; const shadowKeyPenumbraOpacity = 0.14; const shadowAmbientShadowOpacity = 0.12; function createShadow(...px) { return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(','); } // Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)]; /* harmony default export */ var styles_shadows = (shadows); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/createTransitions.js var createTransitions = __webpack_require__(4757); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/zIndex.js // We need to centralize the zIndex definitions as they work // like global values in the browser. const zIndex = { mobileStepper: 1000, fab: 1050, speedDial: 1050, appBar: 1100, drawer: 1200, modal: 1300, snackbar: 1400, tooltip: 1500 }; /* harmony default export */ var styles_zIndex = (zIndex); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/createTheme.js const createTheme_excluded = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"]; function createTheme_createTheme(options = {}, ...args) { const { mixins: mixinsInput = {}, palette: paletteInput = {}, transitions: transitionsInput = {}, typography: typographyInput = {} } = options, other = (0,objectWithoutPropertiesLoose/* default */.A)(options, createTheme_excluded); if (options.vars) { throw new Error( false ? 0 : (0,formatMuiErrorMessage/* default */.A)(18)); } const palette = createPalette(paletteInput); const systemTheme = (0,createTheme/* default */.A)(options); let muiTheme = (0,deepmerge/* default */.A)(systemTheme, { mixins: createMixins(systemTheme.breakpoints, mixinsInput), palette, // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol. shadows: styles_shadows.slice(), typography: createTypography(palette, typographyInput), transitions: (0,createTransitions/* default */.Ay)(transitionsInput), zIndex: (0,esm_extends/* default */.A)({}, styles_zIndex) }); muiTheme = (0,deepmerge/* default */.A)(muiTheme, other); muiTheme = args.reduce((acc, argument) => (0,deepmerge/* default */.A)(acc, argument), muiTheme); if (false) {} muiTheme.unstable_sxConfig = (0,esm_extends/* default */.A)({}, defaultSxConfig/* default */.A, other == null ? void 0 : other.unstable_sxConfig); muiTheme.unstable_sx = function sx(props) { return (0,styleFunctionSx/* default */.A)({ sx: props, theme: this }); }; return muiTheme; } let warnedOnce = false; function createMuiTheme(...args) { if (false) {} return createTheme_createTheme(...args); } /* harmony default export */ var styles_createTheme = (createTheme_createTheme); /***/ }), /***/ 4757: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Ay: function() { return /* binding */ createTransitions; }, /* harmony export */ p0: function() { return /* binding */ duration; } /* harmony export */ }); /* unused harmony export easing */ /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8587); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8168); const _excluded = ["duration", "easing", "delay"]; // Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves // to learn the context in which each easing should be used. const easing = { // This is the most common easing curve. easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)', // Objects enter the screen at full velocity from off-screen and // slowly decelerate to a resting point. easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)', // Objects leave the screen at full velocity. They do not decelerate when off-screen. easeIn: 'cubic-bezier(0.4, 0, 1, 1)', // The sharp curve is used by objects that may return to the screen at any time. sharp: 'cubic-bezier(0.4, 0, 0.6, 1)' }; // Follow https://m2.material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations // to learn when use what timing const duration = { shortest: 150, shorter: 200, short: 250, // most basic recommended timing standard: 300, // this is to be used in complex animations complex: 375, // recommended when something is entering screen enteringScreen: 225, // recommended when something is leaving screen leavingScreen: 195 }; function formatMs(milliseconds) { return `${Math.round(milliseconds)}ms`; } function getAutoHeightDuration(height) { if (!height) { return 0; } const constant = height / 36; // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10 return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10); } function createTransitions(inputTransitions) { const mergedEasing = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, easing, inputTransitions.easing); const mergedDuration = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, duration, inputTransitions.duration); const create = (props = ['all'], options = {}) => { const { duration: durationOption = mergedDuration.standard, easing: easingOption = mergedEasing.easeInOut, delay = 0 } = options, other = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(options, _excluded); if (false) {} return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(','); }; return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({ getAutoHeightDuration, create }, inputTransitions, { easing: mergedEasing, duration: mergedDuration }); } /***/ }), /***/ 7199: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _createTheme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4434); 'use client'; const defaultTheme = (0,_createTheme__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(); /* harmony default export */ __webpack_exports__.A = (defaultTheme); /***/ }), /***/ 346: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; /* harmony default export */ __webpack_exports__.A = ('$$material'); /***/ }), /***/ 5740: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _slotShouldForwardProp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1292); const rootShouldForwardProp = prop => (0,_slotShouldForwardProp__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(prop) && prop !== 'classes'; /* harmony default export */ __webpack_exports__.A = (rootShouldForwardProp); /***/ }), /***/ 1292: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; // copied from @mui/system/createStyled function slotShouldForwardProp(prop) { return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as'; } /* harmony default export */ __webpack_exports__.A = (slotShouldForwardProp); /***/ }), /***/ 3874: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_system_createStyled__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1603); /* harmony import */ var _defaultTheme__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7199); /* harmony import */ var _identifier__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(346); /* harmony import */ var _rootShouldForwardProp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5740); 'use client'; const styled = (0,_mui_system_createStyled__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Ay)({ themeId: _identifier__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A, defaultTheme: _defaultTheme__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A, rootShouldForwardProp: _rootShouldForwardProp__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A }); /* harmony default export */ __webpack_exports__.Ay = (styled); /***/ }), /***/ 1863: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ useThemeProps; } /* harmony export */ }); /* harmony import */ var _mui_system_useThemeProps__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(511); /* harmony import */ var _defaultTheme__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7199); /* harmony import */ var _identifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(346); 'use client'; function useThemeProps({ props, name }) { return (0,_mui_system_useThemeProps__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({ props, name, defaultTheme: _defaultTheme__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A, themeId: _identifier__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A }); } /***/ }), /***/ 2040: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(985); /* harmony default export */ __webpack_exports__.A = (_mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 793: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ createSvgIcon; } }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js var objectWithoutPropertiesLoose = __webpack_require__(8587); // EXTERNAL MODULE: ./node_modules/prop-types/index.js var prop_types = __webpack_require__(5556); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/clsx/dist/clsx.m.js var clsx_m = __webpack_require__(4609); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/composeClasses/composeClasses.js var composeClasses = __webpack_require__(7453); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/capitalize.js var capitalize = __webpack_require__(2040); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/useThemeProps.js var useThemeProps = __webpack_require__(1863); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/styles/styled.js var styled = __webpack_require__(3874); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js var generateUtilityClasses = __webpack_require__(7135); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js var generateUtilityClass = __webpack_require__(6467); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/SvgIcon/svgIconClasses.js function getSvgIconUtilityClass(slot) { return (0,generateUtilityClass/* default */.Ay)('MuiSvgIcon', slot); } const svgIconClasses = (0,generateUtilityClasses/* default */.A)('MuiSvgIcon', ['root', 'colorPrimary', 'colorSecondary', 'colorAction', 'colorError', 'colorDisabled', 'fontSizeInherit', 'fontSizeSmall', 'fontSizeMedium', 'fontSizeLarge']); /* harmony default export */ var SvgIcon_svgIconClasses = ((/* unused pure expression or super */ null && (svgIconClasses))); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(4848); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/SvgIcon/SvgIcon.js 'use client'; const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"]; const useUtilityClasses = ownerState => { const { color, fontSize, classes } = ownerState; const slots = { root: ['root', color !== 'inherit' && `color${(0,capitalize/* default */.A)(color)}`, `fontSize${(0,capitalize/* default */.A)(fontSize)}`] }; return (0,composeClasses/* default */.A)(slots, getSvgIconUtilityClass, classes); }; const SvgIconRoot = (0,styled/* default */.Ay)('svg', { name: 'MuiSvgIcon', slot: 'Root', overridesResolver: (props, styles) => { const { ownerState } = props; return [styles.root, ownerState.color !== 'inherit' && styles[`color${(0,capitalize/* default */.A)(ownerState.color)}`], styles[`fontSize${(0,capitalize/* default */.A)(ownerState.fontSize)}`]]; } })(({ theme, ownerState }) => { var _theme$transitions, _theme$transitions$cr, _theme$transitions2, _theme$typography, _theme$typography$pxT, _theme$typography2, _theme$typography2$px, _theme$typography3, _theme$typography3$px, _palette$ownerState$c, _palette, _palette2, _palette3; return { userSelect: 'none', width: '1em', height: '1em', display: 'inline-block', // the will define the property that has `currentColor` // for example heroicons uses fill="none" and stroke="currentColor" fill: ownerState.hasSvgAsChild ? undefined : 'currentColor', flexShrink: 0, transition: (_theme$transitions = theme.transitions) == null || (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', { duration: (_theme$transitions2 = theme.transitions) == null || (_theme$transitions2 = _theme$transitions2.duration) == null ? void 0 : _theme$transitions2.shorter }), fontSize: { inherit: 'inherit', small: ((_theme$typography = theme.typography) == null || (_theme$typography$pxT = _theme$typography.pxToRem) == null ? void 0 : _theme$typography$pxT.call(_theme$typography, 20)) || '1.25rem', medium: ((_theme$typography2 = theme.typography) == null || (_theme$typography2$px = _theme$typography2.pxToRem) == null ? void 0 : _theme$typography2$px.call(_theme$typography2, 24)) || '1.5rem', large: ((_theme$typography3 = theme.typography) == null || (_theme$typography3$px = _theme$typography3.pxToRem) == null ? void 0 : _theme$typography3$px.call(_theme$typography3, 35)) || '2.1875rem' }[ownerState.fontSize], // TODO v5 deprecate, v6 remove for sx color: (_palette$ownerState$c = (_palette = (theme.vars || theme).palette) == null || (_palette = _palette[ownerState.color]) == null ? void 0 : _palette.main) != null ? _palette$ownerState$c : { action: (_palette2 = (theme.vars || theme).palette) == null || (_palette2 = _palette2.action) == null ? void 0 : _palette2.active, disabled: (_palette3 = (theme.vars || theme).palette) == null || (_palette3 = _palette3.action) == null ? void 0 : _palette3.disabled, inherit: undefined }[ownerState.color] }; }); const SvgIcon = /*#__PURE__*/react.forwardRef(function SvgIcon(inProps, ref) { const props = (0,useThemeProps/* default */.A)({ props: inProps, name: 'MuiSvgIcon' }); const { children, className, color = 'inherit', component = 'svg', fontSize = 'medium', htmlColor, inheritViewBox = false, titleAccess, viewBox = '0 0 24 24' } = props, other = (0,objectWithoutPropertiesLoose/* default */.A)(props, _excluded); const hasSvgAsChild = /*#__PURE__*/react.isValidElement(children) && children.type === 'svg'; const ownerState = (0,esm_extends/* default */.A)({}, props, { color, component, fontSize, instanceFontSize: inProps.fontSize, inheritViewBox, viewBox, hasSvgAsChild }); const more = {}; if (!inheritViewBox) { more.viewBox = viewBox; } const classes = useUtilityClasses(ownerState); return /*#__PURE__*/(0,jsx_runtime.jsxs)(SvgIconRoot, (0,esm_extends/* default */.A)({ as: component, className: (0,clsx_m/* default */.A)(classes.root, className), focusable: "false", color: htmlColor, "aria-hidden": titleAccess ? undefined : true, role: titleAccess ? 'img' : undefined, ref: ref }, more, other, hasSvgAsChild && children.props, { ownerState: ownerState, children: [hasSvgAsChild ? children.props.children : children, titleAccess ? /*#__PURE__*/(0,jsx_runtime.jsx)("title", { children: titleAccess }) : null] })); }); false ? 0 : void 0; SvgIcon.muiName = 'SvgIcon'; /* harmony default export */ var SvgIcon_SvgIcon = (SvgIcon); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/createSvgIcon.js 'use client'; /** * Private module reserved for @mui packages. */ function createSvgIcon(path, displayName) { function Component(props, ref) { return /*#__PURE__*/(0,jsx_runtime.jsx)(SvgIcon_SvgIcon, (0,esm_extends/* default */.A)({ "data-testid": `${displayName}Icon`, ref: ref }, props, { children: path })); } if (false) {} Component.muiName = SvgIcon_SvgIcon.muiName; return /*#__PURE__*/react.memo( /*#__PURE__*/react.forwardRef(Component)); } /***/ }), /***/ 7181: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9379); /* harmony default export */ __webpack_exports__.A = (_mui_utils_debounce__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 6147: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { capitalize: function() { return /* reexport */ capitalize/* default */.A; }, createChainedFunction: function() { return /* reexport */ utils_createChainedFunction; }, createSvgIcon: function() { return /* reexport */ createSvgIcon/* default */.A; }, debounce: function() { return /* reexport */ debounce/* default */.A; }, deprecatedPropType: function() { return /* reexport */ utils_deprecatedPropType; }, isMuiElement: function() { return /* reexport */ isMuiElement/* default */.A; }, ownerDocument: function() { return /* reexport */ ownerDocument/* default */.A; }, ownerWindow: function() { return /* reexport */ ownerWindow/* default */.A; }, requirePropFactory: function() { return /* reexport */ utils_requirePropFactory; }, setRef: function() { return /* reexport */ utils_setRef; }, unstable_ClassNameGenerator: function() { return /* binding */ unstable_ClassNameGenerator; }, unstable_useEnhancedEffect: function() { return /* reexport */ useEnhancedEffect/* default */.A; }, unstable_useId: function() { return /* reexport */ utils_useId; }, unsupportedProp: function() { return /* reexport */ utils_unsupportedProp; }, useControlled: function() { return /* reexport */ useControlled/* default */.A; }, useEventCallback: function() { return /* reexport */ useEventCallback/* default */.A; }, useForkRef: function() { return /* reexport */ useForkRef/* default */.A; }, useIsFocusVisible: function() { return /* reexport */ useIsFocusVisible/* default */.A; } }); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js var ClassNameGenerator = __webpack_require__(913); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/capitalize.js var capitalize = __webpack_require__(2040); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js var createChainedFunction = __webpack_require__(4067); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/createChainedFunction.js /* harmony default export */ var utils_createChainedFunction = (createChainedFunction/* default */.A); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/createSvgIcon.js + 2 modules var createSvgIcon = __webpack_require__(793); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/debounce.js var debounce = __webpack_require__(7181); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType.js function deprecatedPropType(validator, reason) { if (true) { return () => null; } return (props, propName, componentName, location, propFullName) => { const componentNameSafe = componentName || '<>'; const propFullNameSafe = propFullName || propName; if (typeof props[propName] !== 'undefined') { return new Error(`The ${location} \`${propFullNameSafe}\` of ` + `\`${componentNameSafe}\` is deprecated. ${reason}`); } return null; }; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/deprecatedPropType.js /* harmony default export */ var utils_deprecatedPropType = (deprecatedPropType); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/isMuiElement.js + 1 modules var isMuiElement = __webpack_require__(5223); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/ownerDocument.js var ownerDocument = __webpack_require__(3294); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/ownerWindow.js var ownerWindow = __webpack_require__(7375); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory.js function requirePropFactory(componentNameInError, Component) { if (true) { return () => null; } // eslint-disable-next-line react/forbid-foreign-prop-types const prevPropTypes = Component ? (0,esm_extends/* default */.A)({}, Component.propTypes) : null; const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => { const propFullNameSafe = propFullName || propName; const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe]; if (defaultTypeChecker) { const typeCheckerResult = defaultTypeChecker(props, propName, componentName, location, propFullName, ...args); if (typeCheckerResult) { return typeCheckerResult; } } if (typeof props[propName] !== 'undefined' && !props[requiredProp]) { return new Error(`The prop \`${propFullNameSafe}\` of ` + `\`${componentNameInError}\` can only be used together with the \`${requiredProp}\` prop.`); } return null; }; return requireProp; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/requirePropFactory.js /* harmony default export */ var utils_requirePropFactory = (requirePropFactory); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/setRef/setRef.js var setRef = __webpack_require__(207); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/setRef.js /* harmony default export */ var utils_setRef = (setRef/* default */.A); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useEnhancedEffect.js var useEnhancedEffect = __webpack_require__(5504); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useId/useId.js var useId = __webpack_require__(5311); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useId.js 'use client'; /* harmony default export */ var utils_useId = (useId/* default */.A); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp.js function unsupportedProp(props, propName, componentName, location, propFullName) { if (true) { return null; } const propFullNameSafe = propFullName || propName; if (typeof props[propName] !== 'undefined') { return new Error(`The prop \`${propFullNameSafe}\` is not supported. Please remove it.`); } return null; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/unsupportedProp.js /* harmony default export */ var utils_unsupportedProp = (unsupportedProp); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useControlled.js + 1 modules var useControlled = __webpack_require__(9727); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useEventCallback.js var useEventCallback = __webpack_require__(1476); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useForkRef.js var useForkRef = __webpack_require__(6982); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useIsFocusVisible.js + 1 modules var useIsFocusVisible = __webpack_require__(7266); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/index.js 'use client'; // TODO: remove this export once ClassNameGenerator is stable // eslint-disable-next-line @typescript-eslint/naming-convention const unstable_ClassNameGenerator = { configure: generator => { if (false) {} ClassNameGenerator/* default */.A.configure(generator); } }; /***/ }), /***/ 5223: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ utils_isMuiElement; } }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js function isMuiElement(element, muiNames) { var _muiName, _element$type; return /*#__PURE__*/react.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName // relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45 // eslint-disable-next-line no-underscore-dangle (_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/isMuiElement.js /* harmony default export */ var utils_isMuiElement = (isMuiElement); /***/ }), /***/ 3294: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_ownerDocument__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8183); /* harmony default export */ __webpack_exports__.A = (_mui_utils_ownerDocument__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 7375: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_ownerWindow__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2327); /* harmony default export */ __webpack_exports__.A = (_mui_utils_ownerWindow__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 9727: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ utils_useControlled; } }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useControlled/useControlled.js 'use client'; /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */ function useControlled({ controlled, default: defaultProp, name, state = 'value' }) { // isControlled is ignored in the hook dependency lists as it should never change. const { current: isControlled } = react.useRef(controlled !== undefined); const [valueState, setValue] = react.useState(defaultProp); const value = isControlled ? controlled : valueState; if (false) {} const setValueIfUncontrolled = react.useCallback(newValue => { if (!isControlled) { setValue(newValue); } }, []); return [value, setValueIfUncontrolled]; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useControlled.js 'use client'; /* harmony default export */ var utils_useControlled = (useControlled); /***/ }), /***/ 5504: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_useEnhancedEffect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2723); 'use client'; /* harmony default export */ __webpack_exports__.A = (_mui_utils_useEnhancedEffect__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 1476: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_useEventCallback__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1885); 'use client'; /* harmony default export */ __webpack_exports__.A = (_mui_utils_useEventCallback__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 6982: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_useForkRef__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4061); 'use client'; /* harmony default export */ __webpack_exports__.A = (_mui_utils_useForkRef__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A); /***/ }), /***/ 7266: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ utils_useIsFocusVisible; } }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useTimeout/useTimeout.js + 2 modules var useTimeout = __webpack_require__(478); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useIsFocusVisible/useIsFocusVisible.js 'use client'; // based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js let hadKeyboardEvent = true; let hadFocusVisibleRecently = false; const hadFocusVisibleRecentlyTimeout = new useTimeout/* Timeout */.E(); const inputTypesWhitelist = { text: true, search: true, url: true, tel: true, email: true, password: true, number: true, date: true, month: true, week: true, time: true, datetime: true, 'datetime-local': true }; /** * Computes whether the given element should automatically trigger the * `focus-visible` class being added, i.e. whether it should always match * `:focus-visible` when focused. * @param {Element} node * @returns {boolean} */ function focusTriggersKeyboardModality(node) { const { type, tagName } = node; if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) { return true; } if (tagName === 'TEXTAREA' && !node.readOnly) { return true; } if (node.isContentEditable) { return true; } return false; } /** * Keep track of our keyboard modality state with `hadKeyboardEvent`. * If the most recent user interaction was via the keyboard; * and the key press did not include a meta, alt/option, or control key; * then the modality is keyboard. Otherwise, the modality is not keyboard. * @param {KeyboardEvent} event */ function handleKeyDown(event) { if (event.metaKey || event.altKey || event.ctrlKey) { return; } hadKeyboardEvent = true; } /** * If at any point a user clicks with a pointing device, ensure that we change * the modality away from keyboard. * This avoids the situation where a user presses a key on an already focused * element, and then clicks on a different element, focusing it with a * pointing device, while we still think we're in keyboard modality. */ function handlePointerDown() { hadKeyboardEvent = false; } function handleVisibilityChange() { if (this.visibilityState === 'hidden') { // If the tab becomes active again, the browser will handle calling focus // on the element (Safari actually calls it twice). // If this tab change caused a blur on an element with focus-visible, // re-apply the class when the user switches back to the tab. if (hadFocusVisibleRecently) { hadKeyboardEvent = true; } } } function prepare(doc) { doc.addEventListener('keydown', handleKeyDown, true); doc.addEventListener('mousedown', handlePointerDown, true); doc.addEventListener('pointerdown', handlePointerDown, true); doc.addEventListener('touchstart', handlePointerDown, true); doc.addEventListener('visibilitychange', handleVisibilityChange, true); } function teardown(doc) { doc.removeEventListener('keydown', handleKeyDown, true); doc.removeEventListener('mousedown', handlePointerDown, true); doc.removeEventListener('pointerdown', handlePointerDown, true); doc.removeEventListener('touchstart', handlePointerDown, true); doc.removeEventListener('visibilitychange', handleVisibilityChange, true); } function isFocusVisible(event) { const { target } = event; try { return target.matches(':focus-visible'); } catch (error) { // Browsers not implementing :focus-visible will throw a SyntaxError. // We use our own heuristic for those browsers. // Rethrow might be better if it's not the expected error but do we really // want to crash if focus-visible malfunctioned? } // No need for validFocusTarget check. The user does that by attaching it to // focusable events only. return hadKeyboardEvent || focusTriggersKeyboardModality(target); } function useIsFocusVisible() { const ref = react.useCallback(node => { if (node != null) { prepare(node.ownerDocument); } }, []); const isFocusVisibleRef = react.useRef(false); /** * Should be called if a blur event is fired */ function handleBlurVisible() { // checking against potential state variable does not suffice if we focus and blur synchronously. // React wouldn't have time to trigger a re-render so `focusVisible` would be stale. // Ideally we would adjust `isFocusVisible(event)` to look at `relatedTarget` for blur events. // This doesn't work in IE11 due to https://github.com/facebook/react/issues/3751 // TODO: check again if React releases their internal changes to focus event handling (https://github.com/facebook/react/pull/19186). if (isFocusVisibleRef.current) { // To detect a tab/window switch, we look for a blur event followed // rapidly by a visibility change. // If we don't see a visibility change within 100ms, it's probably a // regular focus change. hadFocusVisibleRecently = true; hadFocusVisibleRecentlyTimeout.start(100, () => { hadFocusVisibleRecently = false; }); isFocusVisibleRef.current = false; return true; } return false; } /** * Should be called if a blur event is fired */ function handleFocusVisible(event) { if (isFocusVisible(event)) { isFocusVisibleRef.current = true; return true; } return false; } return { isFocusVisibleRef, onFocus: handleFocusVisible, onBlur: handleBlurVisible, ref }; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/material/utils/useIsFocusVisible.js 'use client'; /* harmony default export */ var utils_useIsFocusVisible = (useIsFocusVisible); /***/ }), /***/ 2722: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ GlobalStyles; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5556); /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8361); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4848); 'use client'; function isEmpty(obj) { return obj === undefined || obj === null || Object.keys(obj).length === 0; } function GlobalStyles(props) { const { styles, defaultTheme = {} } = props; const globalStyles = typeof styles === 'function' ? themeInput => styles(isEmpty(themeInput) ? defaultTheme : themeInput) : styles; return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_emotion_react__WEBPACK_IMPORTED_MODULE_3__/* .Global */ .mL, { styles: globalStyles }); } false ? 0 : void 0; /***/ }), /***/ 3033: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { GlobalStyles: function() { return /* reexport */ GlobalStyles/* default */.A; }, StyledEngineProvider: function() { return /* reexport */ StyledEngineProvider; }, ThemeContext: function() { return /* reexport */ emotion_element_c39617d8_browser_esm.T; }, css: function() { return /* reexport */ emotion_react_browser_esm/* css */.AH; }, "default": function() { return /* binding */ styled; }, internal_processStyles: function() { return /* binding */ internal_processStyles; }, keyframes: function() { return /* reexport */ emotion_react_browser_esm/* keyframes */.i7; } }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js var is_prop_valid_browser_esm = __webpack_require__(5165); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js var emotion_element_c39617d8_browser_esm = __webpack_require__(7424); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js var emotion_utils_browser_esm = __webpack_require__(1957); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js + 1 modules var emotion_serialize_browser_esm = __webpack_require__(5018); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js var emotion_use_insertion_effect_with_fallbacks_browser_esm = __webpack_require__(6243); ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js var testOmitPropsOnStringTag = is_prop_valid_browser_esm/* default */.A; var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { return key !== 'theme'; }; var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { return typeof tag === 'string' && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; }; var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) { var shouldForwardProp; if (options) { var optionsShouldForwardProp = options.shouldForwardProp; shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) { return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName); } : optionsShouldForwardProp; } if (typeof shouldForwardProp !== 'function' && isReal) { shouldForwardProp = tag.__emotion_forwardProp; } return shouldForwardProp; }; var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; var Insertion = function Insertion(_ref) { var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag; (0,emotion_utils_browser_esm/* registerStyles */.SF)(cache, serialized, isStringTag); (0,emotion_use_insertion_effect_with_fallbacks_browser_esm/* useInsertionEffectAlwaysWithSyncFallback */.s)(function () { return (0,emotion_utils_browser_esm/* insertStyles */.sk)(cache, serialized, isStringTag); }); return null; }; var createStyled = function createStyled(tag, options) { if (false) {} var isReal = tag.__emotion_real === tag; var baseTag = isReal && tag.__emotion_base || tag; var identifierName; var targetClassName; if (options !== undefined) { identifierName = options.label; targetClassName = options.target; } var shouldForwardProp = composeShouldForwardProps(tag, options, isReal); var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); var shouldUseAs = !defaultShouldForwardProp('as'); return function () { var args = arguments; var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; if (identifierName !== undefined) { styles.push("label:" + identifierName + ";"); } if (args[0] == null || args[0].raw === undefined) { styles.push.apply(styles, args); } else { if (false) {} styles.push(args[0][0]); var len = args.length; var i = 1; for (; i < len; i++) { if (false) {} styles.push(args[i], args[0][i]); } } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class var Styled = (0,emotion_element_c39617d8_browser_esm.w)(function (props, cache, ref) { var FinalTag = shouldUseAs && props.as || baseTag; var className = ''; var classInterpolations = []; var mergedProps = props; if (props.theme == null) { mergedProps = {}; for (var key in props) { mergedProps[key] = props[key]; } mergedProps.theme = react.useContext(emotion_element_c39617d8_browser_esm.T); } if (typeof props.className === 'string') { className = (0,emotion_utils_browser_esm/* getRegisteredStyles */.Rk)(cache.registered, classInterpolations, props.className); } else if (props.className != null) { className = props.className + " "; } var serialized = (0,emotion_serialize_browser_esm/* serializeStyles */.J)(styles.concat(classInterpolations), cache.registered, mergedProps); className += cache.key + "-" + serialized.name; if (targetClassName !== undefined) { className += " " + targetClassName; } var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp; var newProps = {}; for (var _key in props) { if (shouldUseAs && _key === 'as') continue; if ( // $FlowFixMe finalShouldForwardProp(_key)) { newProps[_key] = props[_key]; } } newProps.className = className; newProps.ref = ref; return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(Insertion, { cache: cache, serialized: serialized, isStringTag: typeof FinalTag === 'string' }), /*#__PURE__*/react.createElement(FinalTag, newProps)); }); Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; Styled.defaultProps = tag.defaultProps; Styled.__emotion_real = Styled; Styled.__emotion_base = baseTag; Styled.__emotion_styles = styles; Styled.__emotion_forwardProp = shouldForwardProp; Object.defineProperty(Styled, 'toString', { value: function value() { if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string return "." + targetClassName; } }); Styled.withComponent = function (nextTag, nextOptions) { return createStyled(nextTag, (0,esm_extends/* default */.A)({}, options, nextOptions, { shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true) })).apply(void 0, styles); }; return Styled; }; }; ;// CONCATENATED MODULE: ../../modules/ui/code/core/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.js var tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; var newStyled = createStyled.bind(); tags.forEach(function (tagName) { // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type newStyled[tagName] = newStyled(tagName); }); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/react/dist/emotion-react.browser.esm.js var emotion_react_browser_esm = __webpack_require__(8361); // EXTERNAL MODULE: ./node_modules/prop-types/index.js var prop_types = __webpack_require__(5556); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js + 7 modules var emotion_cache_browser_esm = __webpack_require__(6112); // EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js var jsx_runtime = __webpack_require__(4848); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js 'use client'; // prepend: true moves MUI styles to the top of the so they're loaded first. // It allows developers to easily override MUI styles with other styling solutions, like CSS modules. let cache; if (typeof document === 'object') { cache = (0,emotion_cache_browser_esm/* default */.A)({ key: 'css', prepend: true }); } function StyledEngineProvider(props) { const { injectFirst, children } = props; return injectFirst && cache ? /*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C, { value: cache, children: children }) : children; } false ? 0 : void 0; // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js var GlobalStyles = __webpack_require__(2722); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/styled-engine/index.js /** * @mui/styled-engine v5.16.6 * * @license MIT * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use client'; /* eslint-disable no-underscore-dangle */ function styled(tag, options) { const stylesFactory = newStyled(tag, options); if (false) {} return stylesFactory; } // eslint-disable-next-line @typescript-eslint/naming-convention const internal_processStyles = (tag, processor) => { // Emotion attaches all the styles as `__emotion_styles`. // Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186 if (Array.isArray(tag.__emotion_styles)) { tag.__emotion_styles = processor(tag.__emotion_styles); } }; /***/ }), /***/ 2937: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; var _interopRequireDefault = __webpack_require__(4994); __webpack_unused_export__ = ({ value: true }); exports.X4 = alpha; __webpack_unused_export__ = blend; __webpack_unused_export__ = void 0; exports.e$ = darken; __webpack_unused_export__ = decomposeColor; __webpack_unused_export__ = emphasize; exports.eM = getContrastRatio; __webpack_unused_export__ = getLuminance; __webpack_unused_export__ = hexToRgb; __webpack_unused_export__ = hslToRgb; exports.a = lighten; __webpack_unused_export__ = private_safeAlpha; __webpack_unused_export__ = void 0; __webpack_unused_export__ = private_safeDarken; __webpack_unused_export__ = private_safeEmphasize; __webpack_unused_export__ = private_safeLighten; __webpack_unused_export__ = recomposeColor; __webpack_unused_export__ = rgbToHex; var _formatMuiErrorMessage2 = _interopRequireDefault(__webpack_require__(9110)); var _clamp = _interopRequireDefault(__webpack_require__(577)); /* eslint-disable @typescript-eslint/naming-convention */ /** * Returns a number whose value is limited to the given range. * @param {number} value The value to be clamped * @param {number} min The lower boundary of the output range * @param {number} max The upper boundary of the output range * @returns {number} A number in the range [min, max] */ function clampWrapper(value, min = 0, max = 1) { if (false) {} return (0, _clamp.default)(value, min, max); } /** * Converts a color from CSS hex format to CSS rgb format. * @param {string} color - Hex color, i.e. #nnn or #nnnnnn * @returns {string} A CSS rgb color string */ function hexToRgb(color) { color = color.slice(1); const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g'); let colors = color.match(re); if (colors && colors[0].length === 1) { colors = colors.map(n => n + n); } return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => { return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000; }).join(', ')})` : ''; } function intToHex(int) { const hex = int.toString(16); return hex.length === 1 ? `0${hex}` : hex; } /** * Returns an object with the type and values of a color. * * Note: Does not support rgb % values. * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @returns {object} - A MUI color object: {type: string, values: number[]} */ function decomposeColor(color) { // Idempotent if (color.type) { return color; } if (color.charAt(0) === '#') { return decomposeColor(hexToRgb(color)); } const marker = color.indexOf('('); const type = color.substring(0, marker); if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) { throw new Error( false ? 0 : (0, _formatMuiErrorMessage2.default)(9, color)); } let values = color.substring(marker + 1, color.length - 1); let colorSpace; if (type === 'color') { values = values.split(' '); colorSpace = values.shift(); if (values.length === 4 && values[3].charAt(0) === '/') { values[3] = values[3].slice(1); } if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) { throw new Error( false ? 0 : (0, _formatMuiErrorMessage2.default)(10, colorSpace)); } } else { values = values.split(','); } values = values.map(value => parseFloat(value)); return { type, values, colorSpace }; } /** * Returns a channel created from the input color. * * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @returns {string} - The channel for the color, that can be used in rgba or hsla colors */ const colorChannel = color => { const decomposedColor = decomposeColor(color); return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' '); }; __webpack_unused_export__ = colorChannel; const private_safeColorChannel = (color, warning) => { try { return colorChannel(color); } catch (error) { if (warning && "production" !== 'production') {} return color; } }; /** * Converts a color object with type and values to a string. * @param {object} color - Decomposed color * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color' * @param {array} color.values - [n,n,n] or [n,n,n,n] * @returns {string} A CSS color string */ __webpack_unused_export__ = private_safeColorChannel; function recomposeColor(color) { const { type, colorSpace } = color; let { values } = color; if (type.indexOf('rgb') !== -1) { // Only convert the first 3 values to int (i.e. not alpha) values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n); } else if (type.indexOf('hsl') !== -1) { values[1] = `${values[1]}%`; values[2] = `${values[2]}%`; } if (type.indexOf('color') !== -1) { values = `${colorSpace} ${values.join(' ')}`; } else { values = `${values.join(', ')}`; } return `${type}(${values})`; } /** * Converts a color from CSS rgb format to CSS hex format. * @param {string} color - RGB color, i.e. rgb(n, n, n) * @returns {string} A CSS rgb color string, i.e. #nnnnnn */ function rgbToHex(color) { // Idempotent if (color.indexOf('#') === 0) { return color; } const { values } = decomposeColor(color); return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`; } /** * Converts a color from hsl format to rgb format. * @param {string} color - HSL color values * @returns {string} rgb color values */ function hslToRgb(color) { color = decomposeColor(color); const { values } = color; const h = values[0]; const s = values[1] / 100; const l = values[2] / 100; const a = s * Math.min(l, 1 - l); const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); let type = 'rgb'; const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)]; if (color.type === 'hsla') { type += 'a'; rgb.push(values[3]); } return recomposeColor({ type, values: rgb }); } /** * The relative brightness of any point in a color space, * normalized to 0 for darkest black and 1 for lightest white. * * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @returns {number} The relative brightness of the color in the range 0 - 1 */ function getLuminance(color) { color = decomposeColor(color); let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values; rgb = rgb.map(val => { if (color.type !== 'color') { val /= 255; // normalized } return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4; }); // Truncate at 3 digits return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3)); } /** * Calculates the contrast ratio between two colors. * * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla() * @returns {number} A contrast ratio value in the range 0 - 21. */ function getContrastRatio(foreground, background) { const lumA = getLuminance(foreground); const lumB = getLuminance(background); return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05); } /** * Sets the absolute transparency of a color. * Any existing alpha values are overwritten. * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @param {number} value - value to set the alpha channel to in the range 0 - 1 * @returns {string} A CSS color string. Hex input values are returned as rgb */ function alpha(color, value) { color = decomposeColor(color); value = clampWrapper(value); if (color.type === 'rgb' || color.type === 'hsl') { color.type += 'a'; } if (color.type === 'color') { color.values[3] = `/${value}`; } else { color.values[3] = value; } return recomposeColor(color); } function private_safeAlpha(color, value, warning) { try { return alpha(color, value); } catch (error) { if (warning && "production" !== 'production') {} return color; } } /** * Darkens a color. * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @param {number} coefficient - multiplier in the range 0 - 1 * @returns {string} A CSS color string. Hex input values are returned as rgb */ function darken(color, coefficient) { color = decomposeColor(color); coefficient = clampWrapper(coefficient); if (color.type.indexOf('hsl') !== -1) { color.values[2] *= 1 - coefficient; } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) { for (let i = 0; i < 3; i += 1) { color.values[i] *= 1 - coefficient; } } return recomposeColor(color); } function private_safeDarken(color, coefficient, warning) { try { return darken(color, coefficient); } catch (error) { if (warning && "production" !== 'production') {} return color; } } /** * Lightens a color. * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @param {number} coefficient - multiplier in the range 0 - 1 * @returns {string} A CSS color string. Hex input values are returned as rgb */ function lighten(color, coefficient) { color = decomposeColor(color); coefficient = clampWrapper(coefficient); if (color.type.indexOf('hsl') !== -1) { color.values[2] += (100 - color.values[2]) * coefficient; } else if (color.type.indexOf('rgb') !== -1) { for (let i = 0; i < 3; i += 1) { color.values[i] += (255 - color.values[i]) * coefficient; } } else if (color.type.indexOf('color') !== -1) { for (let i = 0; i < 3; i += 1) { color.values[i] += (1 - color.values[i]) * coefficient; } } return recomposeColor(color); } function private_safeLighten(color, coefficient, warning) { try { return lighten(color, coefficient); } catch (error) { if (warning && "production" !== 'production') {} return color; } } /** * Darken or lighten a color, depending on its luminance. * Light colors are darkened, dark colors are lightened. * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color() * @param {number} coefficient=0.15 - multiplier in the range 0 - 1 * @returns {string} A CSS color string. Hex input values are returned as rgb */ function emphasize(color, coefficient = 0.15) { return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient); } function private_safeEmphasize(color, coefficient, warning) { try { return emphasize(color, coefficient); } catch (error) { if (warning && "production" !== 'production') {} return color; } } /** * Blend a transparent overlay color with a background color, resulting in a single * RGB color. * @param {string} background - CSS color * @param {string} overlay - CSS color * @param {number} opacity - Opacity multiplier in the range 0 - 1 * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual. */ function blend(background, overlay, opacity, gamma = 1.0) { const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma); const backgroundColor = decomposeColor(background); const overlayColor = decomposeColor(overlay); const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])]; return recomposeColor({ type: 'rgb', values: rgb }); } /***/ }), /***/ 1603: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; var _interopRequireDefault = __webpack_require__(4994); __webpack_unused_export__ = ({ value: true }); exports.Ay = createStyled; __webpack_unused_export__ = shouldForwardProp; __webpack_unused_export__ = void 0; var _extends2 = _interopRequireDefault(__webpack_require__(4634)); var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(4893)); var _styledEngine = _interopRequireWildcard(__webpack_require__(3033)); var _deepmerge = __webpack_require__(6661); var _capitalize = _interopRequireDefault(__webpack_require__(2391)); var _getDisplayName = _interopRequireDefault(__webpack_require__(3526)); var _createTheme = _interopRequireDefault(__webpack_require__(7716)); var _styleFunctionSx = _interopRequireDefault(__webpack_require__(4200)); const _excluded = ["ownerState"], _excluded2 = ["variants"], _excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"]; /* eslint-disable no-underscore-dangle */ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } function isEmpty(obj) { return Object.keys(obj).length === 0; } // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40 function isStringTag(tag) { return typeof tag === 'string' && // 96 is one less than the char code // for "a" so this is checking that // it's a lowercase character tag.charCodeAt(0) > 96; } // Update /system/styled/#api in case if this changes function shouldForwardProp(prop) { return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as'; } const systemDefaultTheme = __webpack_unused_export__ = (0, _createTheme.default)(); const lowercaseFirstLetter = string => { if (!string) { return string; } return string.charAt(0).toLowerCase() + string.slice(1); }; function resolveTheme({ defaultTheme, theme, themeId }) { return isEmpty(theme) ? defaultTheme : theme[themeId] || theme; } function defaultOverridesResolver(slot) { if (!slot) { return null; } return (props, styles) => styles[slot]; } function processStyleArg(callableStyle, _ref) { let { ownerState } = _ref, props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded); const resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle((0, _extends2.default)({ ownerState }, props)) : callableStyle; if (Array.isArray(resolvedStylesArg)) { return resolvedStylesArg.flatMap(resolvedStyle => processStyleArg(resolvedStyle, (0, _extends2.default)({ ownerState }, props))); } if (!!resolvedStylesArg && typeof resolvedStylesArg === 'object' && Array.isArray(resolvedStylesArg.variants)) { const { variants = [] } = resolvedStylesArg, otherStyles = (0, _objectWithoutPropertiesLoose2.default)(resolvedStylesArg, _excluded2); let result = otherStyles; variants.forEach(variant => { let isMatch = true; if (typeof variant.props === 'function') { isMatch = variant.props((0, _extends2.default)({ ownerState }, props, ownerState)); } else { Object.keys(variant.props).forEach(key => { if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) { isMatch = false; } }); } if (isMatch) { if (!Array.isArray(result)) { result = [result]; } result.push(typeof variant.style === 'function' ? variant.style((0, _extends2.default)({ ownerState }, props, ownerState)) : variant.style); } }); return result; } return resolvedStylesArg; } function createStyled(input = {}) { const { themeId, defaultTheme = systemDefaultTheme, rootShouldForwardProp = shouldForwardProp, slotShouldForwardProp = shouldForwardProp } = input; const systemSx = props => { return (0, _styleFunctionSx.default)((0, _extends2.default)({}, props, { theme: resolveTheme((0, _extends2.default)({}, props, { defaultTheme, themeId })) })); }; systemSx.__mui_systemSx = true; return (tag, inputOptions = {}) => { // Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components. (0, _styledEngine.internal_processStyles)(tag, styles => styles.filter(style => !(style != null && style.__mui_systemSx))); const { name: componentName, slot: componentSlot, skipVariantsResolver: inputSkipVariantsResolver, skipSx: inputSkipSx, // TODO v6: remove `lowercaseFirstLetter()` in the next major release // For more details: https://github.com/mui/material-ui/pull/37908 overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)) } = inputOptions, options = (0, _objectWithoutPropertiesLoose2.default)(inputOptions, _excluded3); // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots. const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : // TODO v6: remove `Root` in the next major release // For more details: https://github.com/mui/material-ui/pull/37908 componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false; const skipSx = inputSkipSx || false; let label; if (false) {} let shouldForwardPropOption = shouldForwardProp; // TODO v6: remove `Root` in the next major release // For more details: https://github.com/mui/material-ui/pull/37908 if (componentSlot === 'Root' || componentSlot === 'root') { shouldForwardPropOption = rootShouldForwardProp; } else if (componentSlot) { // any other slot specified shouldForwardPropOption = slotShouldForwardProp; } else if (isStringTag(tag)) { // for string (html) tag, preserve the behavior in emotion & styled-components. shouldForwardPropOption = undefined; } const defaultStyledResolver = (0, _styledEngine.default)(tag, (0, _extends2.default)({ shouldForwardProp: shouldForwardPropOption, label }, options)); const transformStyleArg = stylesArg => { // On the server Emotion doesn't use React.forwardRef for creating components, so the created // component stays as a function. This condition makes sure that we do not interpolate functions // which are basically components used as a selectors. if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || (0, _deepmerge.isPlainObject)(stylesArg)) { return props => processStyleArg(stylesArg, (0, _extends2.default)({}, props, { theme: resolveTheme({ theme: props.theme, defaultTheme, themeId }) })); } return stylesArg; }; const muiStyledResolver = (styleArg, ...expressions) => { let transformedStyleArg = transformStyleArg(styleArg); const expressionsWithDefaultTheme = expressions ? expressions.map(transformStyleArg) : []; if (componentName && overridesResolver) { expressionsWithDefaultTheme.push(props => { const theme = resolveTheme((0, _extends2.default)({}, props, { defaultTheme, themeId })); if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) { return null; } const styleOverrides = theme.components[componentName].styleOverrides; const resolvedStyleOverrides = {}; // TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => { resolvedStyleOverrides[slotKey] = processStyleArg(slotStyle, (0, _extends2.default)({}, props, { theme })); }); return overridesResolver(props, resolvedStyleOverrides); }); } if (componentName && !skipVariantsResolver) { expressionsWithDefaultTheme.push(props => { var _theme$components; const theme = resolveTheme((0, _extends2.default)({}, props, { defaultTheme, themeId })); const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[componentName]) == null ? void 0 : _theme$components.variants; return processStyleArg({ variants: themeVariants }, (0, _extends2.default)({}, props, { theme })); }); } if (!skipSx) { expressionsWithDefaultTheme.push(systemSx); } const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length; if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) { const placeholders = new Array(numOfCustomFnsApplied).fill(''); // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles. transformedStyleArg = [...styleArg, ...placeholders]; transformedStyleArg.raw = [...styleArg.raw, ...placeholders]; } const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme); if (false) {} if (tag.muiName) { Component.muiName = tag.muiName; } return Component; }; if (defaultStyledResolver.withConfig) { muiStyledResolver.withConfig = defaultStyledResolver.withConfig; } return muiStyledResolver; }; } /***/ }), /***/ 8138: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ EU: function() { return /* binding */ createEmptyBreakpointObject; }, /* harmony export */ NI: function() { return /* binding */ handleBreakpoints; }, /* harmony export */ iZ: function() { return /* binding */ mergeBreakpointsInOrder; }, /* harmony export */ kW: function() { return /* binding */ resolveBreakpointValues; }, /* harmony export */ vf: function() { return /* binding */ removeUnusedBreakpoints; }, /* harmony export */ zu: function() { return /* binding */ values; } /* harmony export */ }); /* unused harmony export computeBreakpointsBase */ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5556); /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3479); // The breakpoint **start** at this value. // For instance with the first breakpoint xs: [xs, sm[. const values = { xs: 0, // phone sm: 600, // tablet md: 900, // small laptop lg: 1200, // desktop xl: 1536 // large screen }; const defaultBreakpoints = { // Sorted ASC by size. That's important. // It can't be configured as it's used statically for propTypes. keys: ['xs', 'sm', 'md', 'lg', 'xl'], up: key => `@media (min-width:${values[key]}px)` }; function handleBreakpoints(props, propValue, styleFromPropValue) { const theme = props.theme || {}; if (Array.isArray(propValue)) { const themeBreakpoints = theme.breakpoints || defaultBreakpoints; return propValue.reduce((acc, item, index) => { acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]); return acc; }, {}); } if (typeof propValue === 'object') { const themeBreakpoints = theme.breakpoints || defaultBreakpoints; return Object.keys(propValue).reduce((acc, breakpoint) => { // key is breakpoint if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) { const mediaKey = themeBreakpoints.up(breakpoint); acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint); } else { const cssKey = breakpoint; acc[cssKey] = propValue[cssKey]; } return acc; }, {}); } const output = styleFromPropValue(propValue); return output; } function breakpoints(styleFunction) { // false positive // eslint-disable-next-line react/function-component-definition const newStyleFunction = props => { const theme = props.theme || {}; const base = styleFunction(props); const themeBreakpoints = theme.breakpoints || defaultBreakpoints; const extended = themeBreakpoints.keys.reduce((acc, key) => { if (props[key]) { acc = acc || {}; acc[themeBreakpoints.up(key)] = styleFunction(_extends({ theme }, props[key])); } return acc; }, null); return merge(base, extended); }; newStyleFunction.propTypes = false ? 0 : {}; newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps]; return newStyleFunction; } function createEmptyBreakpointObject(breakpointsInput = {}) { var _breakpointsInput$key; const breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce((acc, key) => { const breakpointStyleKey = breakpointsInput.up(key); acc[breakpointStyleKey] = {}; return acc; }, {}); return breakpointsInOrder || {}; } function removeUnusedBreakpoints(breakpointKeys, style) { return breakpointKeys.reduce((acc, key) => { const breakpointOutput = acc[key]; const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0; if (isBreakpointUnused) { delete acc[key]; } return acc; }, style); } function mergeBreakpointsInOrder(breakpointsInput, ...styles) { const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput); const mergedOutput = [emptyBreakpoints, ...styles].reduce((prev, next) => (0,_mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(prev, next), {}); return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput); } // compute base for responsive values; e.g., // [1,2,3] => {xs: true, sm: true, md: true} // {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true} function computeBreakpointsBase(breakpointValues, themeBreakpoints) { // fixed value if (typeof breakpointValues !== 'object') { return {}; } const base = {}; const breakpointsKeys = Object.keys(themeBreakpoints); if (Array.isArray(breakpointValues)) { breakpointsKeys.forEach((breakpoint, i) => { if (i < breakpointValues.length) { base[breakpoint] = true; } }); } else { breakpointsKeys.forEach(breakpoint => { if (breakpointValues[breakpoint] != null) { base[breakpoint] = true; } }); } return base; } function resolveBreakpointValues({ values: breakpointValues, breakpoints: themeBreakpoints, base: customBase }) { const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints); const keys = Object.keys(base); if (keys.length === 0) { return breakpointValues; } let previous; return keys.reduce((acc, breakpoint, i) => { if (Array.isArray(breakpointValues)) { acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous]; previous = i; } else if (typeof breakpointValues === 'object') { acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous]; previous = breakpoint; } else { acc[breakpoint] = breakpointValues; } return acc; }, {}); } /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (breakpoints))); /***/ }), /***/ 8418: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ applyStyles; } /* harmony export */ }); /** * A universal utility to style components with multiple color modes. Always use it from the theme object. * It works with: * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/) * - [CSS theme variables](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/) * - Zero-runtime engine * * Tips: Use an array over object spread and place `theme.applyStyles()` last. * * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })] * * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })} * * @example * 1. using with `styled`: * ```jsx * const Component = styled('div')(({ theme }) => [ * { background: '#e5e5e5' }, * theme.applyStyles('dark', { * background: '#1c1c1c', * color: '#fff', * }), * ]); * ``` * * @example * 2. using with `sx` prop: * ```jsx * [ * { background: '#e5e5e5' }, * theme.applyStyles('dark', { * background: '#1c1c1c', * color: '#fff', * }), * ]} * /> * ``` * * @example * 3. theming a component: * ```jsx * extendTheme({ * components: { * MuiButton: { * styleOverrides: { * root: ({ theme }) => [ * { background: '#e5e5e5' }, * theme.applyStyles('dark', { * background: '#1c1c1c', * color: '#fff', * }), * ], * }, * } * } * }) *``` */ function applyStyles(key, styles) { // @ts-expect-error this is 'any' type const theme = this; if (theme.vars && typeof theme.getColorSchemeSelector === 'function') { // If CssVarsProvider is used as a provider, // returns '* :where([data-mui-color-scheme="light|dark"]) &' const selector = theme.getColorSchemeSelector(key).replace(/(\[[^\]]+\])/, '*:where($1)'); return { [selector]: styles }; } if (theme.palette.mode === key) { return styles; } return {}; } /***/ }), /***/ 4784: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ createBreakpoints; } /* harmony export */ }); /* unused harmony export breakpointKeys */ /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8587); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8168); const _excluded = ["values", "unit", "step"]; // Sorted ASC by size. That's important. // It can't be configured as it's used statically for propTypes. const breakpointKeys = (/* unused pure expression or super */ null && (['xs', 'sm', 'md', 'lg', 'xl'])); const sortBreakpointsValues = values => { const breakpointsAsArray = Object.keys(values).map(key => ({ key, val: values[key] })) || []; // Sort in ascending order breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val); return breakpointsAsArray.reduce((acc, obj) => { return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, acc, { [obj.key]: obj.val }); }, {}); }; // Keep in mind that @media is inclusive by the CSS specification. function createBreakpoints(breakpoints) { const { // The breakpoint **start** at this value. // For instance with the first breakpoint xs: [xs, sm). values = { xs: 0, // phone sm: 600, // tablet md: 900, // small laptop lg: 1200, // desktop xl: 1536 // large screen }, unit = 'px', step = 5 } = breakpoints, other = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(breakpoints, _excluded); const sortedValues = sortBreakpointsValues(values); const keys = Object.keys(sortedValues); function up(key) { const value = typeof values[key] === 'number' ? values[key] : key; return `@media (min-width:${value}${unit})`; } function down(key) { const value = typeof values[key] === 'number' ? values[key] : key; return `@media (max-width:${value - step / 100}${unit})`; } function between(start, end) { const endIndex = keys.indexOf(end); return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`; } function only(key) { if (keys.indexOf(key) + 1 < keys.length) { return between(key, keys[keys.indexOf(key) + 1]); } return up(key); } function not(key) { // handle first and last key separately, for better readability const keyIndex = keys.indexOf(key); if (keyIndex === 0) { return up(keys[1]); } if (keyIndex === keys.length - 1) { return down(keys[keyIndex]); } return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and'); } return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({ keys, values: sortedValues, up, down, between, only, not, unit }, other); } /***/ }), /***/ 9731: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ createTheme_createTheme; } }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js var objectWithoutPropertiesLoose = __webpack_require__(8587); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/deepmerge/deepmerge.js var deepmerge = __webpack_require__(3479); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/createBreakpoints.js var createBreakpoints = __webpack_require__(4784); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/shape.js const shape = { borderRadius: 4 }; /* harmony default export */ var createTheme_shape = (shape); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/spacing.js + 1 modules var esm_spacing = __webpack_require__(2610); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/createSpacing.js // The different signatures imply different meaning for their arguments that can't be expressed structurally. // We express the difference with variable names. function createSpacing(spacingInput = 8) { // Already transformed. if (spacingInput.mui) { return spacingInput; } // Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout. // Smaller components, such as icons, can align to a 4dp grid. // https://m2.material.io/design/layout/understanding-layout.html const transform = (0,esm_spacing/* createUnarySpacing */.LX)({ spacing: spacingInput }); const spacing = (...argsInput) => { if (false) {} const args = argsInput.length === 0 ? [1] : argsInput; return args.map(argument => { const output = transform(argument); return typeof output === 'number' ? `${output}px` : output; }).join(' '); }; spacing.mui = true; return spacing; } // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js var styleFunctionSx = __webpack_require__(2733); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js + 5 modules var defaultSxConfig = __webpack_require__(9058); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/applyStyles.js var applyStyles = __webpack_require__(8418); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/createTheme.js const _excluded = ["breakpoints", "palette", "spacing", "shape"]; function createTheme(options = {}, ...args) { const { breakpoints: breakpointsInput = {}, palette: paletteInput = {}, spacing: spacingInput, shape: shapeInput = {} } = options, other = (0,objectWithoutPropertiesLoose/* default */.A)(options, _excluded); const breakpoints = (0,createBreakpoints/* default */.A)(breakpointsInput); const spacing = createSpacing(spacingInput); let muiTheme = (0,deepmerge/* default */.A)({ breakpoints, direction: 'ltr', components: {}, // Inject component definitions. palette: (0,esm_extends/* default */.A)({ mode: 'light' }, paletteInput), spacing, shape: (0,esm_extends/* default */.A)({}, createTheme_shape, shapeInput) }, other); muiTheme.applyStyles = applyStyles/* default */.A; muiTheme = args.reduce((acc, argument) => (0,deepmerge/* default */.A)(acc, argument), muiTheme); muiTheme.unstable_sxConfig = (0,esm_extends/* default */.A)({}, defaultSxConfig/* default */.A, other == null ? void 0 : other.unstable_sxConfig); muiTheme.unstable_sx = function sx(props) { return (0,styleFunctionSx/* default */.A)({ sx: props, theme: this }); }; return muiTheme; } /* harmony default export */ var createTheme_createTheme = (createTheme); /***/ }), /***/ 7716: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* reexport safe */ _createTheme__WEBPACK_IMPORTED_MODULE_0__.A; }, /* harmony export */ private_createBreakpoints: function() { return /* reexport safe */ _createBreakpoints__WEBPACK_IMPORTED_MODULE_1__.A; }, /* harmony export */ unstable_applyStyles: function() { return /* reexport safe */ _applyStyles__WEBPACK_IMPORTED_MODULE_2__.A; } /* harmony export */ }); /* harmony import */ var _createTheme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9731); /* harmony import */ var _createBreakpoints__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4784); /* harmony import */ var _applyStyles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8418); /***/ }), /***/ 9517: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3479); function merge(acc, item) { if (!item) { return acc; } return (0,_mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(acc, item, { clone: false // No need to clone deep, it's way faster. }); } /* harmony default export */ __webpack_exports__.A = (merge); /***/ }), /***/ 2610: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { LX: function() { return /* binding */ createUnarySpacing; }, MA: function() { return /* binding */ createUnaryUnit; }, _W: function() { return /* binding */ getValue; }, Lc: function() { return /* binding */ margin; }, Ms: function() { return /* binding */ padding; } }); // UNUSED EXPORTS: default, getStyleFromPropValue, marginKeys, paddingKeys // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/breakpoints.js var breakpoints = __webpack_require__(8138); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/style.js var style = __webpack_require__(8835); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/merge.js var merge = __webpack_require__(9517); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/memoize.js function memoize(fn) { const cache = {}; return arg => { if (cache[arg] === undefined) { cache[arg] = fn(arg); } return cache[arg]; }; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/spacing.js const properties = { m: 'margin', p: 'padding' }; const directions = { t: 'Top', r: 'Right', b: 'Bottom', l: 'Left', x: ['Left', 'Right'], y: ['Top', 'Bottom'] }; const aliases = { marginX: 'mx', marginY: 'my', paddingX: 'px', paddingY: 'py' }; // memoize() impact: // From 300,000 ops/sec // To 350,000 ops/sec const getCssProperties = memoize(prop => { // It's not a shorthand notation. if (prop.length > 2) { if (aliases[prop]) { prop = aliases[prop]; } else { return [prop]; } } const [a, b] = prop.split(''); const property = properties[a]; const direction = directions[b] || ''; return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction]; }); const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd']; const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd']; const spacingKeys = [...marginKeys, ...paddingKeys]; function createUnaryUnit(theme, themeKey, defaultValue, propName) { var _getPath; const themeSpacing = (_getPath = (0,style/* getPath */.Yn)(theme, themeKey, false)) != null ? _getPath : defaultValue; if (typeof themeSpacing === 'number') { return abs => { if (typeof abs === 'string') { return abs; } if (false) {} return themeSpacing * abs; }; } if (Array.isArray(themeSpacing)) { return abs => { if (typeof abs === 'string') { return abs; } if (false) {} return themeSpacing[abs]; }; } if (typeof themeSpacing === 'function') { return themeSpacing; } if (false) {} return () => undefined; } function createUnarySpacing(theme) { return createUnaryUnit(theme, 'spacing', 8, 'spacing'); } function getValue(transformer, propValue) { if (typeof propValue === 'string' || propValue == null) { return propValue; } const abs = Math.abs(propValue); const transformed = transformer(abs); if (propValue >= 0) { return transformed; } if (typeof transformed === 'number') { return -transformed; } return `-${transformed}`; } function getStyleFromPropValue(cssProperties, transformer) { return propValue => cssProperties.reduce((acc, cssProperty) => { acc[cssProperty] = getValue(transformer, propValue); return acc; }, {}); } function resolveCssProperty(props, keys, prop, transformer) { // Using a hash computation over an array iteration could be faster, but with only 28 items, // it's doesn't worth the bundle size. if (keys.indexOf(prop) === -1) { return null; } const cssProperties = getCssProperties(prop); const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer); const propValue = props[prop]; return (0,breakpoints/* handleBreakpoints */.NI)(props, propValue, styleFromPropValue); } function spacing_style(props, keys) { const transformer = createUnarySpacing(props.theme); return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge/* default */.A, {}); } function margin(props) { return spacing_style(props, marginKeys); } margin.propTypes = false ? 0 : {}; margin.filterProps = marginKeys; function padding(props) { return spacing_style(props, paddingKeys); } padding.propTypes = false ? 0 : {}; padding.filterProps = paddingKeys; function spacing(props) { return spacing_style(props, spacingKeys); } spacing.propTypes = false ? 0 : {}; spacing.filterProps = spacingKeys; /* harmony default export */ var esm_spacing = ((/* unused pure expression or super */ null && (spacing))); /***/ }), /***/ 8835: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ BO: function() { return /* binding */ getStyleValue; }, /* harmony export */ Yn: function() { return /* binding */ getPath; } /* harmony export */ }); /* harmony import */ var _mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(985); /* harmony import */ var _breakpoints__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8138); function getPath(obj, path, checkVars = true) { if (!path || typeof path !== 'string') { return null; } // Check if CSS variables are used if (obj && obj.vars && checkVars) { const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj); if (val != null) { return val; } } return path.split('.').reduce((acc, item) => { if (acc && acc[item] != null) { return acc[item]; } return null; }, obj); } function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) { let value; if (typeof themeMapping === 'function') { value = themeMapping(propValueFinal); } else if (Array.isArray(themeMapping)) { value = themeMapping[propValueFinal] || userValue; } else { value = getPath(themeMapping, propValueFinal) || userValue; } if (transform) { value = transform(value, userValue, themeMapping); } return value; } function style(options) { const { prop, cssProperty = options.prop, themeKey, transform } = options; // false positive // eslint-disable-next-line react/function-component-definition const fn = props => { if (props[prop] == null) { return null; } const propValue = props[prop]; const theme = props.theme; const themeMapping = getPath(theme, themeKey) || {}; const styleFromPropValue = propValueFinal => { let value = getStyleValue(themeMapping, transform, propValueFinal); if (propValueFinal === value && typeof propValueFinal === 'string') { // Haven't found value value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : (0,_mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(propValueFinal)}`, propValueFinal); } if (cssProperty === false) { return value; } return { [cssProperty]: value }; }; return (0,_breakpoints__WEBPACK_IMPORTED_MODULE_1__/* .handleBreakpoints */ .NI)(props, propValue, styleFromPropValue); }; fn.propTypes = false ? 0 : {}; fn.filterProps = [prop]; return fn; } /* harmony default export */ __webpack_exports__.Ay = (style); /***/ }), /***/ 9058: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ styleFunctionSx_defaultSxConfig; } }); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/spacing.js + 1 modules var spacing = __webpack_require__(2610); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/style.js var style = __webpack_require__(8835); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/merge.js var merge = __webpack_require__(9517); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/compose.js function compose(...styles) { const handlers = styles.reduce((acc, style) => { style.filterProps.forEach(prop => { acc[prop] = style; }); return acc; }, {}); // false positive // eslint-disable-next-line react/function-component-definition const fn = props => { return Object.keys(props).reduce((acc, prop) => { if (handlers[prop]) { return (0,merge/* default */.A)(acc, handlers[prop](props)); } return acc; }, {}); }; fn.propTypes = false ? 0 : {}; fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []); return fn; } /* harmony default export */ var esm_compose = (compose); // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/breakpoints.js var breakpoints = __webpack_require__(8138); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/borders.js function borderTransform(value) { if (typeof value !== 'number') { return value; } return `${value}px solid`; } function createBorderStyle(prop, transform) { return (0,style/* default */.Ay)({ prop, themeKey: 'borders', transform }); } const border = createBorderStyle('border', borderTransform); const borderTop = createBorderStyle('borderTop', borderTransform); const borderRight = createBorderStyle('borderRight', borderTransform); const borderBottom = createBorderStyle('borderBottom', borderTransform); const borderLeft = createBorderStyle('borderLeft', borderTransform); const borderColor = createBorderStyle('borderColor'); const borderTopColor = createBorderStyle('borderTopColor'); const borderRightColor = createBorderStyle('borderRightColor'); const borderBottomColor = createBorderStyle('borderBottomColor'); const borderLeftColor = createBorderStyle('borderLeftColor'); const outline = createBorderStyle('outline', borderTransform); const outlineColor = createBorderStyle('outlineColor'); // false positive // eslint-disable-next-line react/function-component-definition const borderRadius = props => { if (props.borderRadius !== undefined && props.borderRadius !== null) { const transformer = (0,spacing/* createUnaryUnit */.MA)(props.theme, 'shape.borderRadius', 4, 'borderRadius'); const styleFromPropValue = propValue => ({ borderRadius: (0,spacing/* getValue */._W)(transformer, propValue) }); return (0,breakpoints/* handleBreakpoints */.NI)(props, props.borderRadius, styleFromPropValue); } return null; }; borderRadius.propTypes = false ? 0 : {}; borderRadius.filterProps = ['borderRadius']; const borders = esm_compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor); /* harmony default export */ var esm_borders = ((/* unused pure expression or super */ null && (borders))); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/cssGrid.js // false positive // eslint-disable-next-line react/function-component-definition const gap = props => { if (props.gap !== undefined && props.gap !== null) { const transformer = (0,spacing/* createUnaryUnit */.MA)(props.theme, 'spacing', 8, 'gap'); const styleFromPropValue = propValue => ({ gap: (0,spacing/* getValue */._W)(transformer, propValue) }); return (0,breakpoints/* handleBreakpoints */.NI)(props, props.gap, styleFromPropValue); } return null; }; gap.propTypes = false ? 0 : {}; gap.filterProps = ['gap']; // false positive // eslint-disable-next-line react/function-component-definition const columnGap = props => { if (props.columnGap !== undefined && props.columnGap !== null) { const transformer = (0,spacing/* createUnaryUnit */.MA)(props.theme, 'spacing', 8, 'columnGap'); const styleFromPropValue = propValue => ({ columnGap: (0,spacing/* getValue */._W)(transformer, propValue) }); return (0,breakpoints/* handleBreakpoints */.NI)(props, props.columnGap, styleFromPropValue); } return null; }; columnGap.propTypes = false ? 0 : {}; columnGap.filterProps = ['columnGap']; // false positive // eslint-disable-next-line react/function-component-definition const rowGap = props => { if (props.rowGap !== undefined && props.rowGap !== null) { const transformer = (0,spacing/* createUnaryUnit */.MA)(props.theme, 'spacing', 8, 'rowGap'); const styleFromPropValue = propValue => ({ rowGap: (0,spacing/* getValue */._W)(transformer, propValue) }); return (0,breakpoints/* handleBreakpoints */.NI)(props, props.rowGap, styleFromPropValue); } return null; }; rowGap.propTypes = false ? 0 : {}; rowGap.filterProps = ['rowGap']; const gridColumn = (0,style/* default */.Ay)({ prop: 'gridColumn' }); const gridRow = (0,style/* default */.Ay)({ prop: 'gridRow' }); const gridAutoFlow = (0,style/* default */.Ay)({ prop: 'gridAutoFlow' }); const gridAutoColumns = (0,style/* default */.Ay)({ prop: 'gridAutoColumns' }); const gridAutoRows = (0,style/* default */.Ay)({ prop: 'gridAutoRows' }); const gridTemplateColumns = (0,style/* default */.Ay)({ prop: 'gridTemplateColumns' }); const gridTemplateRows = (0,style/* default */.Ay)({ prop: 'gridTemplateRows' }); const gridTemplateAreas = (0,style/* default */.Ay)({ prop: 'gridTemplateAreas' }); const gridArea = (0,style/* default */.Ay)({ prop: 'gridArea' }); const grid = esm_compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea); /* harmony default export */ var cssGrid = ((/* unused pure expression or super */ null && (grid))); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/palette.js function paletteTransform(value, userValue) { if (userValue === 'grey') { return userValue; } return value; } const color = (0,style/* default */.Ay)({ prop: 'color', themeKey: 'palette', transform: paletteTransform }); const bgcolor = (0,style/* default */.Ay)({ prop: 'bgcolor', cssProperty: 'backgroundColor', themeKey: 'palette', transform: paletteTransform }); const backgroundColor = (0,style/* default */.Ay)({ prop: 'backgroundColor', themeKey: 'palette', transform: paletteTransform }); const palette = esm_compose(color, bgcolor, backgroundColor); /* harmony default export */ var esm_palette = ((/* unused pure expression or super */ null && (palette))); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/sizing.js function sizingTransform(value) { return value <= 1 && value !== 0 ? `${value * 100}%` : value; } const width = (0,style/* default */.Ay)({ prop: 'width', transform: sizingTransform }); const maxWidth = props => { if (props.maxWidth !== undefined && props.maxWidth !== null) { const styleFromPropValue = propValue => { var _props$theme, _props$theme2; const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || breakpoints/* values */.zu[propValue]; if (!breakpoint) { return { maxWidth: sizingTransform(propValue) }; } if (((_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.breakpoints) == null ? void 0 : _props$theme2.unit) !== 'px') { return { maxWidth: `${breakpoint}${props.theme.breakpoints.unit}` }; } return { maxWidth: breakpoint }; }; return (0,breakpoints/* handleBreakpoints */.NI)(props, props.maxWidth, styleFromPropValue); } return null; }; maxWidth.filterProps = ['maxWidth']; const minWidth = (0,style/* default */.Ay)({ prop: 'minWidth', transform: sizingTransform }); const height = (0,style/* default */.Ay)({ prop: 'height', transform: sizingTransform }); const maxHeight = (0,style/* default */.Ay)({ prop: 'maxHeight', transform: sizingTransform }); const minHeight = (0,style/* default */.Ay)({ prop: 'minHeight', transform: sizingTransform }); const sizeWidth = (0,style/* default */.Ay)({ prop: 'size', cssProperty: 'width', transform: sizingTransform }); const sizeHeight = (0,style/* default */.Ay)({ prop: 'size', cssProperty: 'height', transform: sizingTransform }); const boxSizing = (0,style/* default */.Ay)({ prop: 'boxSizing' }); const sizing = esm_compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing); /* harmony default export */ var esm_sizing = ((/* unused pure expression or super */ null && (sizing))); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js const defaultSxConfig = { // borders border: { themeKey: 'borders', transform: borderTransform }, borderTop: { themeKey: 'borders', transform: borderTransform }, borderRight: { themeKey: 'borders', transform: borderTransform }, borderBottom: { themeKey: 'borders', transform: borderTransform }, borderLeft: { themeKey: 'borders', transform: borderTransform }, borderColor: { themeKey: 'palette' }, borderTopColor: { themeKey: 'palette' }, borderRightColor: { themeKey: 'palette' }, borderBottomColor: { themeKey: 'palette' }, borderLeftColor: { themeKey: 'palette' }, outline: { themeKey: 'borders', transform: borderTransform }, outlineColor: { themeKey: 'palette' }, borderRadius: { themeKey: 'shape.borderRadius', style: borderRadius }, // palette color: { themeKey: 'palette', transform: paletteTransform }, bgcolor: { themeKey: 'palette', cssProperty: 'backgroundColor', transform: paletteTransform }, backgroundColor: { themeKey: 'palette', transform: paletteTransform }, // spacing p: { style: spacing/* padding */.Ms }, pt: { style: spacing/* padding */.Ms }, pr: { style: spacing/* padding */.Ms }, pb: { style: spacing/* padding */.Ms }, pl: { style: spacing/* padding */.Ms }, px: { style: spacing/* padding */.Ms }, py: { style: spacing/* padding */.Ms }, padding: { style: spacing/* padding */.Ms }, paddingTop: { style: spacing/* padding */.Ms }, paddingRight: { style: spacing/* padding */.Ms }, paddingBottom: { style: spacing/* padding */.Ms }, paddingLeft: { style: spacing/* padding */.Ms }, paddingX: { style: spacing/* padding */.Ms }, paddingY: { style: spacing/* padding */.Ms }, paddingInline: { style: spacing/* padding */.Ms }, paddingInlineStart: { style: spacing/* padding */.Ms }, paddingInlineEnd: { style: spacing/* padding */.Ms }, paddingBlock: { style: spacing/* padding */.Ms }, paddingBlockStart: { style: spacing/* padding */.Ms }, paddingBlockEnd: { style: spacing/* padding */.Ms }, m: { style: spacing/* margin */.Lc }, mt: { style: spacing/* margin */.Lc }, mr: { style: spacing/* margin */.Lc }, mb: { style: spacing/* margin */.Lc }, ml: { style: spacing/* margin */.Lc }, mx: { style: spacing/* margin */.Lc }, my: { style: spacing/* margin */.Lc }, margin: { style: spacing/* margin */.Lc }, marginTop: { style: spacing/* margin */.Lc }, marginRight: { style: spacing/* margin */.Lc }, marginBottom: { style: spacing/* margin */.Lc }, marginLeft: { style: spacing/* margin */.Lc }, marginX: { style: spacing/* margin */.Lc }, marginY: { style: spacing/* margin */.Lc }, marginInline: { style: spacing/* margin */.Lc }, marginInlineStart: { style: spacing/* margin */.Lc }, marginInlineEnd: { style: spacing/* margin */.Lc }, marginBlock: { style: spacing/* margin */.Lc }, marginBlockStart: { style: spacing/* margin */.Lc }, marginBlockEnd: { style: spacing/* margin */.Lc }, // display displayPrint: { cssProperty: false, transform: value => ({ '@media print': { display: value } }) }, display: {}, overflow: {}, textOverflow: {}, visibility: {}, whiteSpace: {}, // flexbox flexBasis: {}, flexDirection: {}, flexWrap: {}, justifyContent: {}, alignItems: {}, alignContent: {}, order: {}, flex: {}, flexGrow: {}, flexShrink: {}, alignSelf: {}, justifyItems: {}, justifySelf: {}, // grid gap: { style: gap }, rowGap: { style: rowGap }, columnGap: { style: columnGap }, gridColumn: {}, gridRow: {}, gridAutoFlow: {}, gridAutoColumns: {}, gridAutoRows: {}, gridTemplateColumns: {}, gridTemplateRows: {}, gridTemplateAreas: {}, gridArea: {}, // positions position: {}, zIndex: { themeKey: 'zIndex' }, top: {}, right: {}, bottom: {}, left: {}, // shadows boxShadow: { themeKey: 'shadows' }, // sizing width: { transform: sizingTransform }, maxWidth: { style: maxWidth }, minWidth: { transform: sizingTransform }, height: { transform: sizingTransform }, maxHeight: { transform: sizingTransform }, minHeight: { transform: sizingTransform }, boxSizing: {}, // typography fontFamily: { themeKey: 'typography' }, fontSize: { themeKey: 'typography' }, fontStyle: { themeKey: 'typography' }, fontWeight: { themeKey: 'typography' }, letterSpacing: {}, textTransform: {}, lineHeight: {}, textAlign: {}, typography: { cssProperty: false, themeKey: 'typography' } }; /* harmony default export */ var styleFunctionSx_defaultSxConfig = (defaultSxConfig); /***/ }), /***/ 449: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ extendSxProp; } /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8168); /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8587); /* harmony import */ var _mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3479); /* harmony import */ var _defaultSxConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9058); const _excluded = ["sx"]; const splitProps = props => { var _props$theme$unstable, _props$theme; const result = { systemProps: {}, otherProps: {} }; const config = (_props$theme$unstable = props == null || (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : _defaultSxConfig__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A; Object.keys(props).forEach(prop => { if (config[prop]) { result.systemProps[prop] = props[prop]; } else { result.otherProps[prop] = props[prop]; } }); return result; }; function extendSxProp(props) { const { sx: inSx } = props, other = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(props, _excluded); const { systemProps, otherProps } = splitProps(other); let finalSx; if (Array.isArray(inSx)) { finalSx = [systemProps, ...inSx]; } else if (typeof inSx === 'function') { finalSx = (...args) => { const result = inSx(...args); if (!(0,_mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_2__/* .isPlainObject */ .Q)(result)) { return systemProps; } return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)({}, systemProps, result); }; } else { finalSx = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)({}, systemProps, inSx); } return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A)({}, otherProps, { sx: finalSx }); } /***/ }), /***/ 4200: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* reexport safe */ _styleFunctionSx__WEBPACK_IMPORTED_MODULE_0__.A; }, /* harmony export */ extendSxProp: function() { return /* reexport safe */ _extendSxProp__WEBPACK_IMPORTED_MODULE_1__.A; }, /* harmony export */ unstable_createStyleFunctionSx: function() { return /* reexport safe */ _styleFunctionSx__WEBPACK_IMPORTED_MODULE_0__.k; }, /* harmony export */ unstable_defaultSxConfig: function() { return /* reexport safe */ _defaultSxConfig__WEBPACK_IMPORTED_MODULE_2__.A; } /* harmony export */ }); /* harmony import */ var _styleFunctionSx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2733); /* harmony import */ var _extendSxProp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(449); /* harmony import */ var _defaultSxConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9058); /***/ }), /***/ 2733: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ k: function() { return /* binding */ unstable_createStyleFunctionSx; } /* harmony export */ }); /* harmony import */ var _mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(985); /* harmony import */ var _merge__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9517); /* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8835); /* harmony import */ var _breakpoints__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8138); /* harmony import */ var _defaultSxConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9058); function objectsHaveSameKeys(...objects) { const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []); const union = new Set(allKeys); return objects.every(object => union.size === Object.keys(object).length); } function callIfFn(maybeFn, arg) { return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn; } // eslint-disable-next-line @typescript-eslint/naming-convention function unstable_createStyleFunctionSx() { function getThemeValue(prop, val, theme, config) { const props = { [prop]: val, theme }; const options = config[prop]; if (!options) { return { [prop]: val }; } const { cssProperty = prop, themeKey, transform, style } = options; if (val == null) { return null; } // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123 if (themeKey === 'typography' && val === 'inherit') { return { [prop]: val }; } const themeMapping = (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .getPath */ .Yn)(theme, themeKey) || {}; if (style) { return style(props); } const styleFromPropValue = propValueFinal => { let value = (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .getStyleValue */ .BO)(themeMapping, transform, propValueFinal); if (propValueFinal === value && typeof propValueFinal === 'string') { // Haven't found value value = (0,_style__WEBPACK_IMPORTED_MODULE_0__/* .getStyleValue */ .BO)(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : (0,_mui_utils_capitalize__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(propValueFinal)}`, propValueFinal); } if (cssProperty === false) { return value; } return { [cssProperty]: value }; }; return (0,_breakpoints__WEBPACK_IMPORTED_MODULE_2__/* .handleBreakpoints */ .NI)(props, val, styleFromPropValue); } function styleFunctionSx(props) { var _theme$unstable_sxCon; const { sx, theme = {} } = props || {}; if (!sx) { return null; // Emotion & styled-components will neglect null } const config = (_theme$unstable_sxCon = theme.unstable_sxConfig) != null ? _theme$unstable_sxCon : _defaultSxConfig__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A; /* * Receive `sxInput` as object or callback * and then recursively check keys & values to create media query object styles. * (the result will be used in `styled`) */ function traverse(sxInput) { let sxObject = sxInput; if (typeof sxInput === 'function') { sxObject = sxInput(theme); } else if (typeof sxInput !== 'object') { // value return sxInput; } if (!sxObject) { return null; } const emptyBreakpoints = (0,_breakpoints__WEBPACK_IMPORTED_MODULE_2__/* .createEmptyBreakpointObject */ .EU)(theme.breakpoints); const breakpointsKeys = Object.keys(emptyBreakpoints); let css = emptyBreakpoints; Object.keys(sxObject).forEach(styleKey => { const value = callIfFn(sxObject[styleKey], theme); if (value !== null && value !== undefined) { if (typeof value === 'object') { if (config[styleKey]) { css = (0,_merge__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(css, getThemeValue(styleKey, value, theme, config)); } else { const breakpointsValues = (0,_breakpoints__WEBPACK_IMPORTED_MODULE_2__/* .handleBreakpoints */ .NI)({ theme }, value, x => ({ [styleKey]: x })); if (objectsHaveSameKeys(breakpointsValues, value)) { css[styleKey] = styleFunctionSx({ sx: value, theme }); } else { css = (0,_merge__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(css, breakpointsValues); } } } else { css = (0,_merge__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)(css, getThemeValue(styleKey, value, theme, config)); } } }); return (0,_breakpoints__WEBPACK_IMPORTED_MODULE_2__/* .removeUnusedBreakpoints */ .vf)(breakpointsKeys, css); } return Array.isArray(sx) ? sx.map(traverse) : traverse(sx); } return styleFunctionSx; } const styleFunctionSx = unstable_createStyleFunctionSx(); styleFunctionSx.filterProps = ['sx']; /* harmony default export */ __webpack_exports__.A = (styleFunctionSx); /***/ }), /***/ 7133: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ esm_useTheme; } }); // UNUSED EXPORTS: systemDefaultTheme // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/createTheme/createTheme.js + 2 modules var createTheme = __webpack_require__(9731); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); // EXTERNAL MODULE: ../../modules/ui/code/core/node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js var emotion_element_c39617d8_browser_esm = __webpack_require__(7424); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/useThemeWithoutDefault.js 'use client'; function isObjectEmpty(obj) { return Object.keys(obj).length === 0; } function useTheme(defaultTheme = null) { const contextTheme = react.useContext(emotion_element_c39617d8_browser_esm.T); return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme; } /* harmony default export */ var useThemeWithoutDefault = (useTheme); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/useTheme.js 'use client'; const systemDefaultTheme = (0,createTheme/* default */.A)(); function useTheme_useTheme(defaultTheme = systemDefaultTheme) { return useThemeWithoutDefault(defaultTheme); } /* harmony default export */ var esm_useTheme = (useTheme_useTheme); /***/ }), /***/ 511: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ useThemeProps; } }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(8168); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/resolveProps/resolveProps.js /** * Add keys, values of `defaultProps` that does not exist in `props` * @param {object} defaultProps * @param {object} props * @returns {object} resolved props */ function resolveProps(defaultProps, props) { const output = (0,esm_extends/* default */.A)({}, props); Object.keys(defaultProps).forEach(propName => { if (propName.toString().match(/^(components|slots)$/)) { output[propName] = (0,esm_extends/* default */.A)({}, defaultProps[propName], output[propName]); } else if (propName.toString().match(/^(componentsProps|slotProps)$/)) { const defaultSlotProps = defaultProps[propName] || {}; const slotProps = props[propName]; output[propName] = {}; if (!slotProps || !Object.keys(slotProps)) { // Reduce the iteration if the slot props is empty output[propName] = defaultSlotProps; } else if (!defaultSlotProps || !Object.keys(defaultSlotProps)) { // Reduce the iteration if the default slot props is empty output[propName] = slotProps; } else { output[propName] = (0,esm_extends/* default */.A)({}, slotProps); Object.keys(defaultSlotProps).forEach(slotPropName => { output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]); }); } } else if (output[propName] === undefined) { output[propName] = defaultProps[propName]; } }); return output; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/useThemeProps/getThemeProps.js function getThemeProps(params) { const { theme, name, props } = params; if (!theme || !theme.components || !theme.components[name] || !theme.components[name].defaultProps) { return props; } return resolveProps(theme.components[name].defaultProps, props); } // EXTERNAL MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/useTheme.js + 1 modules var useTheme = __webpack_require__(7133); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/system/esm/useThemeProps/useThemeProps.js 'use client'; function useThemeProps({ props, name, defaultTheme, themeId }) { let theme = (0,useTheme/* default */.A)(defaultTheme); if (themeId) { theme = theme[themeId] || theme; } const mergedProps = getThemeProps({ theme, name, props }); return mergedProps; } /***/ }), /***/ 913: /***/ (function(__unused_webpack_module, __webpack_exports__) { "use strict"; const defaultGenerator = componentName => componentName; const createClassNameGenerator = () => { let generate = defaultGenerator; return { configure(generator) { generate = generator; }, generate(componentName) { return generate(componentName); }, reset() { generate = defaultGenerator; } }; }; const ClassNameGenerator = createClassNameGenerator(); /* harmony default export */ __webpack_exports__.A = (ClassNameGenerator); /***/ }), /***/ 985: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ capitalize; } /* harmony export */ }); /* harmony import */ var _mui_utils_formatMuiErrorMessage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(799); // It should to be noted that this function isn't equivalent to `text-transform: capitalize`. // // A strict capitalization should uppercase the first letter of each word in the sentence. // We only handle the first word. function capitalize(string) { if (typeof string !== 'string') { throw new Error( false ? 0 : (0,_mui_utils_formatMuiErrorMessage__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(7)); } return string.charAt(0).toUpperCase() + string.slice(1); } /***/ }), /***/ 2391: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* reexport safe */ _capitalize__WEBPACK_IMPORTED_MODULE_0__.A; } /* harmony export */ }); /* harmony import */ var _capitalize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(985); /***/ }), /***/ 577: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* reexport */ clamp_clamp; } }); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/clamp/clamp.js function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) { return Math.max(min, Math.min(val, max)); } /* harmony default export */ var clamp_clamp = (clamp); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/clamp/index.js /***/ }), /***/ 7453: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ composeClasses; } /* harmony export */ }); function composeClasses(slots, getUtilityClass, classes = undefined) { const output = {}; Object.keys(slots).forEach( // `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`. // @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208 slot => { output[slot] = slots[slot].reduce((acc, key) => { if (key) { const utilityClass = getUtilityClass(key); if (utilityClass !== '') { acc.push(utilityClass); } if (classes && classes[key]) { acc.push(classes[key]); } } return acc; }, []).join(' '); }); return output; } /***/ }), /***/ 4067: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ createChainedFunction; } /* harmony export */ }); /** * Safe chained function. * * Will only create a new function if needed, * otherwise will pass back existing functions or null. */ function createChainedFunction(...funcs) { return funcs.reduce((acc, func) => { if (func == null) { return acc; } return function chainedFunction(...args) { acc.apply(this, args); func.apply(this, args); }; }, () => {}); } /***/ }), /***/ 9379: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ debounce; } /* harmony export */ }); // Corresponds to 10 frames at 60 Hz. // A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B. function debounce(func, wait = 166) { let timeout; function debounced(...args) { const later = () => { // @ts-ignore func.apply(this, args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); } debounced.clear = () => { clearTimeout(timeout); }; return debounced; } /***/ }), /***/ 3479: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ deepmerge; }, /* harmony export */ Q: function() { return /* binding */ isPlainObject; } /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8168); // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js function isPlainObject(item) { if (typeof item !== 'object' || item === null) { return false; } const prototype = Object.getPrototypeOf(item); return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item); } function deepClone(source) { if (!isPlainObject(source)) { return source; } const output = {}; Object.keys(source).forEach(key => { output[key] = deepClone(source[key]); }); return output; } function deepmerge(target, source, options = { clone: true }) { const output = options.clone ? (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({}, target) : target; if (isPlainObject(target) && isPlainObject(source)) { Object.keys(source).forEach(key => { if (isPlainObject(source[key]) && // Avoid prototype pollution Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) { // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type. output[key] = deepmerge(target[key], source[key], options); } else if (options.clone) { output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key]; } else { output[key] = source[key]; } }); } return output; } /***/ }), /***/ 6661: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* reexport safe */ _deepmerge__WEBPACK_IMPORTED_MODULE_0__.A; }, /* harmony export */ isPlainObject: function() { return /* reexport safe */ _deepmerge__WEBPACK_IMPORTED_MODULE_0__.Q; } /* harmony export */ }); /* harmony import */ var _deepmerge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3479); /***/ }), /***/ 799: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ formatMuiErrorMessage; } /* harmony export */ }); /** * WARNING: Don't import this directly. * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead. * @param {number} code */ function formatMuiErrorMessage(code) { // Apply babel-plugin-transform-template-literals in loose mode // loose mode is safe if we're concatenating primitives // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose /* eslint-disable prefer-template */ let url = 'https://mui.com/production-error/?code=' + code; for (let i = 1; i < arguments.length; i += 1) { // rest params over-transpile for this case // eslint-disable-next-line prefer-rest-params url += '&args[]=' + encodeURIComponent(arguments[i]); } return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.'; /* eslint-enable prefer-template */ } /***/ }), /***/ 9110: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* reexport safe */ _formatMuiErrorMessage__WEBPACK_IMPORTED_MODULE_0__.A; } /* harmony export */ }); /* harmony import */ var _formatMuiErrorMessage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(799); /***/ }), /***/ 6467: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Ay: function() { return /* binding */ generateUtilityClass; } /* harmony export */ }); /* unused harmony exports globalStateClasses, isGlobalState */ /* harmony import */ var _ClassNameGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(913); const globalStateClasses = { active: 'active', checked: 'checked', completed: 'completed', disabled: 'disabled', error: 'error', expanded: 'expanded', focused: 'focused', focusVisible: 'focusVisible', open: 'open', readOnly: 'readOnly', required: 'required', selected: 'selected' }; function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') { const globalStateClass = globalStateClasses[slot]; return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${_ClassNameGenerator__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.generate(componentName)}-${slot}`; } function isGlobalState(slot) { return globalStateClasses[slot] !== undefined; } /***/ }), /***/ 7135: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ generateUtilityClasses; } /* harmony export */ }); /* harmony import */ var _generateUtilityClass__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6467); function generateUtilityClasses(componentName, slots, globalStatePrefix = 'Mui') { const result = {}; slots.forEach(slot => { result[slot] = (0,_generateUtilityClass__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Ay)(componentName, slot, globalStatePrefix); }); return result; } /***/ }), /***/ 3526: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* reexport */ getDisplayName; }, getFunctionName: function() { return /* reexport */ getFunctionName; } }); // EXTERNAL MODULE: ./node_modules/react-is/cjs/react-is.production.js var react_is_production = __webpack_require__(4405); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/getDisplayName/getDisplayName.js // Simplified polyfill for IE11 support // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3 const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/; function getFunctionName(fn) { const match = `${fn}`.match(fnNameMatchRegex); const name = match && match[1]; return name || ''; } function getFunctionComponentName(Component, fallback = '') { return Component.displayName || Component.name || getFunctionName(Component) || fallback; } function getWrappedName(outerType, innerType, wrapperName) { const functionName = getFunctionComponentName(innerType); return outerType.displayName || (functionName !== '' ? `${wrapperName}(${functionName})` : wrapperName); } /** * cherry-pick from * https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js * originally forked from recompose/getDisplayName with added IE11 support */ function getDisplayName(Component) { if (Component == null) { return undefined; } if (typeof Component === 'string') { return Component; } if (typeof Component === 'function') { return getFunctionComponentName(Component, 'Component'); } // TypeScript can't have components as objects but they exist in the form of `memo` or `Suspense` if (typeof Component === 'object') { switch (Component.$$typeof) { case react_is_production.ForwardRef: return getWrappedName(Component, Component.render, 'ForwardRef'); case react_is_production.Memo: return getWrappedName(Component, Component.type, 'memo'); default: return undefined; } } return undefined; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/getDisplayName/index.js /***/ }), /***/ 8183: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ ownerDocument; } /* harmony export */ }); function ownerDocument(node) { return node && node.ownerDocument || document; } /***/ }), /***/ 2327: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ ownerWindow; } /* harmony export */ }); /* harmony import */ var _ownerDocument__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8183); function ownerWindow(node) { const doc = (0,_ownerDocument__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)(node); return doc.defaultView || window; } /***/ }), /***/ 207: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ setRef; } /* harmony export */ }); /** * TODO v5: consider making it private * * passes {value} to {ref} * * WARNING: Be sure to only call this inside a callback that is passed as a ref. * Otherwise, make sure to cleanup the previous {ref} if it changes. See * https://github.com/mui/material-ui/issues/13539 * * Useful if you want to expose the ref of an inner component to the public API * while still using it inside the component. * @param ref A ref callback or ref object. If anything falsy, this is a no-op. */ function setRef(ref, value) { if (typeof ref === 'function') { ref(value); } else if (ref) { ref.current = value; } } /***/ }), /***/ 2723: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); 'use client'; /** * A version of `React.useLayoutEffect` that does not show a warning when server-side rendering. * This is useful for effects that are only needed for client-side rendering but not for SSR. * * Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85 * and confirm it doesn't apply to your use-case. */ const useEnhancedEffect = typeof window !== 'undefined' ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; /* harmony default export */ __webpack_exports__.A = (useEnhancedEffect); /***/ }), /***/ 1885: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var _useEnhancedEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2723); 'use client'; /** * Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892 * See RFC in https://github.com/reactjs/rfcs/pull/220 */ function useEventCallback(fn) { const ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(fn); (0,_useEnhancedEffect__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(() => { ref.current = fn; }); return react__WEBPACK_IMPORTED_MODULE_0__.useRef((...args) => // @ts-expect-error hide `this` (0, ref.current)(...args)).current; } /* harmony default export */ __webpack_exports__.A = (useEventCallback); /***/ }), /***/ 4061: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ useForkRef; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); /* harmony import */ var _setRef__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(207); 'use client'; function useForkRef(...refs) { /** * This will create a new function if the refs passed to this hook change and are all defined. * This means react will call the old forkRef with `null` and the new forkRef * with the ref. Cleanup naturally emerges from this behavior. */ return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { if (refs.every(ref => ref == null)) { return null; } return instance => { refs.forEach(ref => { (0,_setRef__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A)(ref, instance); }); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, refs); } /***/ }), /***/ 5311: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; var react__WEBPACK_IMPORTED_MODULE_0___namespace_cache; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: function() { return /* binding */ useId; } /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6540); 'use client'; let globalId = 0; function useGlobalId(idOverride) { const [defaultId, setDefaultId] = react__WEBPACK_IMPORTED_MODULE_0__.useState(idOverride); const id = idOverride || defaultId; react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { if (defaultId == null) { // Fallback to this default id when possible. // Use the incrementing value for client-side rendering only. // We can't use it server-side. // If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem globalId += 1; setDefaultId(`mui-${globalId}`); } }, [defaultId]); return id; } // downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814 const maybeReactUseId = /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2)))['useId'.toString()]; /** * * @example
* @param idOverride * @returns {string} */ function useId(idOverride) { if (maybeReactUseId !== undefined) { const reactId = maybeReactUseId(); return idOverride != null ? idOverride : reactId; } // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime. return useGlobalId(idOverride); } /***/ }), /***/ 478: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { E: function() { return /* binding */ Timeout; }, A: function() { return /* binding */ useTimeout; } }); // EXTERNAL MODULE: ./node_modules/react/index.js var react = __webpack_require__(6540); ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js 'use client'; const UNINITIALIZED = {}; /** * A React.useRef() that is initialized lazily with a function. Note that it accepts an optional * initialization argument, so the initialization function doesn't need to be an inline closure. * * @usage * const ref = useLazyRef(sortColumns, columns) */ function useLazyRef(init, initArg) { const ref = react.useRef(UNINITIALIZED); if (ref.current === UNINITIALIZED) { ref.current = init(initArg); } return ref; } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useOnMount/useOnMount.js 'use client'; const EMPTY = []; /** * A React.useEffect equivalent that runs once, when the component is mounted. */ function useOnMount(fn) { /* eslint-disable react-hooks/exhaustive-deps */ react.useEffect(fn, EMPTY); /* eslint-enable react-hooks/exhaustive-deps */ } ;// CONCATENATED MODULE: ../../modules/ui/code/mui/node_modules/@mui/utils/esm/useTimeout/useTimeout.js 'use client'; class Timeout { constructor() { this.currentId = null; this.clear = () => { if (this.currentId !== null) { clearTimeout(this.currentId); this.currentId = null; } }; this.disposeEffect = () => { return this.clear; }; } static create() { return new Timeout(); } /** * Executes `fn` after `delay`, clearing any previously scheduled call. */ start(delay, fn) { this.clear(); this.currentId = setTimeout(() => { this.currentId = null; fn(); }, delay); } } function useTimeout() { const timeout = useLazyRef(Timeout.create).current; useOnMount(timeout.disposeEffect); return timeout; } /***/ }), /***/ 7839: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/* * JavaScript MD5 * https://github.com/blueimp/JavaScript-MD5 * * Copyright 2011, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * https://opensource.org/licenses/MIT * * Based on * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /* global define */ /* eslint-disable strict */ ;(function ($) { 'use strict' /** * Add integers, wrapping at 2^32. * This uses 16-bit operations internally to work around bugs in interpreters. * * @param {number} x First integer * @param {number} y Second integer * @returns {number} Sum */ function safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff) var msw = (x >> 16) + (y >> 16) + (lsw >> 16) return (msw << 16) | (lsw & 0xffff) } /** * Bitwise rotate a 32-bit number to the left. * * @param {number} num 32-bit number * @param {number} cnt Rotation count * @returns {number} Rotated number */ function bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) } /** * Basic operation the algorithm uses. * * @param {number} q q * @param {number} a a * @param {number} b b * @param {number} x x * @param {number} s s * @param {number} t t * @returns {number} Result */ function md5cmn(q, a, b, x, s, t) { return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b) } /** * Basic operation the algorithm uses. * * @param {number} a a * @param {number} b b * @param {number} c c * @param {number} d d * @param {number} x x * @param {number} s s * @param {number} t t * @returns {number} Result */ function md5ff(a, b, c, d, x, s, t) { return md5cmn((b & c) | (~b & d), a, b, x, s, t) } /** * Basic operation the algorithm uses. * * @param {number} a a * @param {number} b b * @param {number} c c * @param {number} d d * @param {number} x x * @param {number} s s * @param {number} t t * @returns {number} Result */ function md5gg(a, b, c, d, x, s, t) { return md5cmn((b & d) | (c & ~d), a, b, x, s, t) } /** * Basic operation the algorithm uses. * * @param {number} a a * @param {number} b b * @param {number} c c * @param {number} d d * @param {number} x x * @param {number} s s * @param {number} t t * @returns {number} Result */ function md5hh(a, b, c, d, x, s, t) { return md5cmn(b ^ c ^ d, a, b, x, s, t) } /** * Basic operation the algorithm uses. * * @param {number} a a * @param {number} b b * @param {number} c c * @param {number} d d * @param {number} x x * @param {number} s s * @param {number} t t * @returns {number} Result */ function md5ii(a, b, c, d, x, s, t) { return md5cmn(c ^ (b | ~d), a, b, x, s, t) } /** * Calculate the MD5 of an array of little-endian words, and a bit length. * * @param {Array} x Array of little-endian words * @param {number} len Bit length * @returns {Array} MD5 Array */ function binlMD5(x, len) { /* append padding */ x[len >> 5] |= 0x80 << len % 32 x[(((len + 64) >>> 9) << 4) + 14] = len var i var olda var oldb var oldc var oldd var a = 1732584193 var b = -271733879 var c = -1732584194 var d = 271733878 for (i = 0; i < x.length; i += 16) { olda = a oldb = b oldc = c oldd = d a = md5ff(a, b, c, d, x[i], 7, -680876936) d = md5ff(d, a, b, c, x[i + 1], 12, -389564586) c = md5ff(c, d, a, b, x[i + 2], 17, 606105819) b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330) a = md5ff(a, b, c, d, x[i + 4], 7, -176418897) d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426) c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341) b = md5ff(b, c, d, a, x[i + 7], 22, -45705983) a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416) d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417) c = md5ff(c, d, a, b, x[i + 10], 17, -42063) b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162) a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682) d = md5ff(d, a, b, c, x[i + 13], 12, -40341101) c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290) b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329) a = md5gg(a, b, c, d, x[i + 1], 5, -165796510) d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632) c = md5gg(c, d, a, b, x[i + 11], 14, 643717713) b = md5gg(b, c, d, a, x[i], 20, -373897302) a = md5gg(a, b, c, d, x[i + 5], 5, -701558691) d = md5gg(d, a, b, c, x[i + 10], 9, 38016083) c = md5gg(c, d, a, b, x[i + 15], 14, -660478335) b = md5gg(b, c, d, a, x[i + 4], 20, -405537848) a = md5gg(a, b, c, d, x[i + 9], 5, 568446438) d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690) c = md5gg(c, d, a, b, x[i + 3], 14, -187363961) b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501) a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467) d = md5gg(d, a, b, c, x[i + 2], 9, -51403784) c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473) b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734) a = md5hh(a, b, c, d, x[i + 5], 4, -378558) d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463) c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562) b = md5hh(b, c, d, a, x[i + 14], 23, -35309556) a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060) d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353) c = md5hh(c, d, a, b, x[i + 7], 16, -155497632) b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640) a = md5hh(a, b, c, d, x[i + 13], 4, 681279174) d = md5hh(d, a, b, c, x[i], 11, -358537222) c = md5hh(c, d, a, b, x[i + 3], 16, -722521979) b = md5hh(b, c, d, a, x[i + 6], 23, 76029189) a = md5hh(a, b, c, d, x[i + 9], 4, -640364487) d = md5hh(d, a, b, c, x[i + 12], 11, -421815835) c = md5hh(c, d, a, b, x[i + 15], 16, 530742520) b = md5hh(b, c, d, a, x[i + 2], 23, -995338651) a = md5ii(a, b, c, d, x[i], 6, -198630844) d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415) c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905) b = md5ii(b, c, d, a, x[i + 5], 21, -57434055) a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571) d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606) c = md5ii(c, d, a, b, x[i + 10], 15, -1051523) b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799) a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359) d = md5ii(d, a, b, c, x[i + 15], 10, -30611744) c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380) b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649) a = md5ii(a, b, c, d, x[i + 4], 6, -145523070) d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379) c = md5ii(c, d, a, b, x[i + 2], 15, 718787259) b = md5ii(b, c, d, a, x[i + 9], 21, -343485551) a = safeAdd(a, olda) b = safeAdd(b, oldb) c = safeAdd(c, oldc) d = safeAdd(d, oldd) } return [a, b, c, d] } /** * Convert an array of little-endian words to a string * * @param {Array} input MD5 Array * @returns {string} MD5 string */ function binl2rstr(input) { var i var output = '' var length32 = input.length * 32 for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff) } return output } /** * Convert a raw string to an array of little-endian words * Characters >255 have their high-byte silently ignored. * * @param {string} input Raw input string * @returns {Array} Array of little-endian words */ function rstr2binl(input) { var i var output = [] output[(input.length >> 2) - 1] = undefined for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8 for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32 } return output } /** * Calculate the MD5 of a raw string * * @param {string} s Input string * @returns {string} Raw MD5 string */ function rstrMD5(s) { return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)) } /** * Calculates the HMAC-MD5 of a key and some data (raw strings) * * @param {string} key HMAC key * @param {string} data Raw input string * @returns {string} Raw MD5 string */ function rstrHMACMD5(key, data) { var i var bkey = rstr2binl(key) var ipad = [] var opad = [] var hash ipad[15] = opad[15] = undefined if (bkey.length > 16) { bkey = binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636 opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8) return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)) } /** * Convert a raw string to a hex string * * @param {string} input Raw input string * @returns {string} Hex encoded string */ function rstr2hex(input) { var hexTab = '0123456789abcdef' var output = '' var x var i for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i) output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output } /** * Encode a string as UTF-8 * * @param {string} input Input string * @returns {string} UTF8 string */ function str2rstrUTF8(input) { return unescape(encodeURIComponent(input)) } /** * Encodes input string as raw MD5 string * * @param {string} s Input string * @returns {string} Raw MD5 string */ function rawMD5(s) { return rstrMD5(str2rstrUTF8(s)) } /** * Encodes input string as Hex encoded string * * @param {string} s Input string * @returns {string} Hex encoded string */ function hexMD5(s) { return rstr2hex(rawMD5(s)) } /** * Calculates the raw HMAC-MD5 for the given key and data * * @param {string} k HMAC key * @param {string} d Input string * @returns {string} Raw MD5 string */ function rawHMACMD5(k, d) { return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)) } /** * Calculates the Hex encoded HMAC-MD5 for the given key and data * * @param {string} k HMAC key * @param {string} d Input string * @returns {string} Raw MD5 string */ function hexHMACMD5(k, d) { return rstr2hex(rawHMACMD5(k, d)) } /** * Calculates MD5 value for a given string. * If a key is provided, calculates the HMAC-MD5 value. * Returns a Hex encoded string unless the raw argument is given. * * @param {string} string Input string * @param {string} [key] HMAC key * @param {boolean} [raw] Raw output switch * @returns {string} MD5 output */ function md5(string, key, raw) { if (!key) { if (!raw) { return hexMD5(string) } return rawMD5(string) } if (!raw) { return hexHMACMD5(key, string) } return rawHMACMD5(key, string) } if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { return md5 }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) } else {} })(this) /***/ }), /***/ 1981: /***/ (function(module) { !function(e,t){ true?module.exports=t():0}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(r),a=Math.max(i,s),o=0,u=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(o=a-Math.min(i,s)),a-=1;a>=o;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===o)return 0;a-=1}else if(u[0][a]1?i-1:0),a=1;a0){var a=Object.keys(r),u=o.default.find(a,(function(e){return t.isOS(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}var c=o.default.find(a,(function(e){return t.isPlatform(e)}));if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f}}if(s>0){var l=Object.keys(i),h=o.default.find(l,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n};var s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:s.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:s.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:s.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})})); /***/ }), /***/ 3348: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(362); var callBind = __webpack_require__(3784); var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); module.exports = function callBoundIntrinsic(name, allowMissing) { var intrinsic = GetIntrinsic(name, !!allowMissing); if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { return callBind(intrinsic); } return intrinsic; }; /***/ }), /***/ 3784: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(6743); var GetIntrinsic = __webpack_require__(362); var setFunctionLength = __webpack_require__(7238); var $TypeError = __webpack_require__(3502); var $apply = GetIntrinsic('%Function.prototype.apply%'); var $call = GetIntrinsic('%Function.prototype.call%'); var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); var $defineProperty = __webpack_require__(466); var $max = GetIntrinsic('%Math.max%'); module.exports = function callBind(originalFunction) { if (typeof originalFunction !== 'function') { throw new $TypeError('a function is required'); } var func = $reflectApply(bind, $call, arguments); return setFunctionLength( func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), true ); }; var applyBind = function applyBind() { return $reflectApply(bind, $apply, arguments); }; if ($defineProperty) { $defineProperty(module.exports, 'apply', { value: applyBind }); } else { module.exports.apply = applyBind; } /***/ }), /***/ 6504: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $defineProperty = __webpack_require__(466); var $SyntaxError = __webpack_require__(5125); var $TypeError = __webpack_require__(3502); var gopd = __webpack_require__(6270); /** @type {import('.')} */ module.exports = function defineDataProperty( obj, property, value ) { if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { throw new $TypeError('`obj` must be an object or a function`'); } if (typeof property !== 'string' && typeof property !== 'symbol') { throw new $TypeError('`property` must be a string or a symbol`'); } if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); } if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); } if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); } if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { throw new $TypeError('`loose`, if provided, must be a boolean'); } var nonEnumerable = arguments.length > 3 ? arguments[3] : null; var nonWritable = arguments.length > 4 ? arguments[4] : null; var nonConfigurable = arguments.length > 5 ? arguments[5] : null; var loose = arguments.length > 6 ? arguments[6] : false; /* @type {false | TypedPropertyDescriptor} */ var desc = !!gopd && gopd(obj, property); if ($defineProperty) { $defineProperty(obj, property, { configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, value: value, writable: nonWritable === null && desc ? desc.writable : !nonWritable }); } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable obj[property] = value; // eslint-disable-line no-param-reassign } else { throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); } }; /***/ }), /***/ 466: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(362); /** @type {import('.')} */ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false; if ($defineProperty) { try { $defineProperty({}, 'a', { value: 1 }); } catch (e) { // IE 8 has a broken defineProperty $defineProperty = false; } } module.exports = $defineProperty; /***/ }), /***/ 3780: /***/ (function(module) { "use strict"; /** @type {import('./eval')} */ module.exports = EvalError; /***/ }), /***/ 2016: /***/ (function(module) { "use strict"; /** @type {import('.')} */ module.exports = Error; /***/ }), /***/ 7893: /***/ (function(module) { "use strict"; /** @type {import('./range')} */ module.exports = RangeError; /***/ }), /***/ 6637: /***/ (function(module) { "use strict"; /** @type {import('./ref')} */ module.exports = ReferenceError; /***/ }), /***/ 5125: /***/ (function(module) { "use strict"; /** @type {import('./syntax')} */ module.exports = SyntaxError; /***/ }), /***/ 3502: /***/ (function(module) { "use strict"; /** @type {import('./type')} */ module.exports = TypeError; /***/ }), /***/ 9950: /***/ (function(module) { "use strict"; /** @type {import('./uri')} */ module.exports = URIError; /***/ }), /***/ 6441: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; const validator = __webpack_require__(8741); const XMLParser = __webpack_require__(3856); const XMLBuilder = __webpack_require__(2863); module.exports = { XMLParser: XMLParser, XMLValidator: validator, XMLBuilder: XMLBuilder } /***/ }), /***/ 9055: /***/ (function(__unused_webpack_module, exports) { "use strict"; const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040'; const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*' const regexName = new RegExp('^' + nameRegexp + '$'); const getAllMatches = function(string, regex) { const matches = []; let match = regex.exec(string); while (match) { const allmatches = []; allmatches.startIndex = regex.lastIndex - match[0].length; const len = match.length; for (let index = 0; index < len; index++) { allmatches.push(match[index]); } matches.push(allmatches); match = regex.exec(string); } return matches; }; const isName = function(string) { const match = regexName.exec(string); return !(match === null || typeof match === 'undefined'); }; exports.isExist = function(v) { return typeof v !== 'undefined'; }; exports.isEmptyObject = function(obj) { return Object.keys(obj).length === 0; }; /** * Copy all the properties of a into b. * @param {*} target * @param {*} a */ exports.merge = function(target, a, arrayMode) { if (a) { const keys = Object.keys(a); // will return an array of own properties const len = keys.length; //don't make it inline for (let i = 0; i < len; i++) { if (arrayMode === 'strict') { target[keys[i]] = [ a[keys[i]] ]; } else { target[keys[i]] = a[keys[i]]; } } } }; /* exports.merge =function (b,a){ return Object.assign(b,a); } */ exports.getValue = function(v) { if (exports.isExist(v)) { return v; } else { return ''; } }; // const fakeCall = function(a) {return a;}; // const fakeCallNoReturn = function() {}; exports.isName = isName; exports.getAllMatches = getAllMatches; exports.nameRegexp = nameRegexp; /***/ }), /***/ 8741: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; const util = __webpack_require__(9055); const defaultOptions = { allowBooleanAttributes: false, //A tag can have attributes without any value unpairedTags: [] }; //const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g"); exports.validate = function (xmlData, options) { options = Object.assign({}, defaultOptions, options); //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line //xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag //xmlData = xmlData.replace(/()/g,"");//Remove DOCTYPE const tags = []; let tagFound = false; //indicates that the root tag has been closed (aka. depth 0 has been reached) let reachedRoot = false; if (xmlData[0] === '\ufeff') { // check for byte order mark (BOM) xmlData = xmlData.substr(1); } for (let i = 0; i < xmlData.length; i++) { if (xmlData[i] === '<' && xmlData[i+1] === '?') { i+=2; i = readPI(xmlData,i); if (i.err) return i; }else if (xmlData[i] === '<') { //starting of tag //read until you reach to '>' avoiding any '>' in attribute value let tagStartPos = i; i++; if (xmlData[i] === '!') { i = readCommentAndCDATA(xmlData, i); continue; } else { let closingTag = false; if (xmlData[i] === '/') { //closing tag closingTag = true; i++; } //read tagname let tagName = ''; for (; i < xmlData.length && xmlData[i] !== '>' && xmlData[i] !== ' ' && xmlData[i] !== '\t' && xmlData[i] !== '\n' && xmlData[i] !== '\r'; i++ ) { tagName += xmlData[i]; } tagName = tagName.trim(); //console.log(tagName); if (tagName[tagName.length - 1] === '/') { //self closing tag without attributes tagName = tagName.substring(0, tagName.length - 1); //continue; i--; } if (!validateTagName(tagName)) { let msg; if (tagName.trim().length === 0) { msg = "Invalid space after '<'."; } else { msg = "Tag '"+tagName+"' is an invalid name."; } return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i)); } const result = readAttributeStr(xmlData, i); if (result === false) { return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i)); } let attrStr = result.value; i = result.index; if (attrStr[attrStr.length - 1] === '/') { //self closing tag const attrStrStart = i - attrStr.length; attrStr = attrStr.substring(0, attrStr.length - 1); const isValid = validateAttributeString(attrStr, options); if (isValid === true) { tagFound = true; //continue; //text may presents after self closing tag } else { //the result from the nested function returns the position of the error within the attribute //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute //this gives us the absolute index in the entire xml, which we can use to find the line at last return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line)); } } else if (closingTag) { if (!result.tagClosed) { return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); } else if (attrStr.trim().length > 0) { return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos)); } else if (tags.length === 0) { return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos)); } else { const otg = tags.pop(); if (tagName !== otg.tagName) { let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos); return getErrorObject('InvalidTag', "Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.", getLineNumberForPosition(xmlData, tagStartPos)); } //when there are no more tags, we reached the root level. if (tags.length == 0) { reachedRoot = true; } } } else { const isValid = validateAttributeString(attrStr, options); if (isValid !== true) { //the result from the nested function returns the position of the error within the attribute //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute //this gives us the absolute index in the entire xml, which we can use to find the line at last return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); } //if the root level has been reached before ... if (reachedRoot === true) { return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i)); } else if(options.unpairedTags.indexOf(tagName) !== -1){ //don't push into stack } else { tags.push({tagName, tagStartPos}); } tagFound = true; } //skip tag text value //It may include comments and CDATA value for (i++; i < xmlData.length; i++) { if (xmlData[i] === '<') { if (xmlData[i + 1] === '!') { //comment or CADATA i++; i = readCommentAndCDATA(xmlData, i); continue; } else if (xmlData[i+1] === '?') { i = readPI(xmlData, ++i); if (i.err) return i; } else{ break; } } else if (xmlData[i] === '&') { const afterAmp = validateAmpersand(xmlData, i); if (afterAmp == -1) return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); i = afterAmp; }else{ if (reachedRoot === true && !isWhiteSpace(xmlData[i])) { return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i)); } } } //end of reading tag text value if (xmlData[i] === '<') { i--; } } } else { if ( isWhiteSpace(xmlData[i])) { continue; } return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i)); } } if (!tagFound) { return getErrorObject('InvalidXml', 'Start tag expected.', 1); }else if (tags.length == 1) { return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos)); }else if (tags.length > 0) { return getErrorObject('InvalidXml', "Invalid '"+ JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+ "' found.", {line: 1, col: 1}); } return true; }; function isWhiteSpace(char){ return char === ' ' || char === '\t' || char === '\n' || char === '\r'; } /** * Read Processing insstructions and skip * @param {*} xmlData * @param {*} i */ function readPI(xmlData, i) { const start = i; for (; i < xmlData.length; i++) { if (xmlData[i] == '?' || xmlData[i] == ' ') { //tagname const tagname = xmlData.substr(start, i - start); if (i > 5 && tagname === 'xml') { return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i)); } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') { //check if valid attribut string i++; break; } else { continue; } } } return i; } function readCommentAndCDATA(xmlData, i) { if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') { //comment for (i += 3; i < xmlData.length; i++) { if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') { i += 2; break; } } } else if ( xmlData.length > i + 8 && xmlData[i + 1] === 'D' && xmlData[i + 2] === 'O' && xmlData[i + 3] === 'C' && xmlData[i + 4] === 'T' && xmlData[i + 5] === 'Y' && xmlData[i + 6] === 'P' && xmlData[i + 7] === 'E' ) { let angleBracketsCount = 1; for (i += 8; i < xmlData.length; i++) { if (xmlData[i] === '<') { angleBracketsCount++; } else if (xmlData[i] === '>') { angleBracketsCount--; if (angleBracketsCount === 0) { break; } } } } else if ( xmlData.length > i + 9 && xmlData[i + 1] === '[' && xmlData[i + 2] === 'C' && xmlData[i + 3] === 'D' && xmlData[i + 4] === 'A' && xmlData[i + 5] === 'T' && xmlData[i + 6] === 'A' && xmlData[i + 7] === '[' ) { for (i += 8; i < xmlData.length; i++) { if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') { i += 2; break; } } } return i; } const doubleQuote = '"'; const singleQuote = "'"; /** * Keep reading xmlData until '<' is found outside the attribute value. * @param {string} xmlData * @param {number} i */ function readAttributeStr(xmlData, i) { let attrStr = ''; let startChar = ''; let tagClosed = false; for (; i < xmlData.length; i++) { if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { if (startChar === '') { startChar = xmlData[i]; } else if (startChar !== xmlData[i]) { //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa } else { startChar = ''; } } else if (xmlData[i] === '>') { if (startChar === '') { tagClosed = true; break; } } attrStr += xmlData[i]; } if (startChar !== '') { return false; } return { value: attrStr, index: i, tagClosed: tagClosed }; } /** * Select all the attributes whether valid or invalid. */ const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g'); //attr, ="sd", a="amit's", a="sd"b="saf", ab cd="" function validateAttributeString(attrStr, options) { //console.log("start:"+attrStr+":end"); //if(attrStr.trim().length === 0) return true; //empty string const matches = util.getAllMatches(attrStr, validAttrStrRegxp); const attrNames = {}; for (let i = 0; i < matches.length; i++) { if (matches[i][1].length === 0) { //nospace before attribute name: a="sd"b="saf" return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i])) } else if (matches[i][3] !== undefined && matches[i][4] === undefined) { return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' is without value.", getPositionFromMatch(matches[i])); } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) { //independent attribute: ab return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i])); } /* else if(matches[i][6] === undefined){//attribute without value: ab= return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}}; } */ const attrName = matches[i][2]; if (!validateAttrName(attrName)) { return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i])); } if (!attrNames.hasOwnProperty(attrName)) { //check for duplicate attribute. attrNames[attrName] = 1; } else { return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i])); } } return true; } function validateNumberAmpersand(xmlData, i) { let re = /\d/; if (xmlData[i] === 'x') { i++; re = /[\da-fA-F]/; } for (; i < xmlData.length; i++) { if (xmlData[i] === ';') return i; if (!xmlData[i].match(re)) break; } return -1; } function validateAmpersand(xmlData, i) { // https://www.w3.org/TR/xml/#dt-charref i++; if (xmlData[i] === ';') return -1; if (xmlData[i] === '#') { i++; return validateNumberAmpersand(xmlData, i); } let count = 0; for (; i < xmlData.length; i++, count++) { if (xmlData[i].match(/\w/) && count < 20) continue; if (xmlData[i] === ';') break; return -1; } return i; } function getErrorObject(code, message, lineNumber) { return { err: { code: code, msg: message, line: lineNumber.line || lineNumber, col: lineNumber.col, }, }; } function validateAttrName(attrName) { return util.isName(attrName); } // const startsWithXML = /^xml/i; function validateTagName(tagname) { return util.isName(tagname) /* && !tagname.match(startsWithXML) */; } //this function returns the line number for the character at the given index function getLineNumberForPosition(xmlData, index) { const lines = xmlData.substring(0, index).split(/\r?\n/); return { line: lines.length, // column number is last line's length + 1, because column numbering starts at 1: col: lines[lines.length - 1].length + 1 }; } //this function returns the position of the first character of match within attrStr function getPositionFromMatch(match) { return match.startIndex + match[1].length; } /***/ }), /***/ 2863: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; //parse Empty Node as self closing node const buildFromOrderedJs = __webpack_require__(3977); const defaultOptions = { attributeNamePrefix: '@_', attributesGroupName: false, textNodeName: '#text', ignoreAttributes: true, cdataPropName: false, format: false, indentBy: ' ', suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(key, a) { return a; }, attributeValueProcessor: function(attrName, a) { return a; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [ { regex: new RegExp("&", "g"), val: "&" },//it must be on top { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("\'", "g"), val: "'" }, { regex: new RegExp("\"", "g"), val: """ } ], processEntities: true, stopNodes: [], // transformTagName: false, // transformAttributeName: false, oneListGroup: false }; function Builder(options) { this.options = Object.assign({}, defaultOptions, options); if (this.options.ignoreAttributes || this.options.attributesGroupName) { this.isAttribute = function(/*a*/) { return false; }; } else { this.attrPrefixLen = this.options.attributeNamePrefix.length; this.isAttribute = isAttribute; } this.processTextOrObjNode = processTextOrObjNode if (this.options.format) { this.indentate = indentate; this.tagEndChar = '>\n'; this.newLine = '\n'; } else { this.indentate = function() { return ''; }; this.tagEndChar = '>'; this.newLine = ''; } } Builder.prototype.build = function(jObj) { if(this.options.preserveOrder){ return buildFromOrderedJs(jObj, this.options); }else { if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){ jObj = { [this.options.arrayNodeName] : jObj } } return this.j2x(jObj, 0).val; } }; Builder.prototype.j2x = function(jObj, level) { let attrStr = ''; let val = ''; for (let key in jObj) { if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue; if (typeof jObj[key] === 'undefined') { // supress undefined node only if it is not an attribute if (this.isAttribute(key)) { val += ''; } } else if (jObj[key] === null) { // null attribute should be ignored by the attribute list, but should not cause the tag closing if (this.isAttribute(key)) { val += ''; } else if (key[0] === '?') { val += this.indentate(level) + '<' + key + '?' + this.tagEndChar; } else { val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; } // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; } else if (jObj[key] instanceof Date) { val += this.buildTextValNode(jObj[key], key, '', level); } else if (typeof jObj[key] !== 'object') { //premitive type const attr = this.isAttribute(key); if (attr) { attrStr += this.buildAttrPairStr(attr, '' + jObj[key]); }else { //tag value if (key === this.options.textNodeName) { let newval = this.options.tagValueProcessor(key, '' + jObj[key]); val += this.replaceEntitiesValue(newval); } else { val += this.buildTextValNode(jObj[key], key, '', level); } } } else if (Array.isArray(jObj[key])) { //repeated nodes const arrLen = jObj[key].length; let listTagVal = ""; let listTagAttr = ""; for (let j = 0; j < arrLen; j++) { const item = jObj[key][j]; if (typeof item === 'undefined') { // supress undefined node } else if (item === null) { if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar; else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; } else if (typeof item === 'object') { if(this.options.oneListGroup){ const result = this.j2x(item, level + 1); listTagVal += result.val; if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) { listTagAttr += result.attrStr } }else{ listTagVal += this.processTextOrObjNode(item, key, level) } } else { if (this.options.oneListGroup) { let textValue = this.options.tagValueProcessor(key, item); textValue = this.replaceEntitiesValue(textValue); listTagVal += textValue; } else { listTagVal += this.buildTextValNode(item, key, '', level); } } } if(this.options.oneListGroup){ listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level); } val += listTagVal; } else { //nested node if (this.options.attributesGroupName && key === this.options.attributesGroupName) { const Ks = Object.keys(jObj[key]); const L = Ks.length; for (let j = 0; j < L; j++) { attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]); } } else { val += this.processTextOrObjNode(jObj[key], key, level) } } } return {attrStr: attrStr, val: val}; }; Builder.prototype.buildAttrPairStr = function(attrName, val){ val = this.options.attributeValueProcessor(attrName, '' + val); val = this.replaceEntitiesValue(val); if (this.options.suppressBooleanAttributes && val === "true") { return ' ' + attrName; } else return ' ' + attrName + '="' + val + '"'; } function processTextOrObjNode (object, key, level) { const result = this.j2x(object, level + 1); if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) { return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); } else { return this.buildObjectNode(result.val, key, result.attrStr, level); } } Builder.prototype.buildObjectNode = function(val, key, attrStr, level) { if(val === ""){ if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; else { return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar; } }else{ let tagEndExp = '' + val + tagEndExp ); } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { return this.indentate(level) + `` + this.newLine; }else { return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar + val + this.indentate(level) + tagEndExp ); } } } Builder.prototype.closeTag = function(key){ let closeTag = ""; if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired if(!this.options.suppressUnpairedNode) closeTag = "/" }else if(this.options.suppressEmptyNode){ //empty closeTag = "/"; }else{ closeTag = `>` + this.newLine; }else if (this.options.commentPropName !== false && key === this.options.commentPropName) { return this.indentate(level) + `` + this.newLine; }else if(key[0] === "?") {//PI tag return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; }else{ let textValue = this.options.tagValueProcessor(key, val); textValue = this.replaceEntitiesValue(textValue); if( textValue === ''){ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar; }else{ return this.indentate(level) + '<' + key + attrStr + '>' + textValue + ' 0 && this.options.processEntities){ for (let i=0; i 0) { indentation = EOL; } return arrToStr(jArray, options, "", indentation); } function arrToStr(arr, options, jPath, indentation) { let xmlStr = ""; let isPreviousElementTag = false; for (let i = 0; i < arr.length; i++) { const tagObj = arr[i]; const tagName = propName(tagObj); if(tagName === undefined) continue; let newJPath = ""; if (jPath.length === 0) newJPath = tagName else newJPath = `${jPath}.${tagName}`; if (tagName === options.textNodeName) { let tagText = tagObj[tagName]; if (!isStopNode(newJPath, options)) { tagText = options.tagValueProcessor(tagName, tagText); tagText = replaceEntitiesValue(tagText, options); } if (isPreviousElementTag) { xmlStr += indentation; } xmlStr += tagText; isPreviousElementTag = false; continue; } else if (tagName === options.cdataPropName) { if (isPreviousElementTag) { xmlStr += indentation; } xmlStr += ``; isPreviousElementTag = false; continue; } else if (tagName === options.commentPropName) { xmlStr += indentation + ``; isPreviousElementTag = true; continue; } else if (tagName[0] === "?") { const attStr = attr_to_str(tagObj[":@"], options); const tempInd = tagName === "?xml" ? "" : indentation; let piTextNodeName = tagObj[tagName][0][options.textNodeName]; piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`; isPreviousElementTag = true; continue; } let newIdentation = indentation; if (newIdentation !== "") { newIdentation += options.indentBy; } const attStr = attr_to_str(tagObj[":@"], options); const tagStart = indentation + `<${tagName}${attStr}`; const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); if (options.unpairedTags.indexOf(tagName) !== -1) { if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; else xmlStr += tagStart + "/>"; } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { xmlStr += tagStart + "/>"; } else if (tagValue && tagValue.endsWith(">")) { xmlStr += tagStart + `>${tagValue}${indentation}`; } else { xmlStr += tagStart + ">"; if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("`; } isPreviousElementTag = true; } return xmlStr; } function propName(obj) { const keys = Object.keys(obj); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if(!obj.hasOwnProperty(key)) continue; if (key !== ":@") return key; } } function attr_to_str(attrMap, options) { let attrStr = ""; if (attrMap && !options.ignoreAttributes) { for (let attr in attrMap) { if(!attrMap.hasOwnProperty(attr)) continue; let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); attrVal = replaceEntitiesValue(attrVal, options); if (attrVal === true && options.suppressBooleanAttributes) { attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; } else { attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; } } } return attrStr; } function isStopNode(jPath, options) { jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); for (let index in options.stopNodes) { if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; } return false; } function replaceEntitiesValue(textValue, options) { if (textValue && textValue.length > 0 && options.processEntities) { for (let i = 0; i < options.entities.length; i++) { const entity = options.entities[i]; textValue = textValue.replace(entity.regex, entity.val); } } return textValue; } module.exports = toXml; /***/ }), /***/ 6755: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const util = __webpack_require__(9055); //TODO: handle comments function readDocType(xmlData, i){ const entities = {}; if( xmlData[i + 3] === 'O' && xmlData[i + 4] === 'C' && xmlData[i + 5] === 'T' && xmlData[i + 6] === 'Y' && xmlData[i + 7] === 'P' && xmlData[i + 8] === 'E') { i = i+9; let angleBracketsCount = 1; let hasBody = false, comment = false; let exp = ""; for(;i') { //Read tag content if(comment){ if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){ comment = false; angleBracketsCount--; } }else{ angleBracketsCount--; } if (angleBracketsCount === 0) { break; } }else if( xmlData[i] === '['){ hasBody = true; }else{ exp += xmlData[i]; } } if(angleBracketsCount !== 0){ throw new Error(`Unclosed DOCTYPE`); } }else{ throw new Error(`Invalid Tag instead of DOCTYPE`); } return {entities, i}; } function readEntityExp(xmlData,i){ //External entities are not supported // //Parameter entities are not supported // //Internal entities are supported // //read EntityName let entityName = ""; for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) { // if(xmlData[i] === " ") continue; // else entityName += xmlData[i]; } entityName = entityName.trim(); if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported"); //read Entity Value const startChar = xmlData[i++]; let val = "" for (; i < xmlData.length && xmlData[i] !== startChar ; i++) { val += xmlData[i]; } return [entityName, val, i]; } function isComment(xmlData, i){ if(xmlData[i+1] === '!' && xmlData[i+2] === '-' && xmlData[i+3] === '-') return true return false } function isEntity(xmlData, i){ if(xmlData[i+1] === '!' && xmlData[i+2] === 'E' && xmlData[i+3] === 'N' && xmlData[i+4] === 'T' && xmlData[i+5] === 'I' && xmlData[i+6] === 'T' && xmlData[i+7] === 'Y') return true return false } function isElement(xmlData, i){ if(xmlData[i+1] === '!' && xmlData[i+2] === 'E' && xmlData[i+3] === 'L' && xmlData[i+4] === 'E' && xmlData[i+5] === 'M' && xmlData[i+6] === 'E' && xmlData[i+7] === 'N' && xmlData[i+8] === 'T') return true return false } function isAttlist(xmlData, i){ if(xmlData[i+1] === '!' && xmlData[i+2] === 'A' && xmlData[i+3] === 'T' && xmlData[i+4] === 'T' && xmlData[i+5] === 'L' && xmlData[i+6] === 'I' && xmlData[i+7] === 'S' && xmlData[i+8] === 'T') return true return false } function isNotation(xmlData, i){ if(xmlData[i+1] === '!' && xmlData[i+2] === 'N' && xmlData[i+3] === 'O' && xmlData[i+4] === 'T' && xmlData[i+5] === 'A' && xmlData[i+6] === 'T' && xmlData[i+7] === 'I' && xmlData[i+8] === 'O' && xmlData[i+9] === 'N') return true return false } function validateEntityName(name){ if (util.isName(name)) return name; else throw new Error(`Invalid entity name ${name}`); } module.exports = readDocType; /***/ }), /***/ 7773: /***/ (function(__unused_webpack_module, exports) { const defaultOptions = { preserveOrder: false, attributeNamePrefix: '@_', attributesGroupName: false, textNodeName: '#text', ignoreAttributes: true, removeNSPrefix: false, // remove NS from tag name or attribute name if true allowBooleanAttributes: false, //a tag can have attributes without any value //ignoreRootElement : false, parseTagValue: true, parseAttributeValue: false, trimValues: true, //Trim string values of tag and attributes cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(tagName, val) { return val; }, attributeValueProcessor: function(attrName, val) { return val; }, stopNodes: [], //nested tags will not be parsed even for errors alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(tagName, jPath, attrs){ return tagName }, // skipEmptyListItem: false }; const buildOptions = function(options) { return Object.assign({}, defaultOptions, options); }; exports.buildOptions = buildOptions; exports.defaultOptions = defaultOptions; /***/ }), /***/ 3949: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; ///@ts-check const util = __webpack_require__(9055); const xmlNode = __webpack_require__(9935); const readDocType = __webpack_require__(6755); const toNumber = __webpack_require__(9620); // const regx = // '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)' // .replace(/NAME/g, util.nameRegexp); //const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g"); //const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g"); class OrderedObjParser{ constructor(options){ this.options = options; this.currentNode = null; this.tagsNodeStack = []; this.docTypeEntities = {}; this.lastEntities = { "apos" : { regex: /&(apos|#39|#x27);/g, val : "'"}, "gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"}, "lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"}, "quot" : { regex: /&(quot|#34|#x22);/g, val : "\""}, }; this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"}; this.htmlEntities = { "space": { regex: /&(nbsp|#160);/g, val: " " }, // "lt" : { regex: /&(lt|#60);/g, val: "<" }, // "gt" : { regex: /&(gt|#62);/g, val: ">" }, // "amp" : { regex: /&(amp|#38);/g, val: "&" }, // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, // "apos" : { regex: /&(apos|#39);/g, val: "'" }, "cent" : { regex: /&(cent|#162);/g, val: "¢" }, "pound" : { regex: /&(pound|#163);/g, val: "£" }, "yen" : { regex: /&(yen|#165);/g, val: "¥" }, "euro" : { regex: /&(euro|#8364);/g, val: "€" }, "copyright" : { regex: /&(copy|#169);/g, val: "©" }, "reg" : { regex: /&(reg|#174);/g, val: "®" }, "inr" : { regex: /&(inr|#8377);/g, val: "₹" }, "num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) }, "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) }, }; this.addExternalEntities = addExternalEntities; this.parseXml = parseXml; this.parseTextData = parseTextData; this.resolveNameSpace = resolveNameSpace; this.buildAttributesMap = buildAttributesMap; this.isItStopNode = isItStopNode; this.replaceEntitiesValue = replaceEntitiesValue; this.readStopNodeData = readStopNodeData; this.saveTextToParentTag = saveTextToParentTag; this.addChild = addChild; } } function addExternalEntities(externalEntities){ const entKeys = Object.keys(externalEntities); for (let i = 0; i < entKeys.length; i++) { const ent = entKeys[i]; this.lastEntities[ent] = { regex: new RegExp("&"+ent+";","g"), val : externalEntities[ent] } } } /** * @param {string} val * @param {string} tagName * @param {string} jPath * @param {boolean} dontTrim * @param {boolean} hasAttributes * @param {boolean} isLeafNode * @param {boolean} escapeEntities */ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) { if (val !== undefined) { if (this.options.trimValues && !dontTrim) { val = val.trim(); } if(val.length > 0){ if(!escapeEntities) val = this.replaceEntitiesValue(val); const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode); if(newval === null || newval === undefined){ //don't parse return val; }else if(typeof newval !== typeof val || newval !== val){ //overwrite return newval; }else if(this.options.trimValues){ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions); }else{ const trimmedVal = val.trim(); if(trimmedVal === val){ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions); }else{ return val; } } } } } function resolveNameSpace(tagname) { if (this.options.removeNSPrefix) { const tags = tagname.split(':'); const prefix = tagname.charAt(0) === '/' ? '/' : ''; if (tags[0] === 'xmlns') { return ''; } if (tags.length === 2) { tagname = prefix + tags[1]; } } return tagname; } //TODO: change regex to capture NS //const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm"); const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm'); function buildAttributesMap(attrStr, jPath, tagName) { if (!this.options.ignoreAttributes && typeof attrStr === 'string') { // attrStr = attrStr.replace(/\r?\n/g, ' '); //attrStr = attrStr || attrStr.trim(); const matches = util.getAllMatches(attrStr, attrsRegx); const len = matches.length; //don't make it inline const attrs = {}; for (let i = 0; i < len; i++) { const attrName = this.resolveNameSpace(matches[i][1]); let oldVal = matches[i][4]; let aName = this.options.attributeNamePrefix + attrName; if (attrName.length) { if (this.options.transformAttributeName) { aName = this.options.transformAttributeName(aName); } if(aName === "__proto__") aName = "#__proto__"; if (oldVal !== undefined) { if (this.options.trimValues) { oldVal = oldVal.trim(); } oldVal = this.replaceEntitiesValue(oldVal); const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath); if(newVal === null || newVal === undefined){ //don't parse attrs[aName] = oldVal; }else if(typeof newVal !== typeof oldVal || newVal !== oldVal){ //overwrite attrs[aName] = newVal; }else{ //parse attrs[aName] = parseValue( oldVal, this.options.parseAttributeValue, this.options.numberParseOptions ); } } else if (this.options.allowBooleanAttributes) { attrs[aName] = true; } } } if (!Object.keys(attrs).length) { return; } if (this.options.attributesGroupName) { const attrCollection = {}; attrCollection[this.options.attributesGroupName] = attrs; return attrCollection; } return attrs } } const parseXml = function(xmlData) { xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line const xmlObj = new xmlNode('!xml'); let currentNode = xmlObj; let textData = ""; let jPath = ""; for(let i=0; i< xmlData.length; i++){//for each char in XML data const ch = xmlData[i]; if(ch === '<'){ // const nextIndex = i+1; // const _2ndChar = xmlData[nextIndex]; if( xmlData[i+1] === '/') {//Closing Tag const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.") let tagName = xmlData.substring(i+2,closeIndex).trim(); if(this.options.removeNSPrefix){ const colonIndex = tagName.indexOf(":"); if(colonIndex !== -1){ tagName = tagName.substr(colonIndex+1); } } if(this.options.transformTagName) { tagName = this.options.transformTagName(tagName); } if(currentNode){ textData = this.saveTextToParentTag(textData, currentNode, jPath); } //check if last tag of nested tag was unpaired tag const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1); if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){ throw new Error(`Unpaired tag can not be used as closing tag: `); } let propIndex = 0 if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){ propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1) this.tagsNodeStack.pop(); }else{ propIndex = jPath.lastIndexOf("."); } jPath = jPath.substring(0, propIndex); currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope textData = ""; i = closeIndex; } else if( xmlData[i+1] === '?') { let tagData = readTagExp(xmlData,i, false, "?>"); if(!tagData) throw new Error("Pi Tag is not closed."); textData = this.saveTextToParentTag(textData, currentNode, jPath); if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){ }else{ const childNode = new xmlNode(tagData.tagName); childNode.add(this.options.textNodeName, ""); if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); } this.addChild(currentNode, childNode, jPath) } i = tagData.closeIndex + 1; } else if(xmlData.substr(i + 1, 3) === '!--') { const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.") if(this.options.commentPropName){ const comment = xmlData.substring(i + 4, endIndex - 2); textData = this.saveTextToParentTag(textData, currentNode, jPath); currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]); } i = endIndex; } else if( xmlData.substr(i + 1, 2) === '!D') { const result = readDocType(xmlData, i); this.docTypeEntities = result.entities; i = result.i; }else if(xmlData.substr(i + 1, 2) === '![') { const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2; const tagExp = xmlData.substring(i + 9,closeIndex); textData = this.saveTextToParentTag(textData, currentNode, jPath); let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true); if(val == undefined) val = ""; //cdata should be set even if it is 0 length string if(this.options.cdataPropName){ currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]); }else{ currentNode.add(this.options.textNodeName, val); } i = closeIndex + 2; }else {//Opening tag let result = readTagExp(xmlData,i, this.options.removeNSPrefix); let tagName= result.tagName; const rawTagName = result.rawTagName; let tagExp = result.tagExp; let attrExpPresent = result.attrExpPresent; let closeIndex = result.closeIndex; if (this.options.transformTagName) { tagName = this.options.transformTagName(tagName); } //save text as child node if (currentNode && textData) { if(currentNode.tagname !== '!xml'){ //when nested tag is found textData = this.saveTextToParentTag(textData, currentNode, jPath, false); } } //check if last tag was unpaired tag const lastTag = currentNode; if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){ currentNode = this.tagsNodeStack.pop(); jPath = jPath.substring(0, jPath.lastIndexOf(".")); } if(tagName !== xmlObj.tagname){ jPath += jPath ? "." + tagName : tagName; } if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { let tagContent = ""; //self-closing tag if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/' tagName = tagName.substr(0, tagName.length - 1); jPath = jPath.substr(0, jPath.length - 1); tagExp = tagName; }else{ tagExp = tagExp.substr(0, tagExp.length - 1); } i = result.closeIndex; } //unpaired tag else if(this.options.unpairedTags.indexOf(tagName) !== -1){ i = result.closeIndex; } //normal tag else{ //read until closing tag is found const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1); if(!result) throw new Error(`Unexpected end of ${rawTagName}`); i = result.i; tagContent = result.tagContent; } const childNode = new xmlNode(tagName); if(tagName !== tagExp && attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); } if(tagContent) { tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); } jPath = jPath.substr(0, jPath.lastIndexOf(".")); childNode.add(this.options.textNodeName, tagContent); this.addChild(currentNode, childNode, jPath) }else{ //selfClosing tag if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/' tagName = tagName.substr(0, tagName.length - 1); jPath = jPath.substr(0, jPath.length - 1); tagExp = tagName; }else{ tagExp = tagExp.substr(0, tagExp.length - 1); } if(this.options.transformTagName) { tagName = this.options.transformTagName(tagName); } const childNode = new xmlNode(tagName); if(tagName !== tagExp && attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); } this.addChild(currentNode, childNode, jPath) jPath = jPath.substr(0, jPath.lastIndexOf(".")); } //opening tag else{ const childNode = new xmlNode( tagName); this.tagsNodeStack.push(currentNode); if(tagName !== tagExp && attrExpPresent){ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); } this.addChild(currentNode, childNode, jPath) currentNode = childNode; } textData = ""; i = closeIndex; } } }else{ textData += xmlData[i]; } } return xmlObj.child; } function addChild(currentNode, childNode, jPath){ const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]) if(result === false){ }else if(typeof result === "string"){ childNode.tagname = result currentNode.addChild(childNode); }else{ currentNode.addChild(childNode); } } const replaceEntitiesValue = function(val){ if(this.options.processEntities){ for(let entityName in this.docTypeEntities){ const entity = this.docTypeEntities[entityName]; val = val.replace( entity.regx, entity.val); } for(let entityName in this.lastEntities){ const entity = this.lastEntities[entityName]; val = val.replace( entity.regex, entity.val); } if(this.options.htmlEntities){ for(let entityName in this.htmlEntities){ const entity = this.htmlEntities[entityName]; val = val.replace( entity.regex, entity.val); } } val = val.replace( this.ampEntity.regex, this.ampEntity.val); } return val; } function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { if (textData) { //store previously collected data as textNode if(isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0 textData = this.parseTextData(textData, currentNode.tagname, jPath, false, currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, isLeafNode); if (textData !== undefined && textData !== "") currentNode.add(this.options.textNodeName, textData); textData = ""; } return textData; } //TODO: use jPath to simplify the logic /** * * @param {string[]} stopNodes * @param {string} jPath * @param {string} currentTagName */ function isItStopNode(stopNodes, jPath, currentTagName){ const allNodesExp = "*." + currentTagName; for (const stopNodePath in stopNodes) { const stopNodeExp = stopNodes[stopNodePath]; if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true; } return false; } /** * Returns the tag Expression and where it is ending handling single-double quotes situation * @param {string} xmlData * @param {number} i starting index * @returns */ function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){ let attrBoundary; let tagExp = ""; for (let index = i; index < xmlData.length; index++) { let ch = xmlData[index]; if (attrBoundary) { if (ch === attrBoundary) attrBoundary = "";//reset } else if (ch === '"' || ch === "'") { attrBoundary = ch; } else if (ch === closingChar[0]) { if(closingChar[1]){ if(xmlData[index + 1] === closingChar[1]){ return { data: tagExp, index: index } } }else{ return { data: tagExp, index: index } } } else if (ch === '\t') { ch = " " } tagExp += ch; } } function findClosingIndex(xmlData, str, i, errMsg){ const closingIndex = xmlData.indexOf(str, i); if(closingIndex === -1){ throw new Error(errMsg) }else{ return closingIndex + str.length - 1; } } function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){ const result = tagExpWithClosingIndex(xmlData, i+1, closingChar); if(!result) return; let tagExp = result.data; const closeIndex = result.index; const separatorIndex = tagExp.search(/\s/); let tagName = tagExp; let attrExpPresent = true; if(separatorIndex !== -1){//separate tag name and attributes expression tagName = tagExp.substring(0, separatorIndex); tagExp = tagExp.substring(separatorIndex + 1).trimStart(); } const rawTagName = tagName; if(removeNSPrefix){ const colonIndex = tagName.indexOf(":"); if(colonIndex !== -1){ tagName = tagName.substr(colonIndex+1); attrExpPresent = tagName !== result.data.substr(colonIndex + 1); } } return { tagName: tagName, tagExp: tagExp, closeIndex: closeIndex, attrExpPresent: attrExpPresent, rawTagName: rawTagName, } } /** * find paired tag for a stop node * @param {string} xmlData * @param {string} tagName * @param {number} i */ function readStopNodeData(xmlData, tagName, i){ const startIndex = i; // Starting at 1 since we already have an open tag let openTagCount = 1; for (; i < xmlData.length; i++) { if( xmlData[i] === "<"){ if (xmlData[i+1] === "/") {//close tag const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); let closeTagName = xmlData.substring(i+2,closeIndex).trim(); if(closeTagName === tagName){ openTagCount--; if (openTagCount === 0) { return { tagContent: xmlData.substring(startIndex, i), i : closeIndex } } } i=closeIndex; } else if(xmlData[i+1] === '?') { const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.") i=closeIndex; } else if(xmlData.substr(i + 1, 3) === '!--') { const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.") i=closeIndex; } else if(xmlData.substr(i + 1, 2) === '![') { const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; i=closeIndex; } else { const tagData = readTagExp(xmlData, i, '>') if (tagData) { const openTagName = tagData && tagData.tagName; if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") { openTagCount++; } i=tagData.closeIndex; } } } }//end for loop } function parseValue(val, shouldParse, options) { if (shouldParse && typeof val === 'string') { //console.log(options) const newval = val.trim(); if(newval === 'true' ) return true; else if(newval === 'false' ) return false; else return toNumber(val, options); } else { if (util.isExist(val)) { return val; } else { return ''; } } } module.exports = OrderedObjParser; /***/ }), /***/ 3856: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const { buildOptions} = __webpack_require__(7773); const OrderedObjParser = __webpack_require__(3949); const { prettify} = __webpack_require__(4366); const validator = __webpack_require__(8741); class XMLParser{ constructor(options){ this.externalEntities = {}; this.options = buildOptions(options); } /** * Parse XML dats to JS object * @param {string|Buffer} xmlData * @param {boolean|Object} validationOption */ parse(xmlData,validationOption){ if(typeof xmlData === "string"){ }else if( xmlData.toString){ xmlData = xmlData.toString(); }else{ throw new Error("XML data is accepted in String or Bytes[] form.") } if( validationOption){ if(validationOption === true) validationOption = {}; //validate with default options const result = validator.validate(xmlData, validationOption); if (result !== true) { throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` ) } } const orderedObjParser = new OrderedObjParser(this.options); orderedObjParser.addExternalEntities(this.externalEntities); const orderedResult = orderedObjParser.parseXml(xmlData); if(this.options.preserveOrder || orderedResult === undefined) return orderedResult; else return prettify(orderedResult, this.options); } /** * Add Entity which is not by default supported by this library * @param {string} key * @param {string} value */ addEntity(key, value){ if(value.indexOf("&") !== -1){ throw new Error("Entity value can't have '&'") }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '") }else if(value === "&"){ throw new Error("An entity with value '&' is not permitted"); }else{ this.externalEntities[key] = value; } } } module.exports = XMLParser; /***/ }), /***/ 4366: /***/ (function(__unused_webpack_module, exports) { "use strict"; /** * * @param {array} node * @param {any} options * @returns */ function prettify(node, options){ return compress( node, options); } /** * * @param {array} arr * @param {object} options * @param {string} jPath * @returns object */ function compress(arr, options, jPath){ let text; const compressedObj = {}; for (let i = 0; i < arr.length; i++) { const tagObj = arr[i]; const property = propName(tagObj); let newJpath = ""; if(jPath === undefined) newJpath = property; else newJpath = jPath + "." + property; if(property === options.textNodeName){ if(text === undefined) text = tagObj[property]; else text += "" + tagObj[property]; }else if(property === undefined){ continue; }else if(tagObj[property]){ let val = compress(tagObj[property], options, newJpath); const isLeaf = isLeafTag(val, options); if(tagObj[":@"]){ assignAttributes( val, tagObj[":@"], newJpath, options); }else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){ val = val[options.textNodeName]; }else if(Object.keys(val).length === 0){ if(options.alwaysCreateTextNode) val[options.textNodeName] = ""; else val = ""; } if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) { if(!Array.isArray(compressedObj[property])) { compressedObj[property] = [ compressedObj[property] ]; } compressedObj[property].push(val); }else{ //TODO: if a node is not an array, then check if it should be an array //also determine if it is a leaf node if (options.isArray(property, newJpath, isLeaf )) { compressedObj[property] = [val]; }else{ compressedObj[property] = val; } } } } // if(text && text.length > 0) compressedObj[options.textNodeName] = text; if(typeof text === "string"){ if(text.length > 0) compressedObj[options.textNodeName] = text; }else if(text !== undefined) compressedObj[options.textNodeName] = text; return compressedObj; } function propName(obj){ const keys = Object.keys(obj); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if(key !== ":@") return key; } } function assignAttributes(obj, attrMap, jpath, options){ if (attrMap) { const keys = Object.keys(attrMap); const len = keys.length; //don't make it inline for (let i = 0; i < len; i++) { const atrrName = keys[i]; if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) { obj[atrrName] = [ attrMap[atrrName] ]; } else { obj[atrrName] = attrMap[atrrName]; } } } } function isLeafTag(obj, options){ const { textNodeName } = options; const propCount = Object.keys(obj).length; if (propCount === 0) { return true; } if ( propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0) ) { return true; } return false; } exports.prettify = prettify; /***/ }), /***/ 9935: /***/ (function(module) { "use strict"; class XmlNode{ constructor(tagname) { this.tagname = tagname; this.child = []; //nested tags, text, cdata, comments in order this[":@"] = {}; //attributes map } add(key,val){ // this.child.push( {name : key, val: val, isCdata: isCdata }); if(key === "__proto__") key = "#__proto__"; this.child.push( {[key]: val }); } addChild(node) { if(node.tagname === "__proto__") node.tagname = "#__proto__"; if(node[":@"] && Object.keys(node[":@"]).length > 0){ this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] }); }else{ this.child.push( { [node.tagname]: node.child }); } }; }; module.exports = XmlNode; /***/ }), /***/ 8535: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(5575); var toStr = Object.prototype.toString; var hasOwnProperty = Object.prototype.hasOwnProperty; var forEachArray = function forEachArray(array, iterator, receiver) { for (var i = 0, len = array.length; i < len; i++) { if (hasOwnProperty.call(array, i)) { if (receiver == null) { iterator(array[i], i, array); } else { iterator.call(receiver, array[i], i, array); } } } }; var forEachString = function forEachString(string, iterator, receiver) { for (var i = 0, len = string.length; i < len; i++) { // no such thing as a sparse string. if (receiver == null) { iterator(string.charAt(i), i, string); } else { iterator.call(receiver, string.charAt(i), i, string); } } }; var forEachObject = function forEachObject(object, iterator, receiver) { for (var k in object) { if (hasOwnProperty.call(object, k)) { if (receiver == null) { iterator(object[k], k, object); } else { iterator.call(receiver, object[k], k, object); } } } }; var forEach = function forEach(list, iterator, thisArg) { if (!isCallable(iterator)) { throw new TypeError('iterator must be a function'); } var receiver; if (arguments.length >= 3) { receiver = thisArg; } if (toStr.call(list) === '[object Array]') { forEachArray(list, iterator, receiver); } else if (typeof list === 'string') { forEachString(list, iterator, receiver); } else { forEachObject(list, iterator, receiver); } }; module.exports = forEach; /***/ }), /***/ 362: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var undefined; var $Error = __webpack_require__(2016); var $EvalError = __webpack_require__(3780); var $RangeError = __webpack_require__(7893); var $ReferenceError = __webpack_require__(6637); var $SyntaxError = __webpack_require__(5125); var $TypeError = __webpack_require__(3502); var $URIError = __webpack_require__(9950); var $Function = Function; // eslint-disable-next-line consistent-return var getEvalledConstructor = function (expressionSyntax) { try { return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); } catch (e) {} }; var $gOPD = Object.getOwnPropertyDescriptor; if ($gOPD) { try { $gOPD({}, ''); } catch (e) { $gOPD = null; // this is IE 8, which has a broken gOPD } } var throwTypeError = function () { throw new $TypeError(); }; var ThrowTypeError = $gOPD ? (function () { try { // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties arguments.callee; // IE 8 does not throw here return throwTypeError; } catch (calleeThrows) { try { // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') return $gOPD(arguments, 'callee').get; } catch (gOPDthrows) { return throwTypeError; } } }()) : throwTypeError; var hasSymbols = __webpack_require__(68)(); var hasProto = __webpack_require__(5695)(); var getProto = Object.getPrototypeOf || ( hasProto ? function (x) { return x.__proto__; } // eslint-disable-line no-proto : null ); var needsEval = {}; var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); var INTRINSICS = { __proto__: null, '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, '%AsyncFromSyncIteratorPrototype%': undefined, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, '%AsyncGeneratorFunction%': needsEval, '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, '%Date%': Date, '%decodeURI%': decodeURI, '%decodeURIComponent%': decodeURIComponent, '%encodeURI%': encodeURI, '%encodeURIComponent%': encodeURIComponent, '%Error%': $Error, '%eval%': eval, // eslint-disable-line no-eval '%EvalError%': $EvalError, '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, '%Function%': $Function, '%GeneratorFunction%': needsEval, '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, '%JSON%': typeof JSON === 'object' ? JSON : undefined, '%Map%': typeof Map === 'undefined' ? undefined : Map, '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': Object, '%parseFloat%': parseFloat, '%parseInt%': parseInt, '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, '%RangeError%': $RangeError, '%ReferenceError%': $ReferenceError, '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined : Set, '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '%String%': String, '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, '%Symbol%': hasSymbols ? Symbol : undefined, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, '%TypedArray%': TypedArray, '%TypeError%': $TypeError, '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, '%URIError%': $URIError, '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet }; if (getProto) { try { null.error; // eslint-disable-line no-unused-expressions } catch (e) { // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 var errorProto = getProto(getProto(e)); INTRINSICS['%Error.prototype%'] = errorProto; } } var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { value = getEvalledConstructor('async function () {}'); } else if (name === '%GeneratorFunction%') { value = getEvalledConstructor('function* () {}'); } else if (name === '%AsyncGeneratorFunction%') { value = getEvalledConstructor('async function* () {}'); } else if (name === '%AsyncGenerator%') { var fn = doEval('%AsyncGeneratorFunction%'); if (fn) { value = fn.prototype; } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); if (gen && getProto) { value = getProto(gen.prototype); } } INTRINSICS[name] = value; return value; }; var LEGACY_ALIASES = { __proto__: null, '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], '%ArrayPrototype%': ['Array', 'prototype'], '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], '%ArrayProto_values%': ['Array', 'prototype', 'values'], '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], '%BooleanPrototype%': ['Boolean', 'prototype'], '%DataViewPrototype%': ['DataView', 'prototype'], '%DatePrototype%': ['Date', 'prototype'], '%ErrorPrototype%': ['Error', 'prototype'], '%EvalErrorPrototype%': ['EvalError', 'prototype'], '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], '%FunctionPrototype%': ['Function', 'prototype'], '%Generator%': ['GeneratorFunction', 'prototype'], '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], '%JSONParse%': ['JSON', 'parse'], '%JSONStringify%': ['JSON', 'stringify'], '%MapPrototype%': ['Map', 'prototype'], '%NumberPrototype%': ['Number', 'prototype'], '%ObjectPrototype%': ['Object', 'prototype'], '%ObjProto_toString%': ['Object', 'prototype', 'toString'], '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], '%PromisePrototype%': ['Promise', 'prototype'], '%PromiseProto_then%': ['Promise', 'prototype', 'then'], '%Promise_all%': ['Promise', 'all'], '%Promise_reject%': ['Promise', 'reject'], '%Promise_resolve%': ['Promise', 'resolve'], '%RangeErrorPrototype%': ['RangeError', 'prototype'], '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], '%RegExpPrototype%': ['RegExp', 'prototype'], '%SetPrototype%': ['Set', 'prototype'], '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], '%StringPrototype%': ['String', 'prototype'], '%SymbolPrototype%': ['Symbol', 'prototype'], '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], '%TypedArrayPrototype%': ['TypedArray', 'prototype'], '%TypeErrorPrototype%': ['TypeError', 'prototype'], '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], '%URIErrorPrototype%': ['URIError', 'prototype'], '%WeakMapPrototype%': ['WeakMap', 'prototype'], '%WeakSetPrototype%': ['WeakSet', 'prototype'] }; var bind = __webpack_require__(6743); var hasOwn = __webpack_require__(9957); var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); var $strSlice = bind.call(Function.call, String.prototype.slice); var $exec = bind.call(Function.call, RegExp.prototype.exec); /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ var stringToPath = function stringToPath(string) { var first = $strSlice(string, 0, 1); var last = $strSlice(string, -1); if (first === '%' && last !== '%') { throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); } else if (last === '%' && first !== '%') { throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); } var result = []; $replace(string, rePropName, function (match, number, quote, subString) { result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; }); return result; }; /* end adaptation */ var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { var intrinsicName = name; var alias; if (hasOwn(LEGACY_ALIASES, intrinsicName)) { alias = LEGACY_ALIASES[intrinsicName]; intrinsicName = '%' + alias[0] + '%'; } if (hasOwn(INTRINSICS, intrinsicName)) { var value = INTRINSICS[intrinsicName]; if (value === needsEval) { value = doEval(intrinsicName); } if (typeof value === 'undefined' && !allowMissing) { throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); } return { alias: alias, name: intrinsicName, value: value }; } throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); }; module.exports = function GetIntrinsic(name, allowMissing) { if (typeof name !== 'string' || name.length === 0) { throw new $TypeError('intrinsic name must be a non-empty string'); } if (arguments.length > 1 && typeof allowMissing !== 'boolean') { throw new $TypeError('"allowMissing" argument must be a boolean'); } if ($exec(/^%?[^%]*%?$/, name) === null) { throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); var intrinsicRealName = intrinsic.name; var value = intrinsic.value; var skipFurtherCaching = false; var alias = intrinsic.alias; if (alias) { intrinsicBaseName = alias[0]; $spliceApply(parts, $concat([0, 1], alias)); } for (var i = 1, isOwn = true; i < parts.length; i += 1) { var part = parts[i]; var first = $strSlice(part, 0, 1); var last = $strSlice(part, -1); if ( ( (first === '"' || first === "'" || first === '`') || (last === '"' || last === "'" || last === '`') ) && first !== last ) { throw new $SyntaxError('property names with quotes must have matching quotes'); } if (part === 'constructor' || !isOwn) { skipFurtherCaching = true; } intrinsicBaseName += '.' + part; intrinsicRealName = '%' + intrinsicBaseName + '%'; if (hasOwn(INTRINSICS, intrinsicRealName)) { value = INTRINSICS[intrinsicRealName]; } else if (value != null) { if (!(part in value)) { if (!allowMissing) { throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); } return void undefined; } if ($gOPD && (i + 1) >= parts.length) { var desc = $gOPD(value, part); isOwn = !!desc; // By convention, when a data property is converted to an accessor // property to emulate a data property that does not suffer from // the override mistake, that accessor's getter is marked with // an `originalValue` property. Here, when we detect this, we // uphold the illusion by pretending to see that original data // property, i.e., returning the value rather than the getter // itself. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { value = desc.get; } else { value = value[part]; } } else { isOwn = hasOwn(value, part); value = value[part]; } if (isOwn && !skipFurtherCaching) { INTRINSICS[intrinsicRealName] = value; } } } return value; }; /***/ }), /***/ 6270: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(362); var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); if ($gOPD) { try { $gOPD([], 'length'); } catch (e) { // IE 8 has a broken gOPD $gOPD = null; } } module.exports = $gOPD; /***/ }), /***/ 4205: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $defineProperty = __webpack_require__(466); var hasPropertyDescriptors = function hasPropertyDescriptors() { return !!$defineProperty; }; hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { // node v0.6 has a bug where array lengths can be Set but not Defined if (!$defineProperty) { return null; } try { return $defineProperty([], 'length', { value: 1 }).length !== 1; } catch (e) { // In Firefox 4-22, defining length on an array throws an exception. return true; } }; module.exports = hasPropertyDescriptors; /***/ }), /***/ 5695: /***/ (function(module) { "use strict"; var test = { __proto__: null, foo: {} }; var $Object = Object; /** @type {import('.')} */ module.exports = function hasProto() { // @ts-expect-error: TS errors on an inherited property for some reason return { __proto__: test }.foo === test.foo && !(test instanceof $Object); }; /***/ }), /***/ 68: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var origSymbol = typeof Symbol !== 'undefined' && Symbol; var hasSymbolSham = __webpack_require__(598); module.exports = function hasNativeSymbols() { if (typeof origSymbol !== 'function') { return false; } if (typeof Symbol !== 'function') { return false; } if (typeof origSymbol('foo') !== 'symbol') { return false; } if (typeof Symbol('bar') !== 'symbol') { return false; } return hasSymbolSham(); }; /***/ }), /***/ 598: /***/ (function(module) { "use strict"; /* eslint complexity: [2, 18], max-statements: [2, 33] */ module.exports = function hasSymbols() { if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } if (typeof Symbol.iterator === 'symbol') { return true; } var obj = {}; var sym = Symbol('test'); var symObj = Object(sym); if (typeof sym === 'string') { return false; } if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } // temp disabled per https://github.com/ljharb/object.assign/issues/17 // if (sym instanceof Symbol) { return false; } // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 // if (!(symObj instanceof Symbol)) { return false; } // if (typeof Symbol.prototype.toString !== 'function') { return false; } // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } var symVal = 42; obj[sym] = symVal; for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } var syms = Object.getOwnPropertySymbols(obj); if (syms.length !== 1 || syms[0] !== sym) { return false; } if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } if (typeof Object.getOwnPropertyDescriptor === 'function') { var descriptor = Object.getOwnPropertyDescriptor(obj, sym); if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } } return true; }; /***/ }), /***/ 4163: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var hasSymbols = __webpack_require__(598); /** @type {import('.')} */ module.exports = function hasToStringTagShams() { return hasSymbols() && !!Symbol.toStringTag; }; /***/ }), /***/ 6245: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var hasToStringTag = __webpack_require__(4163)(); var callBound = __webpack_require__(3348); var $toString = callBound('Object.prototype.toString'); var isStandardArguments = function isArguments(value) { if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { return false; } return $toString(value) === '[object Arguments]'; }; var isLegacyArguments = function isArguments(value) { if (isStandardArguments(value)) { return true; } return value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && $toString(value) !== '[object Array]' && $toString(value.callee) === '[object Function]'; }; var supportsStandardArguments = (function () { return isStandardArguments(arguments); }()); isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; /***/ }), /***/ 5575: /***/ (function(module) { "use strict"; var fnToStr = Function.prototype.toString; var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply; var badArrayLike; var isCallableMarker; if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') { try { badArrayLike = Object.defineProperty({}, 'length', { get: function () { throw isCallableMarker; } }); isCallableMarker = {}; // eslint-disable-next-line no-throw-literal reflectApply(function () { throw 42; }, null, badArrayLike); } catch (_) { if (_ !== isCallableMarker) { reflectApply = null; } } } else { reflectApply = null; } var constructorRegex = /^\s*class\b/; var isES6ClassFn = function isES6ClassFunction(value) { try { var fnStr = fnToStr.call(value); return constructorRegex.test(fnStr); } catch (e) { return false; // not a function } }; var tryFunctionObject = function tryFunctionToStr(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var objectClass = '[object Object]'; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; var ddaClass = '[object HTMLAllCollection]'; // IE 11 var ddaClass2 = '[object HTML document.all class]'; var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing var isDDA = function isDocumentDotAll() { return false; }; if (typeof document === 'object') { // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly var all = document.all; if (toStr.call(all) === toStr.call(document.all)) { isDDA = function isDocumentDotAll(value) { /* globals document: false */ // in IE 6-8, typeof document.all is "object" and it's truthy if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { try { var str = toStr.call(value); return ( str === ddaClass || str === ddaClass2 || str === ddaClass3 // opera 12.16 || str === objectClass // IE 6-8 ) && value('') == null; // eslint-disable-line eqeqeq } catch (e) { /**/ } } return false; }; } } module.exports = reflectApply ? function isCallable(value) { if (isDDA(value)) { return true; } if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } try { reflectApply(value, null, badArrayLike); } catch (e) { if (e !== isCallableMarker) { return false; } } return !isES6ClassFn(value) && tryFunctionObject(value); } : function isCallable(value) { if (isDDA(value)) { return true; } if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = toStr.call(value); if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } return tryFunctionObject(value); }; /***/ }), /***/ 3415: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var toStr = Object.prototype.toString; var fnToStr = Function.prototype.toString; var isFnRegex = /^\s*(?:function)?\*/; var hasToStringTag = __webpack_require__(4163)(); var getProto = Object.getPrototypeOf; var getGeneratorFunc = function () { // eslint-disable-line consistent-return if (!hasToStringTag) { return false; } try { return Function('return function*() {}')(); } catch (e) { } }; var GeneratorFunction; module.exports = function isGeneratorFunction(fn) { if (typeof fn !== 'function') { return false; } if (isFnRegex.test(fnToStr.call(fn))) { return true; } if (!hasToStringTag) { var str = toStr.call(fn); return str === '[object GeneratorFunction]'; } if (!getProto) { return false; } if (typeof GeneratorFunction === 'undefined') { var generatorFunc = getGeneratorFunc(); GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; } return getProto(fn) === GeneratorFunction; }; /***/ }), /***/ 7953: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var whichTypedArray = __webpack_require__(6556); /** @type {import('.')} */ module.exports = function isTypedArray(value) { return !!whichTypedArray(value); }; /***/ }), /***/ 4044: /***/ (function(module, exports) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* globals define */ (function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }(this, function () { var owasp = {}; // These are configuration settings that will be used when testing password // strength owasp.configs = { allowPassphrases : true, maxLength : 128, minLength : 10, minPhraseLength : 20, minOptionalTestsToPass : 4, }; // This method makes it more convenient to set config parameters owasp.config = function(params) { for (var prop in params) { if (params.hasOwnProperty(prop) && this.configs.hasOwnProperty(prop)) { this.configs[prop] = params[prop]; } } }; // This is an object containing the tests to run against all passwords. owasp.tests = { // An array of required tests. A password *must* pass these tests in order // to be considered strong. required: [ // enforce a minimum length function(password) { if (password.length < owasp.configs.minLength) { return 'The password must be at least ' + owasp.configs.minLength + ' characters long.'; } }, // enforce a maximum length function(password) { if (password.length > owasp.configs.maxLength) { return 'The password must be fewer than ' + owasp.configs.maxLength + ' characters.'; } }, // forbid repeating characters function(password) { if (/(.)\1{2,}/.test(password)) { return 'The password may not contain sequences of three or more repeated characters.'; } }, ], // An array of optional tests. These tests are "optional" in two senses: // // 1. Passphrases (passwords whose length exceeds // this.configs.minPhraseLength) are not obligated to pass these tests // provided that this.configs.allowPassphrases is set to Boolean true // (which it is by default). // // 2. A password need only to pass this.configs.minOptionalTestsToPass // number of these optional tests in order to be considered strong. optional: [ // require at least one lowercase letter function(password) { if (!/[a-z]/.test(password)) { return 'The password must contain at least one lowercase letter.'; } }, // require at least one uppercase letter function(password) { if (!/[A-Z]/.test(password)) { return 'The password must contain at least one uppercase letter.'; } }, // require at least one number function(password) { if (!/[0-9]/.test(password)) { return 'The password must contain at least one number.'; } }, // require at least one special character function(password) { if (!/[^A-Za-z0-9]/.test(password)) { return 'The password must contain at least one special character.'; } }, ], }; // This method tests password strength owasp.test = function(password) { // create an object to store the test results var result = { errors : [], failedTests : [], passedTests : [], requiredTestErrors : [], optionalTestErrors : [], isPassphrase : false, strong : true, optionalTestsPassed : 0, }; // Always submit the password/passphrase to the required tests var i = 0; this.tests.required.forEach(function(test) { var err = test(password); if (typeof err === 'string') { result.strong = false; result.errors.push(err); result.requiredTestErrors.push(err); result.failedTests.push(i); } else { result.passedTests.push(i); } i++; }); // If configured to allow passphrases, and if the password is of a // sufficient length to consider it a passphrase, exempt it from the // optional tests. if ( this.configs.allowPassphrases === true && password.length >= this.configs.minPhraseLength ) { result.isPassphrase = true; } if (!result.isPassphrase) { var j = this.tests.required.length; this.tests.optional.forEach(function(test) { var err = test(password); if (typeof err === 'string') { result.errors.push(err); result.optionalTestErrors.push(err); result.failedTests.push(j); } else { result.optionalTestsPassed++; result.passedTests.push(j); } j++; }); } // If the password is not a passphrase, assert that it has passed a // sufficient number of the optional tests, per the configuration if ( !result.isPassphrase && result.optionalTestsPassed < this.configs.minOptionalTestsToPass ) { result.strong = false; } // return the result return result; }; return owasp; } )); /***/ }), /***/ 6707: /***/ (function(module) { "use strict"; /** @type {import('.')} */ module.exports = [ 'Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array' ]; /***/ }), /***/ 7238: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var GetIntrinsic = __webpack_require__(362); var define = __webpack_require__(6504); var hasDescriptors = __webpack_require__(4205)(); var gOPD = __webpack_require__(6270); var $TypeError = __webpack_require__(3502); var $floor = GetIntrinsic('%Math.floor%'); /** @type {import('.')} */ module.exports = function setFunctionLength(fn, length) { if (typeof fn !== 'function') { throw new $TypeError('`fn` is not a function'); } if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { throw new $TypeError('`length` must be a positive 32-bit integer'); } var loose = arguments.length > 2 && !!arguments[2]; var functionLengthIsConfigurable = true; var functionLengthIsWritable = true; if ('length' in fn && gOPD) { var desc = gOPD(fn, 'length'); if (desc && !desc.configurable) { functionLengthIsConfigurable = false; } if (desc && !desc.writable) { functionLengthIsWritable = false; } } if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { if (hasDescriptors) { define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); } else { define(/** @type {Parameters[0]} */ (fn), 'length', length); } } return fn; }; /***/ }), /***/ 9620: /***/ (function(module) { const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; const numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/; // const octRegex = /^0x[a-z0-9]+/; // const binRegex = /0x[a-z0-9]+/; const consider = { hex : true, // oct: false, leadingZeros: true, decimalPoint: "\.", eNotation: true, //skipLike: /regex/ }; function toNumber(str, options = {}){ options = Object.assign({}, consider, options ); if(!str || typeof str !== "string" ) return str; let trimmedStr = str.trim(); if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str; else if(str==="0") return 0; else if (options.hex && hexRegex.test(trimmedStr)) { return parse_int(trimmedStr, 16); // }else if (options.oct && octRegex.test(str)) { // return Number.parseInt(val, 8); }else if (trimmedStr.search(/[eE]/)!== -1) { //eNotation const notation = trimmedStr.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/); // +00.123 => [ , '+', '00', '.123', .. if(notation){ // console.log(notation) if(options.leadingZeros){ //accept with leading zeros trimmedStr = (notation[1] || "") + notation[3]; }else{ if(notation[2] === "0" && notation[3][0]=== "."){ //valid number }else{ return str; } } return options.eNotation ? Number(trimmedStr) : str; }else{ return str; } // }else if (options.parseBin && binRegex.test(str)) { // return Number.parseInt(val, 2); }else{ //separate negative sign, leading zeros, and rest number const match = numRegex.exec(trimmedStr); // +00.123 => [ , '+', '00', '.123', .. if(match){ const sign = match[1]; const leadingZeros = match[2]; let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros //trim ending zeros for floating number if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123 else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123 else if(options.leadingZeros && leadingZeros===str) return 0; //00 else{//no leading zeros or leading zeros are allowed const num = Number(trimmedStr); const numStr = "" + num; if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation if(options.eNotation) return num; else return str; }else if(trimmedStr.indexOf(".") !== -1){ //floating number if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0 else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000 else if( sign && numStr === "-"+numTrimmedByZeros) return num; else return str; } if(leadingZeros){ return (numTrimmedByZeros === numStr) || (sign+numTrimmedByZeros === numStr) ? num : str }else { return (trimmedStr === numStr) || (trimmedStr === sign+numStr) ? num : str } } }else{ //non-numeric string return str; } } } /** * * @param {string} numStr without leading zeros * @returns */ function trimZeros(numStr){ if(numStr && numStr.indexOf(".") !== -1){//float numStr = numStr.replace(/0+$/, ""); //remove ending zeros if(numStr === ".") numStr = "0"; else if(numStr[0] === ".") numStr = "0"+numStr; else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1); return numStr; } return numStr; } function parse_int(numStr, base){ //polyfill if(parseInt) return parseInt(numStr, base); else if(Number.parseInt) return Number.parseInt(numStr, base); else if(window && window.parseInt) return window.parseInt(numStr, base); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported") } module.exports = toNumber; /***/ }), /***/ 3598: /***/ (function(module) { module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } /***/ }), /***/ 7473: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; // Currently in sync with Node.js lib/internal/util/types.js // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 var isArgumentsObject = __webpack_require__(6245); var isGeneratorFunction = __webpack_require__(3415); var whichTypedArray = __webpack_require__(6556); var isTypedArray = __webpack_require__(7953); function uncurryThis(f) { return f.call.bind(f); } var BigIntSupported = typeof BigInt !== 'undefined'; var SymbolSupported = typeof Symbol !== 'undefined'; var ObjectToString = uncurryThis(Object.prototype.toString); var numberValue = uncurryThis(Number.prototype.valueOf); var stringValue = uncurryThis(String.prototype.valueOf); var booleanValue = uncurryThis(Boolean.prototype.valueOf); if (BigIntSupported) { var bigIntValue = uncurryThis(BigInt.prototype.valueOf); } if (SymbolSupported) { var symbolValue = uncurryThis(Symbol.prototype.valueOf); } function checkBoxedPrimitive(value, prototypeValueOf) { if (typeof value !== 'object') { return false; } try { prototypeValueOf(value); return true; } catch(e) { return false; } } exports.isArgumentsObject = isArgumentsObject; exports.isGeneratorFunction = isGeneratorFunction; exports.isTypedArray = isTypedArray; // Taken from here and modified for better browser support // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js function isPromise(input) { return ( ( typeof Promise !== 'undefined' && input instanceof Promise ) || ( input !== null && typeof input === 'object' && typeof input.then === 'function' && typeof input.catch === 'function' ) ); } exports.isPromise = isPromise; function isArrayBufferView(value) { if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { return ArrayBuffer.isView(value); } return ( isTypedArray(value) || isDataView(value) ); } exports.isArrayBufferView = isArrayBufferView; function isUint8Array(value) { return whichTypedArray(value) === 'Uint8Array'; } exports.isUint8Array = isUint8Array; function isUint8ClampedArray(value) { return whichTypedArray(value) === 'Uint8ClampedArray'; } exports.isUint8ClampedArray = isUint8ClampedArray; function isUint16Array(value) { return whichTypedArray(value) === 'Uint16Array'; } exports.isUint16Array = isUint16Array; function isUint32Array(value) { return whichTypedArray(value) === 'Uint32Array'; } exports.isUint32Array = isUint32Array; function isInt8Array(value) { return whichTypedArray(value) === 'Int8Array'; } exports.isInt8Array = isInt8Array; function isInt16Array(value) { return whichTypedArray(value) === 'Int16Array'; } exports.isInt16Array = isInt16Array; function isInt32Array(value) { return whichTypedArray(value) === 'Int32Array'; } exports.isInt32Array = isInt32Array; function isFloat32Array(value) { return whichTypedArray(value) === 'Float32Array'; } exports.isFloat32Array = isFloat32Array; function isFloat64Array(value) { return whichTypedArray(value) === 'Float64Array'; } exports.isFloat64Array = isFloat64Array; function isBigInt64Array(value) { return whichTypedArray(value) === 'BigInt64Array'; } exports.isBigInt64Array = isBigInt64Array; function isBigUint64Array(value) { return whichTypedArray(value) === 'BigUint64Array'; } exports.isBigUint64Array = isBigUint64Array; function isMapToString(value) { return ObjectToString(value) === '[object Map]'; } isMapToString.working = ( typeof Map !== 'undefined' && isMapToString(new Map()) ); function isMap(value) { if (typeof Map === 'undefined') { return false; } return isMapToString.working ? isMapToString(value) : value instanceof Map; } exports.isMap = isMap; function isSetToString(value) { return ObjectToString(value) === '[object Set]'; } isSetToString.working = ( typeof Set !== 'undefined' && isSetToString(new Set()) ); function isSet(value) { if (typeof Set === 'undefined') { return false; } return isSetToString.working ? isSetToString(value) : value instanceof Set; } exports.isSet = isSet; function isWeakMapToString(value) { return ObjectToString(value) === '[object WeakMap]'; } isWeakMapToString.working = ( typeof WeakMap !== 'undefined' && isWeakMapToString(new WeakMap()) ); function isWeakMap(value) { if (typeof WeakMap === 'undefined') { return false; } return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; } exports.isWeakMap = isWeakMap; function isWeakSetToString(value) { return ObjectToString(value) === '[object WeakSet]'; } isWeakSetToString.working = ( typeof WeakSet !== 'undefined' && isWeakSetToString(new WeakSet()) ); function isWeakSet(value) { return isWeakSetToString(value); } exports.isWeakSet = isWeakSet; function isArrayBufferToString(value) { return ObjectToString(value) === '[object ArrayBuffer]'; } isArrayBufferToString.working = ( typeof ArrayBuffer !== 'undefined' && isArrayBufferToString(new ArrayBuffer()) ); function isArrayBuffer(value) { if (typeof ArrayBuffer === 'undefined') { return false; } return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; } exports.isArrayBuffer = isArrayBuffer; function isDataViewToString(value) { return ObjectToString(value) === '[object DataView]'; } isDataViewToString.working = ( typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined' && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) ); function isDataView(value) { if (typeof DataView === 'undefined') { return false; } return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; } exports.isDataView = isDataView; function isSharedArrayBufferToString(value) { return ObjectToString(value) === '[object SharedArrayBuffer]'; } isSharedArrayBufferToString.working = ( typeof SharedArrayBuffer !== 'undefined' && isSharedArrayBufferToString(new SharedArrayBuffer()) ); function isSharedArrayBuffer(value) { if (typeof SharedArrayBuffer === 'undefined') { return false; } return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBuffer; } exports.isSharedArrayBuffer = isSharedArrayBuffer; function isAsyncFunction(value) { return ObjectToString(value) === '[object AsyncFunction]'; } exports.isAsyncFunction = isAsyncFunction; function isMapIterator(value) { return ObjectToString(value) === '[object Map Iterator]'; } exports.isMapIterator = isMapIterator; function isSetIterator(value) { return ObjectToString(value) === '[object Set Iterator]'; } exports.isSetIterator = isSetIterator; function isGeneratorObject(value) { return ObjectToString(value) === '[object Generator]'; } exports.isGeneratorObject = isGeneratorObject; function isWebAssemblyCompiledModule(value) { return ObjectToString(value) === '[object WebAssembly.Module]'; } exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; function isNumberObject(value) { return checkBoxedPrimitive(value, numberValue); } exports.isNumberObject = isNumberObject; function isStringObject(value) { return checkBoxedPrimitive(value, stringValue); } exports.isStringObject = isStringObject; function isBooleanObject(value) { return checkBoxedPrimitive(value, booleanValue); } exports.isBooleanObject = isBooleanObject; function isBigIntObject(value) { return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); } exports.isBigIntObject = isBigIntObject; function isSymbolObject(value) { return SymbolSupported && checkBoxedPrimitive(value, symbolValue); } exports.isSymbolObject = isSymbolObject; function isBoxedPrimitive(value) { return ( isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value) ); } exports.isBoxedPrimitive = isBoxedPrimitive; function isAnyArrayBuffer(value) { return typeof Uint8Array !== 'undefined' && ( isArrayBuffer(value) || isSharedArrayBuffer(value) ); } exports.isAnyArrayBuffer = isAnyArrayBuffer; ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { Object.defineProperty(exports, method, { enumerable: false, value: function() { throw new Error(method + ' is not supported in userland'); } }); }); /***/ }), /***/ 166: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { /* provided dependency */ var process = __webpack_require__(5606); // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) { var keys = Object.keys(obj); var descriptors = {}; for (var i = 0; i < keys.length; i++) { descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); } return descriptors; }; var formatRegExp = /%[sdj%]/g; exports.format = function(f) { if (!isString(f)) { var objects = []; for (var i = 0; i < arguments.length; i++) { objects.push(inspect(arguments[i])); } return objects.join(' '); } var i = 1; var args = arguments; var len = args.length; var str = String(f).replace(formatRegExp, function(x) { if (x === '%%') return '%'; if (i >= len) return x; switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); case '%j': try { return JSON.stringify(args[i++]); } catch (_) { return '[Circular]'; } default: return x; } }); for (var x = args[i]; i < len; x = args[++i]) { if (isNull(x) || !isObject(x)) { str += ' ' + x; } else { str += ' ' + inspect(x); } } return str; }; // Mark that a method should not be used. // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. exports.deprecate = function(fn, msg) { if (typeof process !== 'undefined' && process.noDeprecation === true) { return fn; } // Allow for deprecating things in the process of starting up. if (typeof process === 'undefined') { return function() { return exports.deprecate(fn, msg).apply(this, arguments); }; } var warned = false; function deprecated() { if (!warned) { if (process.throwDeprecation) { throw new Error(msg); } else if (process.traceDeprecation) { console.trace(msg); } else { console.error(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; }; var debugs = {}; var debugEnvRegex = /^$/; if (({"NODE_ENV":"production","CONFIG":{"amazon":{"s3":{"cdn":"https://cdn.flipsnack.com","content":"https://content.flipsnack.com","static":"https://static.flipsnack.com","cloudfront":"https://d1dhn91mufybwl.cloudfront.net","cloudfrontContent":"https://d160aj0mj3npgx.cloudfront.net","cloudfrontStatic":"https://d1fpu6k62r548q.cloudfront.net","cloudfrontPrivate":"https://d3u72tnj701eui.cloudfront.net"}},"googleAnalytics":{"enableGATracking":true},"statisticsEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-sts","leadFormEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-widget-queue","siteBase":"https://www.flipsnack.com","appUrl":"https://app.flipsnack.com","enableWatermark":false,"enableCollectStats":true,"downloadMode":false,"exportName":"","recaptchaListKey":"6LceL0ghAAAAAIsQS9otnJ5paOB-2Qv85CF_18D0","orderEmailEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-order-email","signatureFetchUrl":"https://content-private.flipsnack.com/authorization","signatureInterval":50000,"interactivityElementsEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-interactivity-stats","trackOrdersEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-track-orders","interactivityResultsEndpoint":"https://interactivity-results.flipsnack.com/v1/quiz","env":"production"},"BUILD_TARGET":"web"}).NODE_DEBUG) { var debugEnv = ({"NODE_ENV":"production","CONFIG":{"amazon":{"s3":{"cdn":"https://cdn.flipsnack.com","content":"https://content.flipsnack.com","static":"https://static.flipsnack.com","cloudfront":"https://d1dhn91mufybwl.cloudfront.net","cloudfrontContent":"https://d160aj0mj3npgx.cloudfront.net","cloudfrontStatic":"https://d1fpu6k62r548q.cloudfront.net","cloudfrontPrivate":"https://d3u72tnj701eui.cloudfront.net"}},"googleAnalytics":{"enableGATracking":true},"statisticsEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-sts","leadFormEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-widget-queue","siteBase":"https://www.flipsnack.com","appUrl":"https://app.flipsnack.com","enableWatermark":false,"enableCollectStats":true,"downloadMode":false,"exportName":"","recaptchaListKey":"6LceL0ghAAAAAIsQS9otnJ5paOB-2Qv85CF_18D0","orderEmailEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-order-email","signatureFetchUrl":"https://content-private.flipsnack.com/authorization","signatureInterval":50000,"interactivityElementsEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-interactivity-stats","trackOrdersEndpoint":"https://sqs.us-east-1.amazonaws.com/756737886395/flip-track-orders","interactivityResultsEndpoint":"https://interactivity-results.flipsnack.com/v1/quiz","env":"production"},"BUILD_TARGET":"web"}).NODE_DEBUG; debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') .replace(/\*/g, '.*') .replace(/,/g, '$|^') .toUpperCase(); debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); } exports.debuglog = function(set) { set = set.toUpperCase(); if (!debugs[set]) { if (debugEnvRegex.test(set)) { var pid = process.pid; debugs[set] = function() { var msg = exports.format.apply(exports, arguments); console.error('%s %d: %s', set, pid, msg); }; } else { debugs[set] = function() {}; } } return debugs[set]; }; /** * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Object} opts Optional options object that alters the output. */ /* legacy: obj, showHidden, depth, colors*/ function inspect(obj, opts) { // default options var ctx = { seen: [], stylize: stylizeNoColor }; // legacy... if (arguments.length >= 3) ctx.depth = arguments[2]; if (arguments.length >= 4) ctx.colors = arguments[3]; if (isBoolean(opts)) { // legacy... ctx.showHidden = opts; } else if (opts) { // got an "options" object exports._extend(ctx, opts); } // set default options if (isUndefined(ctx.showHidden)) ctx.showHidden = false; if (isUndefined(ctx.depth)) ctx.depth = 2; if (isUndefined(ctx.colors)) ctx.colors = false; if (isUndefined(ctx.customInspect)) ctx.customInspect = true; if (ctx.colors) ctx.stylize = stylizeWithColor; return formatValue(ctx, obj, ctx.depth); } exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics inspect.colors = { 'bold' : [1, 22], 'italic' : [3, 23], 'underline' : [4, 24], 'inverse' : [7, 27], 'white' : [37, 39], 'grey' : [90, 39], 'black' : [30, 39], 'blue' : [34, 39], 'cyan' : [36, 39], 'green' : [32, 39], 'magenta' : [35, 39], 'red' : [31, 39], 'yellow' : [33, 39] }; // Don't use 'blue' not visible on cmd.exe inspect.styles = { 'special': 'cyan', 'number': 'yellow', 'boolean': 'yellow', 'undefined': 'grey', 'null': 'bold', 'string': 'green', 'date': 'magenta', // "name": intentionally not styling 'regexp': 'red' }; function stylizeWithColor(str, styleType) { var style = inspect.styles[styleType]; if (style) { return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm'; } else { return str; } } function stylizeNoColor(str, styleType) { return str; } function arrayToHash(array) { var hash = {}; array.forEach(function(val, idx) { hash[val] = true; }); return hash; } function formatValue(ctx, value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes, ctx); if (!isString(ret)) { ret = formatValue(ctx, ret, recurseTimes); } return ret; } // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } // Look up the keys of the object. var keys = Object.keys(value); var visibleKeys = arrayToHash(keys); if (ctx.showHidden) { keys = Object.getOwnPropertyNames(value); } // IE doesn't make error fields non-enumerable // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { return formatError(value); } // Some type of object without properties can be shortcutted. if (keys.length === 0) { if (isFunction(value)) { var name = value.name ? ': ' + value.name : ''; return ctx.stylize('[Function' + name + ']', 'special'); } if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } if (isDate(value)) { return ctx.stylize(Date.prototype.toString.call(value), 'date'); } if (isError(value)) { return formatError(value); } } var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array if (isArray(value)) { array = true; braces = ['[', ']']; } // Make functions say that they are functions if (isFunction(value)) { var n = value.name ? ': ' + value.name : ''; base = ' [Function' + n + ']'; } // Make RegExps say that they are RegExps if (isRegExp(value)) { base = ' ' + RegExp.prototype.toString.call(value); } // Make dates with properties first say the date if (isDate(value)) { base = ' ' + Date.prototype.toUTCString.call(value); } // Make error with message first say the error if (isError(value)) { base = ' ' + formatError(value); } if (keys.length === 0 && (!array || value.length == 0)) { return braces[0] + base + braces[1]; } if (recurseTimes < 0) { if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { return ctx.stylize('[Object]', 'special'); } } ctx.seen.push(value); var output; if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { output = keys.map(function(key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); }); } ctx.seen.pop(); return reduceToSingleString(output, base, braces); } function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); if (isString(value)) { var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; return ctx.stylize(simple, 'string'); } if (isNumber(value)) return ctx.stylize('' + value, 'number'); if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here. if (isNull(value)) return ctx.stylize('null', 'null'); } function formatError(value) { return '[' + Error.prototype.toString.call(value) + ']'; } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { var output = []; for (var i = 0, l = value.length; i < l; ++i) { if (hasOwnProperty(value, String(i))) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); } else { output.push(''); } } keys.forEach(function(key) { if (!key.match(/^\d+$/)) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } }); return output; } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str, desc; desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; if (desc.get) { if (desc.set) { str = ctx.stylize('[Getter/Setter]', 'special'); } else { str = ctx.stylize('[Getter]', 'special'); } } else { if (desc.set) { str = ctx.stylize('[Setter]', 'special'); } } if (!hasOwnProperty(visibleKeys, key)) { name = '[' + key + ']'; } if (!str) { if (ctx.seen.indexOf(desc.value) < 0) { if (isNull(recurseTimes)) { str = formatValue(ctx, desc.value, null); } else { str = formatValue(ctx, desc.value, recurseTimes - 1); } if (str.indexOf('\n') > -1) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; }).join('\n'); } } } else { str = ctx.stylize('[Circular]', 'special'); } } if (isUndefined(name)) { if (array && key.match(/^\d+$/)) { return str; } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'"); name = ctx.stylize(name, 'string'); } } return name + ': ' + str; } function reduceToSingleString(output, base, braces) { var numLinesEst = 0; var length = output.reduce(function(prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; }, 0); if (length > 60) { return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; } return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. exports.types = __webpack_require__(7473); function isArray(ar) { return Array.isArray(ar); } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return isObject(re) && objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; exports.types.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return isObject(d) && objectToString(d) === '[object Date]'; } exports.isDate = isDate; exports.types.isDate = isDate; function isError(e) { return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; exports.types.isNativeError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = __webpack_require__(3598); function objectToString(o) { return Object.prototype.toString.call(o); } function pad(n) { return n < 10 ? '0' + n.toString(10) : n.toString(10); } var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34 function timestamp() { var d = new Date(); var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':'); return [d.getDate(), months[d.getMonth()], time].join(' '); } // log is just a thin wrapper to console.log that prepends a timestamp exports.log = function() { console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; /** * Inherit the prototype methods from one constructor into another. * * The Function.prototype.inherits from lang.js rewritten as a standalone * function (not on Function.prototype). NOTE: If this file is to be loaded * during bootstrapping this function needs to be rewritten using some native * functions as prototype setup using normal JavaScript does not work as * expected during bootstrapping (see mirror.js in r114903). * * @param {function} ctor Constructor function which needs to inherit the * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ exports.inherits = __webpack_require__(6698); exports._extend = function(origin, add) { // Don't do anything if add isn't an object if (!add || !isObject(add)) return origin; var keys = Object.keys(add); var i = keys.length; while (i--) { origin[keys[i]] = add[keys[i]]; } return origin; }; function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; exports.promisify = function promisify(original) { if (typeof original !== 'function') throw new TypeError('The "original" argument must be of type Function'); if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { var fn = original[kCustomPromisifiedSymbol]; if (typeof fn !== 'function') { throw new TypeError('The "util.promisify.custom" argument must be of type Function'); } Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return fn; } function fn() { var promiseResolve, promiseReject; var promise = new Promise(function (resolve, reject) { promiseResolve = resolve; promiseReject = reject; }); var args = []; for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } args.push(function (err, value) { if (err) { promiseReject(err); } else { promiseResolve(value); } }); try { original.apply(this, args); } catch (err) { promiseReject(err); } return promise; } Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return Object.defineProperties( fn, getOwnPropertyDescriptors(original) ); } exports.promisify.custom = kCustomPromisifiedSymbol function callbackifyOnRejected(reason, cb) { // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). // Because `null` is a special error value in callbacks which means "no error // occurred", we error-wrap so the callback consumer can distinguish between // "the promise rejected with null" or "the promise fulfilled with undefined". if (!reason) { var newReason = new Error('Promise was rejected with a falsy value'); newReason.reason = reason; reason = newReason; } return cb(reason); } function callbackify(original) { if (typeof original !== 'function') { throw new TypeError('The "original" argument must be of type Function'); } // We DO NOT return the promise as it gives the user a false sense that // the promise is actually somehow related to the callback's execution // and that the callback throwing will reject the promise. function callbackified() { var args = []; for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } var maybeCb = args.pop(); if (typeof maybeCb !== 'function') { throw new TypeError('The last argument must be of type Function'); } var self = this; var cb = function() { return maybeCb.apply(self, arguments); }; // In true node style we process the callback on `nextTick` with all the // implications (stack, `uncaughtException`, `async_hooks`) original.apply(this, args) .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); } Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); return callbackified; } exports.callbackify = callbackify; /***/ }), /***/ 6556: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var forEach = __webpack_require__(8535); var availableTypedArrays = __webpack_require__(7374); var callBind = __webpack_require__(3784); var callBound = __webpack_require__(3348); var gOPD = __webpack_require__(6270); /** @type {(O: object) => string} */ var $toString = callBound('Object.prototype.toString'); var hasToStringTag = __webpack_require__(4163)(); var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; var typedArrays = availableTypedArrays(); var $slice = callBound('String.prototype.slice'); var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); /** @type {(array: readonly T[], value: unknown) => number} */ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { for (var i = 0; i < array.length; i += 1) { if (array[i] === value) { return i; } } return -1; }; /** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ /** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ var cache = { __proto__: null }; if (hasToStringTag && gOPD && getPrototypeOf) { forEach(typedArrays, function (typedArray) { var arr = new g[typedArray](); if (Symbol.toStringTag in arr) { var proto = getPrototypeOf(arr); // @ts-expect-error TS won't narrow inside a closure var descriptor = gOPD(proto, Symbol.toStringTag); if (!descriptor) { var superProto = getPrototypeOf(proto); // @ts-expect-error TS won't narrow inside a closure descriptor = gOPD(superProto, Symbol.toStringTag); } // @ts-expect-error TODO: fix cache['$' + typedArray] = callBind(descriptor.get); } }); } else { forEach(typedArrays, function (typedArray) { var arr = new g[typedArray](); var fn = arr.slice || arr.set; if (fn) { // @ts-expect-error TODO: fix cache['$' + typedArray] = callBind(fn); } }); } /** @type {(value: object) => false | import('.').TypedArrayName} */ var tryTypedArrays = function tryAllTypedArrays(value) { /** @type {ReturnType} */ var found = false; forEach( // eslint-disable-next-line no-extra-parens /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, typedArray) { if (!found) { try { // @ts-expect-error TODO: fix if ('$' + getter(value) === typedArray) { found = $slice(typedArray, 1); } } catch (e) { /**/ } } } ); return found; }; /** @type {(value: object) => false | import('.').TypedArrayName} */ var trySlices = function tryAllSlices(value) { /** @type {ReturnType} */ var found = false; forEach( // eslint-disable-next-line no-extra-parens /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { if (!found) { try { // @ts-expect-error TODO: fix getter(value); found = $slice(name, 1); } catch (e) { /**/ } } } ); return found; }; /** @type {import('.')} */ module.exports = function whichTypedArray(value) { if (!value || typeof value !== 'object') { return false; } if (!hasToStringTag) { /** @type {string} */ var tag = $slice($toString(value), 8, -1); if ($indexOf(typedArrays, tag) > -1) { return tag; } if (tag !== 'Object') { return false; } // node < 0.6 hits here on real Typed Arrays return trySlices(value); } if (!gOPD) { return null; } // unknown engine return tryTypedArrays(value); }; /***/ }), /***/ 2630: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* provided dependency */ var process = __webpack_require__(5606); // Currently in sync with Node.js lib/assert.js // https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b // Originally from narwhal.js (http://narwhaljs.org) // Copyright (c) 2009 Thomas Robinson <280north.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the 'Software'), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _require = __webpack_require__(3467), _require$codes = _require.codes, ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS; var AssertionError = __webpack_require__(2344); var _require2 = __webpack_require__(166), inspect = _require2.inspect; var _require$types = (__webpack_require__(166).types), isPromise = _require$types.isPromise, isRegExp = _require$types.isRegExp; var objectAssign = Object.assign ? Object.assign : (__webpack_require__(9737).assign); var objectIs = Object.is ? Object.is : __webpack_require__(911); var errorCache = new Map(); var isDeepEqual; var isDeepStrictEqual; var parseExpressionAt; var findNodeAround; var decoder; function lazyLoadComparison() { var comparison = __webpack_require__(1101); isDeepEqual = comparison.isDeepEqual; isDeepStrictEqual = comparison.isDeepStrictEqual; } // Escape control characters but not \n and \t to keep the line breaks and // indentation intact. // eslint-disable-next-line no-control-regex var escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g; var meta = (/* unused pure expression or super */ null && (["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", '\\b', '', '', "\\u000b", '\\f', '', "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"])); var escapeFn = function escapeFn(str) { return meta[str.charCodeAt(0)]; }; var warned = false; // The assert module provides functions that throw // AssertionError's when particular conditions are not met. The // assert module must conform to the following interface. var assert = module.exports = ok; var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError // when a corresponding condition is not met, with a message that // may be undefined if not provided. All assertion methods provide // both the actual and expected values to the assertion error for // display purposes. function innerFail(obj) { if (obj.message instanceof Error) throw obj.message; throw new AssertionError(obj); } function fail(actual, expected, message, operator, stackStartFn) { var argsLen = arguments.length; var internalMessage; if (argsLen === 0) { internalMessage = 'Failed'; } else if (argsLen === 1) { message = actual; actual = undefined; } else { if (warned === false) { warned = true; var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console); warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094'); } if (argsLen === 2) operator = '!='; } if (message instanceof Error) throw message; var errArgs = { actual: actual, expected: expected, operator: operator === undefined ? 'fail' : operator, stackStartFn: stackStartFn || fail }; if (message !== undefined) { errArgs.message = message; } var err = new AssertionError(errArgs); if (internalMessage) { err.message = internalMessage; err.generatedMessage = true; } throw err; } assert.fail = fail; // The AssertionError is defined in internal/error. assert.AssertionError = AssertionError; function innerOk(fn, argLen, value, message) { if (!value) { var generatedMessage = false; if (argLen === 0) { generatedMessage = true; message = 'No value argument passed to `assert.ok()`'; } else if (message instanceof Error) { throw message; } var err = new AssertionError({ actual: value, expected: true, message: message, operator: '==', stackStartFn: fn }); err.generatedMessage = generatedMessage; throw err; } } // Pure assertion tests whether a value is truthy, as determined // by !!value. function ok() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } innerOk.apply(void 0, [ok, args.length].concat(args)); } assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==. /* eslint-disable no-restricted-properties */ assert.equal = function equal(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } // eslint-disable-next-line eqeqeq if (actual != expected) { innerFail({ actual: actual, expected: expected, message: message, operator: '==', stackStartFn: equal }); } }; // The non-equality assertion tests for whether two objects are not // equal with !=. assert.notEqual = function notEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } // eslint-disable-next-line eqeqeq if (actual == expected) { innerFail({ actual: actual, expected: expected, message: message, operator: '!=', stackStartFn: notEqual }); } }; // The equivalence assertion tests a deep equality relation. assert.deepEqual = function deepEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (isDeepEqual === undefined) lazyLoadComparison(); if (!isDeepEqual(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'deepEqual', stackStartFn: deepEqual }); } }; // The non-equivalence assertion tests for any deep inequality. assert.notDeepEqual = function notDeepEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (isDeepEqual === undefined) lazyLoadComparison(); if (isDeepEqual(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'notDeepEqual', stackStartFn: notDeepEqual }); } }; /* eslint-enable */ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (isDeepEqual === undefined) lazyLoadComparison(); if (!isDeepStrictEqual(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'deepStrictEqual', stackStartFn: deepStrictEqual }); } }; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (isDeepEqual === undefined) lazyLoadComparison(); if (isDeepStrictEqual(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'notDeepStrictEqual', stackStartFn: notDeepStrictEqual }); } } assert.strictEqual = function strictEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (!objectIs(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'strictEqual', stackStartFn: strictEqual }); } }; assert.notStrictEqual = function notStrictEqual(actual, expected, message) { if (arguments.length < 2) { throw new ERR_MISSING_ARGS('actual', 'expected'); } if (objectIs(actual, expected)) { innerFail({ actual: actual, expected: expected, message: message, operator: 'notStrictEqual', stackStartFn: notStrictEqual }); } }; var Comparison = function Comparison(obj, keys, actual) { var _this = this; _classCallCheck(this, Comparison); keys.forEach(function (key) { if (key in obj) { if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) { _this[key] = actual[key]; } else { _this[key] = obj[key]; } } }); }; function compareExceptionKey(actual, expected, key, message, keys, fn) { if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) { if (!message) { // Create placeholder objects to create a nice output. var a = new Comparison(actual, keys); var b = new Comparison(expected, keys, actual); var err = new AssertionError({ actual: a, expected: b, operator: 'deepStrictEqual', stackStartFn: fn }); err.actual = actual; err.expected = expected; err.operator = fn.name; throw err; } innerFail({ actual: actual, expected: expected, message: message, operator: fn.name, stackStartFn: fn }); } } function expectedException(actual, expected, msg, fn) { if (typeof expected !== 'function') { if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects. if (arguments.length === 2) { throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected); } // Handle primitives properly. if (_typeof(actual) !== 'object' || actual === null) { var err = new AssertionError({ actual: actual, expected: expected, message: msg, operator: 'deepStrictEqual', stackStartFn: fn }); err.operator = fn.name; throw err; } var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared // as well. if (expected instanceof Error) { keys.push('name', 'message'); } else if (keys.length === 0) { throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object'); } if (isDeepEqual === undefined) lazyLoadComparison(); keys.forEach(function (key) { if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) { return; } compareExceptionKey(actual, expected, key, msg, keys, fn); }); return true; } // Guard instanceof against arrow functions as they don't have a prototype. if (expected.prototype !== undefined && actual instanceof expected) { return true; } if (Error.isPrototypeOf(expected)) { return false; } return expected.call({}, actual) === true; } function getActual(fn) { if (typeof fn !== 'function') { throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn); } try { fn(); } catch (e) { return e; } return NO_EXCEPTION_SENTINEL; } function checkIsPromise(obj) { // Accept native ES6 promises and promises that are implemented in a similar // way. Do not accept thenables that use a function as `obj` and that have no // `catch` handler. // TODO: thenables are checked up until they have the correct methods, // but according to documentation, the `then` method should receive // the `fulfill` and `reject` arguments as well or it may be never resolved. return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function'; } function waitForActual(promiseFn) { return Promise.resolve().then(function () { var resultPromise; if (typeof promiseFn === 'function') { // Return a rejected promise if `promiseFn` throws synchronously. resultPromise = promiseFn(); // Fail in case no promise is returned. if (!checkIsPromise(resultPromise)) { throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise); } } else if (checkIsPromise(promiseFn)) { resultPromise = promiseFn; } else { throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn); } return Promise.resolve().then(function () { return resultPromise; }).then(function () { return NO_EXCEPTION_SENTINEL; }).catch(function (e) { return e; }); }); } function expectsError(stackStartFn, actual, error, message) { if (typeof error === 'string') { if (arguments.length === 4) { throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); } if (_typeof(actual) === 'object' && actual !== null) { if (actual.message === error) { throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message.")); } } else if (actual === error) { throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message.")); } message = error; error = undefined; } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') { throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); } if (actual === NO_EXCEPTION_SENTINEL) { var details = ''; if (error && error.name) { details += " (".concat(error.name, ")"); } details += message ? ": ".concat(message) : '.'; var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception'; innerFail({ actual: undefined, expected: error, operator: stackStartFn.name, message: "Missing expected ".concat(fnType).concat(details), stackStartFn: stackStartFn }); } if (error && !expectedException(actual, error, message, stackStartFn)) { throw actual; } } function expectsNoError(stackStartFn, actual, error, message) { if (actual === NO_EXCEPTION_SENTINEL) return; if (typeof error === 'string') { message = error; error = undefined; } if (!error || expectedException(actual, error)) { var details = message ? ": ".concat(message) : '.'; var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception'; innerFail({ actual: actual, expected: error, operator: stackStartFn.name, message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""), stackStartFn: stackStartFn }); } throw actual; } assert.throws = function throws(promiseFn) { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); }; assert.rejects = function rejects(promiseFn) { for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { args[_key3 - 1] = arguments[_key3]; } return waitForActual(promiseFn).then(function (result) { return expectsError.apply(void 0, [rejects, result].concat(args)); }); }; assert.doesNotThrow = function doesNotThrow(fn) { for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { args[_key4 - 1] = arguments[_key4]; } expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); }; assert.doesNotReject = function doesNotReject(fn) { for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { args[_key5 - 1] = arguments[_key5]; } return waitForActual(fn).then(function (result) { return expectsNoError.apply(void 0, [doesNotReject, result].concat(args)); }); }; assert.ifError = function ifError(err) { if (err !== null && err !== undefined) { var message = 'ifError got unwanted exception: '; if (_typeof(err) === 'object' && typeof err.message === 'string') { if (err.message.length === 0 && err.constructor) { message += err.constructor.name; } else { message += err.message; } } else { message += inspect(err); } var newErr = new AssertionError({ actual: err, expected: null, operator: 'ifError', message: message, stackStartFn: ifError }); // Make sure we actually have a stack trace! var origStack = err.stack; if (typeof origStack === 'string') { // This will remove any duplicated frames from the error frames taken // from within `ifError` and add the original error frames to the newly // created ones. var tmp2 = origStack.split('\n'); tmp2.shift(); // Filter all frames existing in err.stack. var tmp1 = newErr.stack.split('\n'); for (var i = 0; i < tmp2.length; i++) { // Find the first occurrence of the frame. var pos = tmp1.indexOf(tmp2[i]); if (pos !== -1) { // Only keep new frames. tmp1 = tmp1.slice(0, pos); break; } } newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n')); } throw newErr; } }; // Expose a strict only variant of assert function strict() { for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { args[_key6] = arguments[_key6]; } innerOk.apply(void 0, [strict, args.length].concat(args)); } assert.strict = objectAssign(strict, assert, { equal: assert.strictEqual, deepEqual: assert.deepStrictEqual, notEqual: assert.notStrictEqual, notDeepEqual: assert.notDeepStrictEqual }); assert.strict.strict = assert.strict; /***/ }), /***/ 2344: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* provided dependency */ var process = __webpack_require__(5606); // Currently in sync with Node.js lib/internal/assert/assertion_error.js // https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var _require = __webpack_require__(166), inspect = _require.inspect; var _require2 = __webpack_require__(3467), ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith function endsWith(str, search, this_len) { if (this_len === undefined || this_len > str.length) { this_len = str.length; } return str.substring(this_len - search.length, this_len) === search; } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat function repeat(str, count) { count = Math.floor(count); if (str.length == 0 || count == 0) return ''; var maxCount = str.length * count; count = Math.floor(Math.log(count) / Math.log(2)); while (count) { str += str; count--; } str += str.substring(0, maxCount - str.length); return str; } var blue = ''; var green = ''; var red = ''; var white = ''; var kReadableOperator = { deepStrictEqual: 'Expected values to be strictly deep-equal:', strictEqual: 'Expected values to be strictly equal:', strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', deepEqual: 'Expected values to be loosely deep-equal:', equal: 'Expected values to be loosely equal:', notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', notStrictEqual: 'Expected "actual" to be strictly unequal to:', notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', notEqual: 'Expected "actual" to be loosely unequal to:', notIdentical: 'Values identical but not reference-equal:' }; // Comparing short primitives should just show === / !== instead of using the // diff. var kMaxShortLength = 10; function copyError(source) { var keys = Object.keys(source); var target = Object.create(Object.getPrototypeOf(source)); keys.forEach(function (key) { target[key] = source[key]; }); Object.defineProperty(target, 'message', { value: source.message }); return target; } function inspectValue(val) { // The util.inspect default values could be changed. This makes sure the // error messages contain the necessary information nevertheless. return inspect(val, { compact: false, customInspect: false, depth: 1000, maxArrayLength: Infinity, // Assert compares only enumerable properties (with a few exceptions). showHidden: false, // Having a long line as error is better than wrapping the line for // comparison for now. // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we // have meta information about the inspected properties (i.e., know where // in what line the property starts and ends). breakLength: Infinity, // Assert does not detect proxies currently. showProxy: false, sorted: true, // Inspect getters as we also check them when comparing entries. getters: true }); } function createErrDiff(actual, expected, operator) { var other = ''; var res = ''; var lastPos = 0; var end = ''; var skipped = false; var actualInspected = inspectValue(actual); var actualLines = actualInspected.split('\n'); var expectedLines = inspectValue(expected).split('\n'); var i = 0; var indicator = ''; // In case both values are objects explicitly mark them as not reference equal // for the `strictEqual` operator. if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) { operator = 'strictEqualObject'; } // If "actual" and "expected" fit on a single line and they are not strictly // equal, check further special handling. if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) { var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than // kMaxShortLength and if neither is an object and at least one of them is // not `zero`, use the strict equal comparison to visualize the output. if (inputLength <= kMaxShortLength) { if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) { // -0 === +0 return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); } } else if (operator !== 'strictEqualObject') { // If the stderr is a tty and the input length is lower than the current // columns per line, add a mismatch indicator below the output. If it is // not a tty, use a default value of 80 characters. var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80; if (inputLength < maxLength) { while (actualLines[0][i] === expectedLines[0][i]) { i++; } // Ignore the first characters. if (i > 2) { // Add position indicator for the first mismatch in case it is a // single line and the input length is less than the column length. indicator = "\n ".concat(repeat(' ', i), "^"); i = 0; } } } } // Remove all ending lines that match (this optimizes the output for // readability by reducing the number of total changed lines). var a = actualLines[actualLines.length - 1]; var b = expectedLines[expectedLines.length - 1]; while (a === b) { if (i++ < 2) { end = "\n ".concat(a).concat(end); } else { other = a; } actualLines.pop(); expectedLines.pop(); if (actualLines.length === 0 || expectedLines.length === 0) break; a = actualLines[actualLines.length - 1]; b = expectedLines[expectedLines.length - 1]; } var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference. // E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() }) if (maxLines === 0) { // We have to get the result again. The lines were all removed before. var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those. // TODO: Accept env to always show the full error. if (_actualLines.length > 30) { _actualLines[26] = "".concat(blue, "...").concat(white); while (_actualLines.length > 27) { _actualLines.pop(); } } return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n"); } if (i > 3) { end = "\n".concat(blue, "...").concat(white).concat(end); skipped = true; } if (other !== '') { end = "\n ".concat(other).concat(end); other = ''; } var printedLines = 0; var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white); var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped"); for (i = 0; i < maxLines; i++) { // Only extra expected lines exist var cur = i - lastPos; if (actualLines.length < i + 1) { // If the last diverging line is more than one line above and the // current line is at least line three, add some of the former lines and // also add dots to indicate skipped entries. if (cur > 1 && i > 2) { if (cur > 4) { res += "\n".concat(blue, "...").concat(white); skipped = true; } else if (cur > 3) { res += "\n ".concat(expectedLines[i - 2]); printedLines++; } res += "\n ".concat(expectedLines[i - 1]); printedLines++; } // Mark the current line as the last diverging one. lastPos = i; // Add the expected line to the cache. other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); printedLines++; // Only extra actual lines exist } else if (expectedLines.length < i + 1) { // If the last diverging line is more than one line above and the // current line is at least line three, add some of the former lines and // also add dots to indicate skipped entries. if (cur > 1 && i > 2) { if (cur > 4) { res += "\n".concat(blue, "...").concat(white); skipped = true; } else if (cur > 3) { res += "\n ".concat(actualLines[i - 2]); printedLines++; } res += "\n ".concat(actualLines[i - 1]); printedLines++; } // Mark the current line as the last diverging one. lastPos = i; // Add the actual line to the result. res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); printedLines++; // Lines diverge } else { var expectedLine = expectedLines[i]; var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by // a trailing comma. In that case it is actually identical and we should // mark it as such. var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical, // add a comma at the end of the actual line. Otherwise the output could // look weird as in: // // [ // 1 // No comma at the end! // + 2 // ] // if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) { divergingLines = false; actualLine += ','; } if (divergingLines) { // If the last diverging line is more than one line above and the // current line is at least line three, add some of the former lines and // also add dots to indicate skipped entries. if (cur > 1 && i > 2) { if (cur > 4) { res += "\n".concat(blue, "...").concat(white); skipped = true; } else if (cur > 3) { res += "\n ".concat(actualLines[i - 2]); printedLines++; } res += "\n ".concat(actualLines[i - 1]); printedLines++; } // Mark the current line as the last diverging one. lastPos = i; // Add the actual line to the result and cache the expected diverging // line so consecutive diverging lines show up as +++--- and not +-+-+-. res += "\n".concat(green, "+").concat(white, " ").concat(actualLine); other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine); printedLines += 2; // Lines are identical } else { // Add all cached information to the result before adding other things // and reset the cache. res += other; other = ''; // If the last diverging line is exactly one line above or if it is the // very first line, add the line to the result. if (cur === 1 || i === 0) { res += "\n ".concat(actualLine); printedLines++; } } } // Inspected object to big (Show ~20 rows max) if (printedLines > 20 && i < maxLines - 2) { return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white); } } return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator); } var AssertionError = /*#__PURE__*/ function (_Error) { _inherits(AssertionError, _Error); function AssertionError(options) { var _this; _classCallCheck(this, AssertionError); if (_typeof(options) !== 'object' || options === null) { throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); } var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn; var actual = options.actual, expected = options.expected; var limit = Error.stackTraceLimit; Error.stackTraceLimit = 0; if (message != null) { _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message))); } else { if (process.stderr && process.stderr.isTTY) { // Reset on each call to make sure we handle dynamically set environment // variables correct. if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { blue = "\x1B[34m"; green = "\x1B[32m"; white = "\x1B[39m"; red = "\x1B[31m"; } else { blue = ''; green = ''; white = ''; red = ''; } } // Prevent the error stack from being visible by duplicating the error // in a very close way to the original in case both sides are actually // instances of Error. if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) { actual = copyError(actual); expected = copyError(expected); } if (operator === 'deepStrictEqual' || operator === 'strictEqual') { _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator))); } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') { // In case the objects are equal but the operator requires unequal, show // the first object and say A equals B var base = kReadableOperator[operator]; var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal. if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) { base = kReadableOperator.notStrictEqualObject; } // Only remove lines in case it makes sense to collapse those. // TODO: Accept env to always show the full error. if (res.length > 30) { res[26] = "".concat(blue, "...").concat(white); while (res.length > 27) { res.pop(); } } // Only print a single input. if (res.length === 1) { _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0]))); } else { _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n"))); } } else { var _res = inspectValue(actual); var other = ''; var knownOperators = kReadableOperator[operator]; if (operator === 'notDeepEqual' || operator === 'notEqual') { _res = "".concat(kReadableOperator[operator], "\n\n").concat(_res); if (_res.length > 1024) { _res = "".concat(_res.slice(0, 1021), "..."); } } else { other = "".concat(inspectValue(expected)); if (_res.length > 512) { _res = "".concat(_res.slice(0, 509), "..."); } if (other.length > 512) { other = "".concat(other.slice(0, 509), "..."); } if (operator === 'deepEqual' || operator === 'equal') { _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); } else { other = " ".concat(operator, " ").concat(other); } } _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other))); } } Error.stackTraceLimit = limit; _this.generatedMessage = !message; Object.defineProperty(_assertThisInitialized(_this), 'name', { value: 'AssertionError [ERR_ASSERTION]', enumerable: false, writable: true, configurable: true }); _this.code = 'ERR_ASSERTION'; _this.actual = actual; _this.expected = expected; _this.operator = operator; if (Error.captureStackTrace) { // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); } // Create error message including the error code in the name. _this.stack; // Reset the name. _this.name = 'AssertionError'; return _possibleConstructorReturn(_this); } _createClass(AssertionError, [{ key: "toString", value: function toString() { return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); } }, { key: inspect.custom, value: function value(recurseTimes, ctx) { // This limits the `actual` and `expected` property default inspection to // the minimum depth. Otherwise those values would be too verbose compared // to the actual error message which contains a combined view of these two // input values. return inspect(this, _objectSpread({}, ctx, { customInspect: false, depth: 0 })); } }]); return AssertionError; }(_wrapNativeSuper(Error)); module.exports = AssertionError; /***/ }), /***/ 3467: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; // Currently in sync with Node.js lib/internal/errors.js // https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f /* eslint node-core/documented-errors: "error" */ /* eslint node-core/alphabetize-errors: "error" */ /* eslint node-core/prefer-util-format-errors: "error" */ // The whole point behind this internal module is to allow Node.js to no // longer be forced to treat every error message change as a semver-major // change. The NodeError classes here all expose a `code` property whose // value statically and permanently identifies the error. While the error // message may change, the code should not. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var codes = {}; // Lazy loaded var assert; var util; function createErrorType(code, message, Base) { if (!Base) { Base = Error; } function getMessage(arg1, arg2, arg3) { if (typeof message === 'string') { return message; } else { return message(arg1, arg2, arg3); } } var NodeError = /*#__PURE__*/ function (_Base) { _inherits(NodeError, _Base); function NodeError(arg1, arg2, arg3) { var _this; _classCallCheck(this, NodeError); _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3))); _this.code = code; return _this; } return NodeError; }(Base); codes[code] = NodeError; } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js function oneOf(expected, thing) { if (Array.isArray(expected)) { var len = expected.length; expected = expected.map(function (i) { return String(i); }); if (len > 2) { return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; } else if (len === 2) { return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); } else { return "of ".concat(thing, " ").concat(expected[0]); } } else { return "of ".concat(thing, " ").concat(String(expected)); } } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith function startsWith(str, search, pos) { return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith function endsWith(str, search, this_len) { if (this_len === undefined || this_len > str.length) { this_len = str.length; } return str.substring(this_len - search.length, this_len) === search; } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes function includes(str, search, start) { if (typeof start !== 'number') { start = 0; } if (start + search.length > str.length) { return false; } else { return str.indexOf(search, start) !== -1; } } createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError); createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { if (assert === undefined) assert = __webpack_require__(2630); assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be' var determiner; if (typeof expected === 'string' && startsWith(expected, 'not ')) { determiner = 'must not be'; expected = expected.replace(/^not /, ''); } else { determiner = 'must be'; } var msg; if (endsWith(name, ' argument')) { // For cases like 'first argument' msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); } else { var type = includes(name, '.') ? 'property' : 'argument'; msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); } // TODO(BridgeAR): Improve the output by showing `null` and similar. msg += ". Received type ".concat(_typeof(actual)); return msg; }, TypeError); createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) { var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid'; if (util === undefined) util = __webpack_require__(166); var inspected = util.inspect(value); if (inspected.length > 128) { inspected = "".concat(inspected.slice(0, 128), "..."); } return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected); }, TypeError, RangeError); createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) { var type; if (value && value.constructor && value.constructor.name) { type = "instance of ".concat(value.constructor.name); } else { type = "type ".concat(_typeof(value)); } return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, "."); }, TypeError); createErrorType('ERR_MISSING_ARGS', function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (assert === undefined) assert = __webpack_require__(2630); assert(args.length > 0, 'At least one arg needs to be specified'); var msg = 'The '; var len = args.length; args = args.map(function (a) { return "\"".concat(a, "\""); }); switch (len) { case 1: msg += "".concat(args[0], " argument"); break; case 2: msg += "".concat(args[0], " and ").concat(args[1], " arguments"); break; default: msg += args.slice(0, len - 1).join(', '); msg += ", and ".concat(args[len - 1], " arguments"); break; } return "".concat(msg, " must be specified"); }, TypeError); module.exports.codes = codes; /***/ }), /***/ 1101: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; // Currently in sync with Node.js lib/internal/util/comparisons.js // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var regexFlagsSupported = /a/g.flags !== undefined; var arrayFromSet = function arrayFromSet(set) { var array = []; set.forEach(function (value) { return array.push(value); }); return array; }; var arrayFromMap = function arrayFromMap(map) { var array = []; map.forEach(function (value, key) { return array.push([key, value]); }); return array; }; var objectIs = Object.is ? Object.is : __webpack_require__(911); var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () { return []; }; var numberIsNaN = Number.isNaN ? Number.isNaN : __webpack_require__(5179); function uncurryThis(f) { return f.call.bind(f); } var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty); var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable); var objectToString = uncurryThis(Object.prototype.toString); var _require$types = (__webpack_require__(166).types), isAnyArrayBuffer = _require$types.isAnyArrayBuffer, isArrayBufferView = _require$types.isArrayBufferView, isDate = _require$types.isDate, isMap = _require$types.isMap, isRegExp = _require$types.isRegExp, isSet = _require$types.isSet, isNativeError = _require$types.isNativeError, isBoxedPrimitive = _require$types.isBoxedPrimitive, isNumberObject = _require$types.isNumberObject, isStringObject = _require$types.isStringObject, isBooleanObject = _require$types.isBooleanObject, isBigIntObject = _require$types.isBigIntObject, isSymbolObject = _require$types.isSymbolObject, isFloat32Array = _require$types.isFloat32Array, isFloat64Array = _require$types.isFloat64Array; function isNonIndex(key) { if (key.length === 0 || key.length > 10) return true; for (var i = 0; i < key.length; i++) { var code = key.charCodeAt(i); if (code < 48 || code > 57) return true; } // The maximum size for an array is 2 ** 32 -1. return key.length === 10 && key >= Math.pow(2, 32); } function getOwnNonIndexProperties(value) { return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value))); } // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ function compare(a, b) { if (a === b) { return 0; } var x = a.length; var y = b.length; for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i]; y = b[i]; break; } } if (x < y) { return -1; } if (y < x) { return 1; } return 0; } var ONLY_ENUMERABLE = undefined; var kStrict = true; var kLoose = false; var kNoIterator = 0; var kIsArray = 1; var kIsSet = 2; var kIsMap = 3; // Check if they have the same source and flags function areSimilarRegExps(a, b) { return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b); } function areSimilarFloatArrays(a, b) { if (a.byteLength !== b.byteLength) { return false; } for (var offset = 0; offset < a.byteLength; offset++) { if (a[offset] !== b[offset]) { return false; } } return true; } function areSimilarTypedArrays(a, b) { if (a.byteLength !== b.byteLength) { return false; } return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0; } function areEqualArrayBuffers(buf1, buf2) { return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0; } function isEqualBoxedPrimitive(val1, val2) { if (isNumberObject(val1)) { return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); } if (isStringObject(val1)) { return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2); } if (isBooleanObject(val1)) { return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2); } if (isBigIntObject(val1)) { return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2); } return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2); } // Notes: Type tags are historical [[Class]] properties that can be set by // FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS // and retrieved using Object.prototype.toString.call(obj) in JS // See https://tc39.github.io/ecma262/#sec-object.prototype.tostring // for a list of tags pre-defined in the spec. // There are some unspecified tags in the wild too (e.g. typed array tags). // Since tags can be altered, they only serve fast failures // // Typed arrays and buffers are checked by comparing the content in their // underlying ArrayBuffer. This optimization requires that it's // reasonable to interpret their underlying memory in the same way, // which is checked by comparing their type tags. // (e.g. a Uint8Array and a Uint16Array with the same memory content // could still be different because they will be interpreted differently). // // For strict comparison, objects should have // a) The same built-in type tags // b) The same prototypes. function innerDeepEqual(val1, val2, strict, memos) { // All identical values are equivalent, as determined by ===. if (val1 === val2) { if (val1 !== 0) return true; return strict ? objectIs(val1, val2) : true; } // Check more closely if val1 and val2 are equal. if (strict) { if (_typeof(val1) !== 'object') { return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2); } if (_typeof(val2) !== 'object' || val1 === null || val2 === null) { return false; } if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { return false; } } else { if (val1 === null || _typeof(val1) !== 'object') { if (val2 === null || _typeof(val2) !== 'object') { // eslint-disable-next-line eqeqeq return val1 == val2; } return false; } if (val2 === null || _typeof(val2) !== 'object') { return false; } } var val1Tag = objectToString(val1); var val2Tag = objectToString(val2); if (val1Tag !== val2Tag) { return false; } if (Array.isArray(val1)) { // Check for sparse arrays and general fast path if (val1.length !== val2.length) { return false; } var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); if (keys1.length !== keys2.length) { return false; } return keyCheck(val1, val2, strict, memos, kIsArray, keys1); } // [browserify] This triggers on certain types in IE (Map/Set) so we don't // wan't to early return out of the rest of the checks. However we can check // if the second value is one of these values and the first isn't. if (val1Tag === '[object Object]') { // return keyCheck(val1, val2, strict, memos, kNoIterator); if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { return false; } } if (isDate(val1)) { if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { return false; } } else if (isRegExp(val1)) { if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { return false; } } else if (isNativeError(val1) || val1 instanceof Error) { // Do not compare the stack as it might differ even though the error itself // is otherwise identical. if (val1.message !== val2.message || val1.name !== val2.name) { return false; } } else if (isArrayBufferView(val1)) { if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { if (!areSimilarFloatArrays(val1, val2)) { return false; } } else if (!areSimilarTypedArrays(val1, val2)) { return false; } // Buffer.compare returns true, so val1.length === val2.length. If they both // only contain numeric keys, we don't need to exam further than checking // the symbols. var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE); var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE); if (_keys.length !== _keys2.length) { return false; } return keyCheck(val1, val2, strict, memos, kNoIterator, _keys); } else if (isSet(val1)) { if (!isSet(val2) || val1.size !== val2.size) { return false; } return keyCheck(val1, val2, strict, memos, kIsSet); } else if (isMap(val1)) { if (!isMap(val2) || val1.size !== val2.size) { return false; } return keyCheck(val1, val2, strict, memos, kIsMap); } else if (isAnyArrayBuffer(val1)) { if (!areEqualArrayBuffers(val1, val2)) { return false; } } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { return false; } return keyCheck(val1, val2, strict, memos, kNoIterator); } function getEnumerables(val, keys) { return keys.filter(function (k) { return propertyIsEnumerable(val, k); }); } function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { // For all remaining Object pairs, including Array, objects and Maps, // equivalence is determined by having: // a) The same number of owned enumerable properties // b) The same set of keys/indexes (although not necessarily the same order) // c) Equivalent values for every corresponding key/index // d) For Sets and Maps, equal contents // Note: this accounts for both named and indexed properties on Arrays. if (arguments.length === 5) { aKeys = Object.keys(val1); var bKeys = Object.keys(val2); // The pair must have the same number of owned properties. if (aKeys.length !== bKeys.length) { return false; } } // Cheap key test var i = 0; for (; i < aKeys.length; i++) { if (!hasOwnProperty(val2, aKeys[i])) { return false; } } if (strict && arguments.length === 5) { var symbolKeysA = objectGetOwnPropertySymbols(val1); if (symbolKeysA.length !== 0) { var count = 0; for (i = 0; i < symbolKeysA.length; i++) { var key = symbolKeysA[i]; if (propertyIsEnumerable(val1, key)) { if (!propertyIsEnumerable(val2, key)) { return false; } aKeys.push(key); count++; } else if (propertyIsEnumerable(val2, key)) { return false; } } var symbolKeysB = objectGetOwnPropertySymbols(val2); if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { return false; } } else { var _symbolKeysB = objectGetOwnPropertySymbols(val2); if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { return false; } } } if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { return true; } // Use memos to handle cycles. if (memos === undefined) { memos = { val1: new Map(), val2: new Map(), position: 0 }; } else { // We prevent up to two map.has(x) calls by directly retrieving the value // and checking for undefined. The map can only contain numbers, so it is // safe to check for undefined only. var val2MemoA = memos.val1.get(val1); if (val2MemoA !== undefined) { var val2MemoB = memos.val2.get(val2); if (val2MemoB !== undefined) { return val2MemoA === val2MemoB; } } memos.position++; } memos.val1.set(val1, memos.position); memos.val2.set(val2, memos.position); var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); memos.val1.delete(val1); memos.val2.delete(val2); return areEq; } function setHasEqualElement(set, val1, strict, memo) { // Go looking. var setValues = arrayFromSet(set); for (var i = 0; i < setValues.length; i++) { var val2 = setValues[i]; if (innerDeepEqual(val1, val2, strict, memo)) { // Remove the matching element to make sure we do not check that again. set.delete(val2); return true; } } return false; } // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using // Sadly it is not possible to detect corresponding values properly in case the // type is a string, number, bigint or boolean. The reason is that those values // can match lots of different string values (e.g., 1n == '+00001'). function findLooseMatchingPrimitives(prim) { switch (_typeof(prim)) { case 'undefined': return null; case 'object': // Only pass in null as object! return undefined; case 'symbol': return false; case 'string': prim = +prim; // Loose equal entries exist only if the string is possible to convert to // a regular number and not NaN. // Fall through case 'number': if (numberIsNaN(prim)) { return false; } } return true; } function setMightHaveLoosePrim(a, b, prim) { var altValue = findLooseMatchingPrimitives(prim); if (altValue != null) return altValue; return b.has(altValue) && !a.has(altValue); } function mapMightHaveLoosePrim(a, b, prim, item, memo) { var altValue = findLooseMatchingPrimitives(prim); if (altValue != null) { return altValue; } var curB = b.get(altValue); if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) { return false; } return !a.has(altValue) && innerDeepEqual(item, curB, false, memo); } function setEquiv(a, b, strict, memo) { // This is a lazily initiated Set of entries which have to be compared // pairwise. var set = null; var aValues = arrayFromSet(a); for (var i = 0; i < aValues.length; i++) { var val = aValues[i]; // Note: Checking for the objects first improves the performance for object // heavy sets but it is a minor slow down for primitives. As they are fast // to check this improves the worst case scenario instead. if (_typeof(val) === 'object' && val !== null) { if (set === null) { set = new Set(); } // If the specified value doesn't exist in the second set its an not null // object (or non strict only: a not matching primitive) we'll need to go // hunting for something thats deep-(strict-)equal to it. To make this // O(n log n) complexity we have to copy these values in a new set first. set.add(val); } else if (!b.has(val)) { if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values. if (!setMightHaveLoosePrim(a, b, val)) { return false; } if (set === null) { set = new Set(); } set.add(val); } } if (set !== null) { var bValues = arrayFromSet(b); for (var _i = 0; _i < bValues.length; _i++) { var _val = bValues[_i]; // We have to check if a primitive value is already // matching and only if it's not, go hunting for it. if (_typeof(_val) === 'object' && _val !== null) { if (!setHasEqualElement(set, _val, strict, memo)) return false; } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { return false; } } return set.size === 0; } return true; } function mapHasEqualEntry(set, map, key1, item1, strict, memo) { // To be able to handle cases like: // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']]) // ... we need to consider *all* matching keys, not just the first we find. var setValues = arrayFromSet(set); for (var i = 0; i < setValues.length; i++) { var key2 = setValues[i]; if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) { set.delete(key2); return true; } } return false; } function mapEquiv(a, b, strict, memo) { var set = null; var aEntries = arrayFromMap(a); for (var i = 0; i < aEntries.length; i++) { var _aEntries$i = _slicedToArray(aEntries[i], 2), key = _aEntries$i[0], item1 = _aEntries$i[1]; if (_typeof(key) === 'object' && key !== null) { if (set === null) { set = new Set(); } set.add(key); } else { // By directly retrieving the value we prevent another b.has(key) check in // almost all possible cases. var item2 = b.get(key); if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) { if (strict) return false; // Fast path to detect missing string, symbol, undefined and null // keys. if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false; if (set === null) { set = new Set(); } set.add(key); } } } if (set !== null) { var bEntries = arrayFromMap(b); for (var _i2 = 0; _i2 < bEntries.length; _i2++) { var _bEntries$_i = _slicedToArray(bEntries[_i2], 2), key = _bEntries$_i[0], item = _bEntries$_i[1]; if (_typeof(key) === 'object' && key !== null) { if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false; } else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) { return false; } } return set.size === 0; } return true; } function objEquiv(a, b, strict, keys, memos, iterationType) { // Sets and maps don't have their entries accessible via normal object // properties. var i = 0; if (iterationType === kIsSet) { if (!setEquiv(a, b, strict, memos)) { return false; } } else if (iterationType === kIsMap) { if (!mapEquiv(a, b, strict, memos)) { return false; } } else if (iterationType === kIsArray) { for (; i < a.length; i++) { if (hasOwnProperty(a, i)) { if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { return false; } } else if (hasOwnProperty(b, i)) { return false; } else { // Array is sparse. var keysA = Object.keys(a); for (; i < keysA.length; i++) { var key = keysA[i]; if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) { return false; } } if (keysA.length !== Object.keys(b).length) { return false; } return true; } } } // The pair must have equivalent values for every corresponding key. // Possibly expensive deep test: for (i = 0; i < keys.length; i++) { var _key = keys[i]; if (!innerDeepEqual(a[_key], b[_key], strict, memos)) { return false; } } return true; } function isDeepEqual(val1, val2) { return innerDeepEqual(val1, val2, kLoose); } function isDeepStrictEqual(val1, val2) { return innerDeepEqual(val1, val2, kStrict); } module.exports = { isDeepEqual: isDeepEqual, isDeepStrictEqual: isDeepStrictEqual }; /***/ }), /***/ 9464: /***/ (function(module, exports, __webpack_require__) { /* module decorator */ module = __webpack_require__.nmd(module); var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */ ;(function(root) { // Detect free variables `exports`. var freeExports = true && exports; // Detect free variable `module`. var freeModule = true && module && module.exports == freeExports && module; // Detect free variable `global`, from Node.js or Browserified code, and use // it as `root`. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { root = freeGlobal; } /*--------------------------------------------------------------------------*/ var InvalidCharacterError = function(message) { this.message = message; }; InvalidCharacterError.prototype = new Error; InvalidCharacterError.prototype.name = 'InvalidCharacterError'; var error = function(message) { // Note: the error messages used throughout this file match those used by // the native `atob`/`btoa` implementation in Chromium. throw new InvalidCharacterError(message); }; var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // http://whatwg.org/html/common-microsyntaxes.html#space-character var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g; // `decode` is designed to be fully compatible with `atob` as described in the // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob // The optimized base64-decoding algorithm used is based on @atk’s excellent // implementation. https://gist.github.com/atk/1020396 var decode = function(input) { input = String(input) .replace(REGEX_SPACE_CHARACTERS, ''); var length = input.length; if (length % 4 == 0) { input = input.replace(/==?$/, ''); length = input.length; } if ( length % 4 == 1 || // http://whatwg.org/C#alphanumeric-ascii-characters /[^+a-zA-Z0-9/]/.test(input) ) { error( 'Invalid character: the string to be decoded is not correctly encoded.' ); } var bitCounter = 0; var bitStorage; var buffer; var output = ''; var position = -1; while (++position < length) { buffer = TABLE.indexOf(input.charAt(position)); bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer; // Unless this is the first of a group of 4 characters… if (bitCounter++ % 4) { // …convert the first 8 bits to a single ASCII character. output += String.fromCharCode( 0xFF & bitStorage >> (-2 * bitCounter & 6) ); } } return output; }; // `encode` is designed to be fully compatible with `btoa` as described in the // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa var encode = function(input) { input = String(input); if (/[^\0-\xFF]/.test(input)) { // Note: no need to special-case astral symbols here, as surrogates are // matched, and the input is supposed to only contain ASCII anyway. error( 'The string to be encoded contains characters outside of the ' + 'Latin1 range.' ); } var padding = input.length % 3; var output = ''; var position = -1; var a; var b; var c; var buffer; // Make sure any padding is handled outside of the loop. var length = input.length - padding; while (++position < length) { // Read three bytes, i.e. 24 bits. a = input.charCodeAt(position) << 16; b = input.charCodeAt(++position) << 8; c = input.charCodeAt(++position); buffer = a + b + c; // Turn the 24 bits into four chunks of 6 bits each, and append the // matching character for each of them to the output. output += ( TABLE.charAt(buffer >> 18 & 0x3F) + TABLE.charAt(buffer >> 12 & 0x3F) + TABLE.charAt(buffer >> 6 & 0x3F) + TABLE.charAt(buffer & 0x3F) ); } if (padding == 2) { a = input.charCodeAt(position) << 8; b = input.charCodeAt(++position); buffer = a + b; output += ( TABLE.charAt(buffer >> 10) + TABLE.charAt((buffer >> 4) & 0x3F) + TABLE.charAt((buffer << 2) & 0x3F) + '=' ); } else if (padding == 1) { buffer = input.charCodeAt(position); output += ( TABLE.charAt(buffer >> 2) + TABLE.charAt((buffer << 4) & 0x3F) + '==' ); } return output; }; var base64 = { 'encode': encode, 'decode': decode, 'version': '1.0.0' }; // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( true ) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return base64; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var key; } }(this)); /***/ }), /***/ 3938: /***/ (function(module) { "use strict"; var isMergeableObject = function isMergeableObject(value) { return isNonNullObject(value) && !isSpecial(value) }; function isNonNullObject(value) { return !!value && typeof value === 'object' } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value) } // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; function isReactElement(value) { return value.$$typeof === REACT_ELEMENT_TYPE } function emptyTarget(val) { return Array.isArray(val) ? [] : {} } function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone !== false && options.isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, options) : value } function defaultArrayMerge(target, source, options) { return target.concat(source).map(function(element) { return cloneUnlessOtherwiseSpecified(element, options) }) } function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } var customMerge = options.customMerge(key); return typeof customMerge === 'function' ? customMerge : deepmerge } function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { return Object.propertyIsEnumerable.call(target, symbol) }) : [] } function getKeys(target) { return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) } function propertyIsOnObject(object, property) { try { return property in object } catch(_) { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } function mergeObject(target, source, options) { var destination = {}; if (options.isMergeableObject(target)) { getKeys(target).forEach(function(key) { destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); }); } getKeys(source).forEach(function(key) { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { destination[key] = getMergeFunction(key, options)(target[key], source[key], options); } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); } }); return destination } function deepmerge(target, source, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; var sourceIsArray = Array.isArray(source); var targetIsArray = Array.isArray(target); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; if (!sourceAndTargetTypesMatch) { return cloneUnlessOtherwiseSpecified(source, options) } else if (sourceIsArray) { return options.arrayMerge(target, source, options) } else { return mergeObject(target, source, options) } } deepmerge.all = function deepmergeAll(array, options) { if (!Array.isArray(array)) { throw new Error('first argument should be an array') } return array.reduce(function(prev, next) { return deepmerge(prev, next, options) }, {}) }; var deepmerge_1 = deepmerge; module.exports = deepmerge_1; /***/ }), /***/ 1898: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var keys = __webpack_require__(8555); var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; var toStr = Object.prototype.toString; var concat = Array.prototype.concat; var defineDataProperty = __webpack_require__(6504); var isFunction = function (fn) { return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; }; var supportsDescriptors = __webpack_require__(4205)(); var defineProperty = function (object, name, value, predicate) { if (name in object) { if (predicate === true) { if (object[name] === value) { return; } } else if (!isFunction(predicate) || !predicate()) { return; } } if (supportsDescriptors) { defineDataProperty(object, name, value, true); } else { defineDataProperty(object, name, value); } }; var defineProperties = function (object, map) { var predicates = arguments.length > 2 ? arguments[2] : {}; var props = keys(map); if (hasSymbols) { props = concat.call(props, Object.getOwnPropertySymbols(map)); } for (var i = 0; i < props.length; i += 1) { defineProperty(object, props[i], map[props[i]], predicates[props[i]]); } }; defineProperties.supportsDescriptors = !!supportsDescriptors; module.exports = defineProperties; /***/ }), /***/ 9737: /***/ (function(module) { "use strict"; /** * Code refactored from Mozilla Developer Network: * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign */ function assign(target, firstSource) { if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); for (var i = 1; i < arguments.length; i++) { var nextSource = arguments[i]; if (nextSource === undefined || nextSource === null) { continue; } var keysArray = Object.keys(Object(nextSource)); for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { var nextKey = keysArray[nextIndex]; var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { to[nextKey] = nextSource[nextKey]; } } } return to; } function polyfill() { if (!Object.assign) { Object.defineProperty(Object, 'assign', { enumerable: false, configurable: true, writable: true, value: assign }); } } module.exports = { assign: assign, polyfill: polyfill }; /***/ }), /***/ 1741: /***/ (function(module) { "use strict"; /* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ module.exports = function isNaN(value) { return value !== value; }; /***/ }), /***/ 5179: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var callBind = __webpack_require__(3784); var define = __webpack_require__(1898); var implementation = __webpack_require__(1741); var getPolyfill = __webpack_require__(6728); var shim = __webpack_require__(7138); var polyfill = callBind(getPolyfill(), Number); /* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ define(polyfill, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }); module.exports = polyfill; /***/ }), /***/ 6728: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var implementation = __webpack_require__(1741); module.exports = function getPolyfill() { if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) { return Number.isNaN; } return implementation; }; /***/ }), /***/ 7138: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var define = __webpack_require__(1898); var getPolyfill = __webpack_require__(6728); /* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */ module.exports = function shimNumberIsNaN() { var polyfill = getPolyfill(); define(Number, { isNaN: polyfill }, { isNaN: function testIsNaN() { return Number.isNaN !== polyfill; } }); return polyfill; }; /***/ }), /***/ 4658: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { (function (global, factory) { true ? factory(exports) : 0; }(this, function (exports) { 'use strict'; var domain; // This constructor is used to store event handlers. Instantiating this is // faster than explicitly calling `Object.create(null)` to get a "clean" empty // object (tested with v8 v4.9). function EventHandlers() {} EventHandlers.prototype = Object.create(null); function EventEmitter() { EventEmitter.init.call(this); } // nodejs oddity // require('events') === require('events').EventEmitter EventEmitter.EventEmitter = EventEmitter; EventEmitter.usingDomains = false; EventEmitter.prototype.domain = undefined; EventEmitter.prototype._events = undefined; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. EventEmitter.defaultMaxListeners = 10; EventEmitter.init = function() { this.domain = null; if (EventEmitter.usingDomains) { // if there is an active domain, then attach to it. if (domain.active && !(this instanceof domain.Domain)) ; } if (!this._events || this._events === Object.getPrototypeOf(this)._events) { this._events = new EventHandlers(); this._eventsCount = 0; } this._maxListeners = this._maxListeners || undefined; }; // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== 'number' || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number'); this._maxListeners = n; return this; }; function $getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return $getMaxListeners(this); }; // These standalone emit* functions are used to optimize calling of event // handlers for fast cases because emit() itself often has a variable number of // arguments and can be deoptimized because of that. These functions always have // the same number of arguments and thus do not get deoptimized, so the code // inside them can execute faster. function emitNone(handler, isFn, self) { if (isFn) handler.call(self); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self); } } function emitOne(handler, isFn, self, arg1) { if (isFn) handler.call(self, arg1); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1); } } function emitTwo(handler, isFn, self, arg1, arg2) { if (isFn) handler.call(self, arg1, arg2); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2); } } function emitThree(handler, isFn, self, arg1, arg2, arg3) { if (isFn) handler.call(self, arg1, arg2, arg3); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3); } } function emitMany(handler, isFn, self, args) { if (isFn) handler.apply(self, args); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].apply(self, args); } } EventEmitter.prototype.emit = function emit(type) { var er, handler, len, args, i, events, domain; var doError = (type === 'error'); events = this._events; if (events) doError = (doError && events.error == null); else if (!doError) return false; domain = this.domain; // If there is no 'error' event listener then throw. if (doError) { er = arguments[1]; if (domain) { if (!er) er = new Error('Uncaught, unspecified "error" event'); er.domainEmitter = this; er.domain = domain; er.domainThrown = false; domain.emit('error', er); } else if (er instanceof Error) { throw er; // Unhandled 'error' event } else { // At least give some kind of context to the user var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); err.context = er; throw err; } return false; } handler = events[type]; if (!handler) return false; var isFn = typeof handler === 'function'; len = arguments.length; switch (len) { // fast cases case 1: emitNone(handler, isFn, this); break; case 2: emitOne(handler, isFn, this, arguments[1]); break; case 3: emitTwo(handler, isFn, this, arguments[1], arguments[2]); break; case 4: emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); break; // slower default: args = new Array(len - 1); for (i = 1; i < len; i++) args[i - 1] = arguments[i]; emitMany(handler, isFn, this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = target._events; if (!events) { events = target._events = new EventHandlers(); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener) { target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object events = target._events; } existing = events[type]; } if (!existing) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = prepend ? [listener, existing] : [existing, listener]; } else { // If we've already got an array, just append. if (prepend) { existing.unshift(listener); } else { existing.push(listener); } } // Check for listener leak if (!existing.warned) { m = $getMaxListeners(target); if (m && m > 0 && existing.length > m) { existing.warned = true; var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + type + ' listeners added. ' + 'Use emitter.setMaxListeners() to increase limit'); w.name = 'MaxListenersExceededWarning'; w.emitter = target; w.type = type; w.count = existing.length; emitWarning(w); } } } return target; } function emitWarning(e) { typeof console.warn === 'function' ? console.warn(e) : console.log(e); } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function _onceWrap(target, type, listener) { var fired = false; function g() { target.removeListener(type, g); if (!fired) { fired = true; listener.apply(target, arguments); } } g.listener = listener; return g; } EventEmitter.prototype.once = function once(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // emits a 'removeListener' event iff the listener was removed EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = this._events; if (!events) return this; list = events[type]; if (!list) return this; if (list === listener || (list.listener && list.listener === listener)) { if (--this._eventsCount === 0) this._events = new EventHandlers(); else { delete events[type]; if (events.removeListener) this.emit('removeListener', type, list.listener || listener); } } else if (typeof list !== 'function') { position = -1; for (i = list.length; i-- > 0;) { if (list[i] === listener || (list[i].listener && list[i].listener === listener)) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (list.length === 1) { list[0] = undefined; if (--this._eventsCount === 0) { this._events = new EventHandlers(); return this; } else { delete events[type]; } } else { spliceOne(list, position); } if (events.removeListener) this.emit('removeListener', type, originalListener || listener); } return this; }; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events; events = this._events; if (!events) return this; // not listening for removeListener, no need to emit if (!events.removeListener) { if (arguments.length === 0) { this._events = new EventHandlers(); this._eventsCount = 0; } else if (events[type]) { if (--this._eventsCount === 0) this._events = new EventHandlers(); else delete events[type]; } return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { var keys = Object.keys(events); for (var i = 0, key; i < keys.length; ++i) { key = keys[i]; if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = new EventHandlers(); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === 'function') { this.removeListener(type, listeners); } else if (listeners) { // LIFO order do { this.removeListener(type, listeners[listeners.length - 1]); } while (listeners[0]); } return this; }; EventEmitter.prototype.listeners = function listeners(type) { var evlistener; var ret; var events = this._events; if (!events) ret = []; else { evlistener = events[type]; if (!evlistener) ret = []; else if (typeof evlistener === 'function') ret = [evlistener.listener || evlistener]; else ret = unwrapListeners(evlistener); } return ret; }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === 'function') { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; } else if (evlistener) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; }; // About 1.5x faster than the two-arg version of Array#splice(). function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k]; list.pop(); } function arrayClone(arr, i) { var copy = new Array(i); while (i--) copy[i] = arr[i]; return copy; } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } var global$1 = (typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); var lookup = []; var revLookup = []; var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; var inited = false; function init () { inited = true; var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i]; revLookup[code.charCodeAt(i)] = i; } revLookup['-'.charCodeAt(0)] = 62; revLookup['_'.charCodeAt(0)] = 63; } function toByteArray (b64) { if (!inited) { init(); } var i, j, l, tmp, placeHolders, arr; var len = b64.length; if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // the number of equal signs (place holders) // if there are two placeholders, than the two characters before it // represent one byte // if there is only one, then the three characters before it represent 2 bytes // this is just a cheap hack to not do indexOf twice placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; // base64 is 4/3 + up to two characters of the original data arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars l = placeHolders > 0 ? len - 4 : len; var L = 0; for (i = 0, j = 0; i < l; i += 4, j += 3) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]; arr[L++] = (tmp >> 16) & 0xFF; arr[L++] = (tmp >> 8) & 0xFF; arr[L++] = tmp & 0xFF; } if (placeHolders === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4); arr[L++] = tmp & 0xFF; } else if (placeHolders === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2); arr[L++] = (tmp >> 8) & 0xFF; arr[L++] = tmp & 0xFF; } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp; var output = []; for (var i = start; i < end; i += 3) { tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]); output.push(tripletToBase64(tmp)); } return output.join('') } function fromByteArray (uint8) { if (!inited) { init(); } var tmp; var len = uint8.length; var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes var output = ''; var parts = []; var maxChunkLength = 16383; // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))); } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1]; output += lookup[tmp >> 2]; output += lookup[(tmp << 4) & 0x3F]; output += '=='; } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + (uint8[len - 1]); output += lookup[tmp >> 10]; output += lookup[(tmp >> 4) & 0x3F]; output += lookup[(tmp << 2) & 0x3F]; output += '='; } parts.push(output); return parts.join('') } function read (buffer, offset, isLE, mLen, nBytes) { var e, m; var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var nBits = -7; var i = isLE ? (nBytes - 1) : 0; var d = isLE ? -1 : 1; var s = buffer[offset + i]; i += d; e = s & ((1 << (-nBits)) - 1); s >>= (-nBits); nBits += eLen; for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1); e >>= (-nBits); nBits += mLen; for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias; } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } function write (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c; var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0); var i = isLE ? 0 : (nBytes - 1); var d = isLE ? 1 : -1; var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; value = Math.abs(value); if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0; e = eMax; } else { e = Math.floor(Math.log(value) / Math.LN2); if (value * (c = Math.pow(2, -e)) < 1) { e--; c *= 2; } if (e + eBias >= 1) { value += rt / c; } else { value += rt * Math.pow(2, 1 - eBias); } if (value * c >= 2) { e++; c /= 2; } if (e + eBias >= eMax) { m = 0; e = eMax; } else if (e + eBias >= 1) { m = (value * c - 1) * Math.pow(2, mLen); e = e + eBias; } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); e = 0; } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m; eLen += mLen; for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128; } var toString = {}.toString; var isArray = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; var INSPECT_MAX_BYTES = 50; /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true; function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } function createBuffer (that, length) { if (kMaxLength() < length) { throw new RangeError('Invalid typed array length') } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = new Uint8Array(length); that.__proto__ = Buffer.prototype; } else { // Fallback: Return an object instance of the Buffer class if (that === null) { that = new Buffer(length); } that.length = length; } return that } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } Buffer.poolSize = 8192; // not used by this implementation // TODO: Legacy, not needed anymore. Remove in next major version. Buffer._augment = function (arr) { arr.__proto__ = Buffer.prototype; return arr }; function from (that, value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { return fromArrayBuffer(that, value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(that, value, encodingOrOffset) } return fromObject(that, value) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) }; if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype; Buffer.__proto__ = Uint8Array; } function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be a number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } } function alloc (that, size, fill, encoding) { assertSize(size); if (size <= 0) { return createBuffer(that, size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) } return createBuffer(that, size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) }; function allocUnsafe (that, size) { assertSize(size); that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < size; ++i) { that[i] = 0; } } return that } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) }; /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) }; function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8'; } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } var length = byteLength(string, encoding) | 0; that = createBuffer(that, length); var actual = that.write(string, encoding); if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual); } return that } function fromArrayLike (that, array) { var length = array.length < 0 ? 0 : checked(array.length) | 0; that = createBuffer(that, length); for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255; } return that } function fromArrayBuffer (that, array, byteOffset, length) { array.byteLength; // this throws if `array` is not a valid ArrayBuffer if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('\'offset\' is out of bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('\'length\' is out of bounds') } if (byteOffset === undefined && length === undefined) { array = new Uint8Array(array); } else if (length === undefined) { array = new Uint8Array(array, byteOffset); } else { array = new Uint8Array(array, byteOffset, length); } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = array; that.__proto__ = Buffer.prototype; } else { // Fallback: Return an object instance of the Buffer class that = fromArrayLike(that, array); } return that } function fromObject (that, obj) { if (internalIsBuffer(obj)) { var len = checked(obj.length) | 0; that = createBuffer(that, len); if (that.length === 0) { return that } obj.copy(that, 0, 0, len); return that } if (obj) { if ((typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer) || 'length' in obj) { if (typeof obj.length !== 'number' || isnan(obj.length)) { return createBuffer(that, 0) } return fromArrayLike(that, obj) } if (obj.type === 'Buffer' && isArray(obj.data)) { return fromArrayLike(that, obj.data) } } throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') } function checked (length) { // Note: cannot use `length < kMaxLength()` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } Buffer.isBuffer = isBuffer; function internalIsBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!internalIsBuffer(a) || !internalIsBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length; var y = b.length; for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i]; y = b[i]; break } } if (x < y) return -1 if (y < x) return 1 return 0 }; Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } }; Buffer.concat = function concat (list, length) { if (!isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i; if (length === undefined) { length = 0; for (i = 0; i < list.length; ++i) { length += list[i].length; } } var buffer = Buffer.allocUnsafe(length); var pos = 0; for (i = 0; i < list.length; ++i) { var buf = list[i]; if (!internalIsBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos); pos += buf.length; } return buffer }; function byteLength (string, encoding) { if (internalIsBuffer(string)) { return string.length } if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { string = '' + string; } var len = string.length; if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false; for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase(); loweredCase = true; } } } Buffer.byteLength = byteLength; function slowToString (encoding, start, end) { var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0; } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length; } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0; start >>>= 0; if (end <= start) { return '' } if (!encoding) encoding = 'utf8'; while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase(); loweredCase = true; } } } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect // Buffer instances. Buffer.prototype._isBuffer = true; function swap (b, n, m) { var i = b[n]; b[n] = b[m]; b[m] = i; } Buffer.prototype.swap16 = function swap16 () { var len = this.length; if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1); } return this }; Buffer.prototype.swap32 = function swap32 () { var len = this.length; if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3); swap(this, i + 1, i + 2); } return this }; Buffer.prototype.swap64 = function swap64 () { var len = this.length; if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7); swap(this, i + 1, i + 6); swap(this, i + 2, i + 5); swap(this, i + 3, i + 4); } return this }; Buffer.prototype.toString = function toString () { var length = this.length | 0; if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) }; Buffer.prototype.equals = function equals (b) { if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 }; Buffer.prototype.inspect = function inspect () { var str = ''; var max = INSPECT_MAX_BYTES; if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' '); if (this.length > max) str += ' ... '; } return '' }; Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (!internalIsBuffer(target)) { throw new TypeError('Argument must be a Buffer') } if (start === undefined) { start = 0; } if (end === undefined) { end = target ? target.length : 0; } if (thisStart === undefined) { thisStart = 0; } if (thisEnd === undefined) { thisEnd = this.length; } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0; end >>>= 0; thisStart >>>= 0; thisEnd >>>= 0; if (this === target) return 0 var x = thisEnd - thisStart; var y = end - start; var len = Math.min(x, y); var thisCopy = this.slice(thisStart, thisEnd); var targetCopy = target.slice(start, end); for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i]; y = targetCopy[i]; break } } if (x < y) return -1 if (y < x) return 1 return 0 }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset; byteOffset = 0; } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff; } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000; } byteOffset = +byteOffset; // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1); } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset; if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1; } else if (byteOffset < 0) { if (dir) byteOffset = 0; else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding); } // Finally, search either indexOf (if dir is true) or lastIndexOf if (internalIsBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF; // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1; var arrLength = arr.length; var valLength = val.length; if (encoding !== undefined) { encoding = String(encoding).toLowerCase(); if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2; arrLength /= 2; valLength /= 2; byteOffset /= 2; } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i; if (dir) { var foundIndex = -1; for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i; if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex; foundIndex = -1; } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; for (i = byteOffset; i >= 0; i--) { var found = true; for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false; break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 }; Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) }; Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) }; function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0; var remaining = buf.length - offset; if (!length) { length = remaining; } else { length = Number(length); if (length > remaining) { length = remaining; } } // must be an even number of digits var strLen = string.length; if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2; } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16); if (isNaN(parsed)) return i buf[offset + i] = parsed; } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8'; length = this.length; offset = 0; // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset; length = this.length; offset = 0; // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0; if (isFinite(length)) { length = length | 0; if (encoding === undefined) encoding = 'utf8'; } else { encoding = length; length = undefined; } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset; if (length === undefined || length > remaining) length = remaining; if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8'; var loweredCase = false; for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase(); loweredCase = true; } } }; Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } }; function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return fromByteArray(buf) } else { return fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end); var res = []; var i = start; while (i < end) { var firstByte = buf[i]; var codePoint = null; var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1; if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint; switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte; } break case 2: secondByte = buf[i + 1]; if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F); if (tempCodePoint > 0x7F) { codePoint = tempCodePoint; } } break case 3: secondByte = buf[i + 1]; thirdByte = buf[i + 2]; if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F); if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint; } } break case 4: secondByte = buf[i + 1]; thirdByte = buf[i + 2]; fourthByte = buf[i + 3]; if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F); if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint; } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD; bytesPerSequence = 1; } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000; res.push(codePoint >>> 10 & 0x3FF | 0xD800); codePoint = 0xDC00 | codePoint & 0x3FF; } res.push(codePoint); i += bytesPerSequence; } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000; function decodeCodePointsArray (codePoints) { var len = codePoints.length; if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = ''; var i = 0; while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ); } return res } function asciiSlice (buf, start, end) { var ret = ''; end = Math.min(buf.length, end); for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F); } return ret } function latin1Slice (buf, start, end) { var ret = ''; end = Math.min(buf.length, end); for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]); } return ret } function hexSlice (buf, start, end) { var len = buf.length; if (!start || start < 0) start = 0; if (!end || end < 0 || end > len) end = len; var out = ''; for (var i = start; i < end; ++i) { out += toHex(buf[i]); } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end); var res = ''; for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length; start = ~~start; end = end === undefined ? len : ~~end; if (start < 0) { start += len; if (start < 0) start = 0; } else if (start > len) { start = len; } if (end < 0) { end += len; if (end < 0) end = 0; } else if (end > len) { end = len; } if (end < start) end = start; var newBuf; if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = this.subarray(start, end); newBuf.__proto__ = Buffer.prototype; } else { var sliceLen = end - start; newBuf = new Buffer(sliceLen, undefined); for (var i = 0; i < sliceLen; ++i) { newBuf[i] = this[i + start]; } } return newBuf }; /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) checkOffset(offset, byteLength, this.length); var val = this[offset]; var mul = 1; var i = 0; while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul; } return val }; Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) { checkOffset(offset, byteLength, this.length); } var val = this[offset + --byteLength]; var mul = 1; while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul; } return val }; Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length); return this[offset] }; Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); return this[offset] | (this[offset + 1] << 8) }; Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); return (this[offset] << 8) | this[offset + 1] }; Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) }; Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) }; Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) checkOffset(offset, byteLength, this.length); var val = this[offset]; var mul = 1; var i = 0; while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul; } mul *= 0x80; if (val >= mul) val -= Math.pow(2, 8 * byteLength); return val }; Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) checkOffset(offset, byteLength, this.length); var i = byteLength; var mul = 1; var val = this[offset + --i]; while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul; } mul *= 0x80; if (val >= mul) val -= Math.pow(2, 8 * byteLength); return val }; Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length); if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) }; Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); var val = this[offset] | (this[offset + 1] << 8); return (val & 0x8000) ? val | 0xFFFF0000 : val }; Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length); var val = this[offset + 1] | (this[offset] << 8); return (val & 0x8000) ? val | 0xFFFF0000 : val }; Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) }; Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) }; Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return read(this, offset, true, 23, 4) }; Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length); return read(this, offset, false, 23, 4) }; Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length); return read(this, offset, true, 52, 8) }; Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length); return read(this, offset, false, 52, 8) }; function checkInt (buf, value, offset, ext, max, min) { if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value; offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1; checkInt(this, value, offset, byteLength, maxBytes, 0); } var mul = 1; var i = 0; this[offset] = value & 0xFF; while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF; } return offset + byteLength }; Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value; offset = offset | 0; byteLength = byteLength | 0; if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1; checkInt(this, value, offset, byteLength, maxBytes, 0); } var i = byteLength - 1; var mul = 1; this[offset + i] = value & 0xFF; while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF; } return offset + byteLength }; Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); this[offset] = (value & 0xff); return offset + 1 }; function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1; for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8; } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff); this[offset + 1] = (value >>> 8); } else { objectWriteUInt16(this, value, offset, true); } return offset + 2 }; Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8); this[offset + 1] = (value & 0xff); } else { objectWriteUInt16(this, value, offset, false); } return offset + 2 }; function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1; for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff; } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24); this[offset + 2] = (value >>> 16); this[offset + 1] = (value >>> 8); this[offset] = (value & 0xff); } else { objectWriteUInt32(this, value, offset, true); } return offset + 4 }; Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24); this[offset + 1] = (value >>> 16); this[offset + 2] = (value >>> 8); this[offset + 3] = (value & 0xff); } else { objectWriteUInt32(this, value, offset, false); } return offset + 4 }; Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value; offset = offset | 0; if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1); checkInt(this, value, offset, byteLength, limit - 1, -limit); } var i = 0; var mul = 1; var sub = 0; this[offset] = value & 0xFF; while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1; } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; } return offset + byteLength }; Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value; offset = offset | 0; if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1); checkInt(this, value, offset, byteLength, limit - 1, -limit); } var i = byteLength - 1; var mul = 1; var sub = 0; this[offset + i] = value & 0xFF; while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1; } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF; } return offset + byteLength }; Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); if (value < 0) value = 0xff + value + 1; this[offset] = (value & 0xff); return offset + 1 }; Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff); this[offset + 1] = (value >>> 8); } else { objectWriteUInt16(this, value, offset, true); } return offset + 2 }; Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8); this[offset + 1] = (value & 0xff); } else { objectWriteUInt16(this, value, offset, false); } return offset + 2 }; Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff); this[offset + 1] = (value >>> 8); this[offset + 2] = (value >>> 16); this[offset + 3] = (value >>> 24); } else { objectWriteUInt32(this, value, offset, true); } return offset + 4 }; Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value; offset = offset | 0; if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); if (value < 0) value = 0xffffffff + value + 1; if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24); this[offset + 1] = (value >>> 16); this[offset + 2] = (value >>> 8); this[offset + 3] = (value & 0xff); } else { objectWriteUInt32(this, value, offset, false); } return offset + 4 }; function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4); } write(buf, value, offset, littleEndian, 23, 4); return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) }; Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) }; function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8); } write(buf, value, offset, littleEndian, 52, 8); return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) }; Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0; if (!end && end !== 0) end = this.length; if (targetStart >= target.length) targetStart = target.length; if (!targetStart) targetStart = 0; if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length; if (target.length - targetStart < end - start) { end = target.length - targetStart + start; } var len = end - start; var i; if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start]; } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; ++i) { target[i + targetStart] = this[i + start]; } } else { Uint8Array.prototype.set.call( target, this.subarray(start, start + len), targetStart ); } return len }; // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start; start = 0; end = this.length; } else if (typeof end === 'string') { encoding = end; end = this.length; } if (val.length === 1) { var code = val.charCodeAt(0); if (code < 256) { val = code; } } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } } else if (typeof val === 'number') { val = val & 255; } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0; end = end === undefined ? this.length : end >>> 0; if (!val) val = 0; var i; if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val; } } else { var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()); var len = bytes.length; for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len]; } } return this }; // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '='; } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity; var codePoint; var length = string.length; var leadSurrogate = null; var bytes = []; for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i); // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); continue } // valid lead leadSurrogate = codePoint; continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); leadSurrogate = codePoint; continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); } leadSurrogate = null; // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint); } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ); } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ); } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ); } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = []; for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF); } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo; var byteArray = []; for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i); hi = c >> 8; lo = c % 256; byteArray.push(lo); byteArray.push(hi); } return byteArray } function base64ToBytes (str) { return toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i]; } return i } function isnan (val) { return val !== val // eslint-disable-line no-self-compare } // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence // The _isBuffer check is for Safari 5-7 support, because it's missing // Object.prototype.constructor. Remove this eventually function isBuffer(obj) { return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj)) } function isFastBuffer (obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } // For Node v0.10 support. Remove this eventually. function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0)) } // shim for using process in browser // based off https://github.com/defunctzombie/node-process/blob/master/browser.js function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } var cachedSetTimeout = defaultSetTimout; var cachedClearTimeout = defaultClearTimeout; if (typeof global$1.setTimeout === 'function') { cachedSetTimeout = setTimeout; } if (typeof global$1.clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } function nextTick(fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } } // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js var performance = global$1.performance || {}; var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function(){ return (new Date()).getTime() }; var inherits; if (typeof Object.create === 'function'){ inherits = function inherits(ctor, superCtor) { // implementation from standard node.js 'util' module ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; } else { inherits = function inherits(ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }; } var inherits$1 = inherits; var formatRegExp = /%[sdj%]/g; function format(f) { if (!isString(f)) { var objects = []; for (var i = 0; i < arguments.length; i++) { objects.push(inspect(arguments[i])); } return objects.join(' '); } var i = 1; var args = arguments; var len = args.length; var str = String(f).replace(formatRegExp, function(x) { if (x === '%%') return '%'; if (i >= len) return x; switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); case '%j': try { return JSON.stringify(args[i++]); } catch (_) { return '[Circular]'; } default: return x; } }); for (var x = args[i]; i < len; x = args[++i]) { if (isNull(x) || !isObject(x)) { str += ' ' + x; } else { str += ' ' + inspect(x); } } return str; } // Mark that a method should not be used. // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. function deprecate(fn, msg) { // Allow for deprecating things in the process of starting up. if (isUndefined(global$1.process)) { return function() { return deprecate(fn, msg).apply(this, arguments); }; } var warned = false; function deprecated() { if (!warned) { { console.error(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; } var debugs = {}; var debugEnviron; function debuglog(set) { if (isUndefined(debugEnviron)) debugEnviron = ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { var pid = 0; debugs[set] = function() { var msg = format.apply(null, arguments); console.error('%s %d: %s', set, pid, msg); }; } else { debugs[set] = function() {}; } } return debugs[set]; } /** * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Object} opts Optional options object that alters the output. */ /* legacy: obj, showHidden, depth, colors*/ function inspect(obj, opts) { // default options var ctx = { seen: [], stylize: stylizeNoColor }; // legacy... if (arguments.length >= 3) ctx.depth = arguments[2]; if (arguments.length >= 4) ctx.colors = arguments[3]; if (isBoolean(opts)) { // legacy... ctx.showHidden = opts; } else if (opts) { // got an "options" object _extend(ctx, opts); } // set default options if (isUndefined(ctx.showHidden)) ctx.showHidden = false; if (isUndefined(ctx.depth)) ctx.depth = 2; if (isUndefined(ctx.colors)) ctx.colors = false; if (isUndefined(ctx.customInspect)) ctx.customInspect = true; if (ctx.colors) ctx.stylize = stylizeWithColor; return formatValue(ctx, obj, ctx.depth); } // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics inspect.colors = { 'bold' : [1, 22], 'italic' : [3, 23], 'underline' : [4, 24], 'inverse' : [7, 27], 'white' : [37, 39], 'grey' : [90, 39], 'black' : [30, 39], 'blue' : [34, 39], 'cyan' : [36, 39], 'green' : [32, 39], 'magenta' : [35, 39], 'red' : [31, 39], 'yellow' : [33, 39] }; // Don't use 'blue' not visible on cmd.exe inspect.styles = { 'special': 'cyan', 'number': 'yellow', 'boolean': 'yellow', 'undefined': 'grey', 'null': 'bold', 'string': 'green', 'date': 'magenta', // "name": intentionally not styling 'regexp': 'red' }; function stylizeWithColor(str, styleType) { var style = inspect.styles[styleType]; if (style) { return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm'; } else { return str; } } function stylizeNoColor(str, styleType) { return str; } function arrayToHash(array) { var hash = {}; array.forEach(function(val, idx) { hash[val] = true; }); return hash; } function formatValue(ctx, value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special value.inspect !== inspect && // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes, ctx); if (!isString(ret)) { ret = formatValue(ctx, ret, recurseTimes); } return ret; } // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } // Look up the keys of the object. var keys = Object.keys(value); var visibleKeys = arrayToHash(keys); if (ctx.showHidden) { keys = Object.getOwnPropertyNames(value); } // IE doesn't make error fields non-enumerable // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { return formatError(value); } // Some type of object without properties can be shortcutted. if (keys.length === 0) { if (isFunction(value)) { var name = value.name ? ': ' + value.name : ''; return ctx.stylize('[Function' + name + ']', 'special'); } if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } if (isDate(value)) { return ctx.stylize(Date.prototype.toString.call(value), 'date'); } if (isError(value)) { return formatError(value); } } var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array if (isArray$1(value)) { array = true; braces = ['[', ']']; } // Make functions say that they are functions if (isFunction(value)) { var n = value.name ? ': ' + value.name : ''; base = ' [Function' + n + ']'; } // Make RegExps say that they are RegExps if (isRegExp(value)) { base = ' ' + RegExp.prototype.toString.call(value); } // Make dates with properties first say the date if (isDate(value)) { base = ' ' + Date.prototype.toUTCString.call(value); } // Make error with message first say the error if (isError(value)) { base = ' ' + formatError(value); } if (keys.length === 0 && (!array || value.length == 0)) { return braces[0] + base + braces[1]; } if (recurseTimes < 0) { if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { return ctx.stylize('[Object]', 'special'); } } ctx.seen.push(value); var output; if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { output = keys.map(function(key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); }); } ctx.seen.pop(); return reduceToSingleString(output, base, braces); } function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); if (isString(value)) { var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; return ctx.stylize(simple, 'string'); } if (isNumber(value)) return ctx.stylize('' + value, 'number'); if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here. if (isNull(value)) return ctx.stylize('null', 'null'); } function formatError(value) { return '[' + Error.prototype.toString.call(value) + ']'; } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { var output = []; for (var i = 0, l = value.length; i < l; ++i) { if (hasOwnProperty(value, String(i))) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); } else { output.push(''); } } keys.forEach(function(key) { if (!key.match(/^\d+$/)) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } }); return output; } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str, desc; desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; if (desc.get) { if (desc.set) { str = ctx.stylize('[Getter/Setter]', 'special'); } else { str = ctx.stylize('[Getter]', 'special'); } } else { if (desc.set) { str = ctx.stylize('[Setter]', 'special'); } } if (!hasOwnProperty(visibleKeys, key)) { name = '[' + key + ']'; } if (!str) { if (ctx.seen.indexOf(desc.value) < 0) { if (isNull(recurseTimes)) { str = formatValue(ctx, desc.value, null); } else { str = formatValue(ctx, desc.value, recurseTimes - 1); } if (str.indexOf('\n') > -1) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; }).join('\n'); } } } else { str = ctx.stylize('[Circular]', 'special'); } } if (isUndefined(name)) { if (array && key.match(/^\d+$/)) { return str; } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'"); name = ctx.stylize(name, 'string'); } } return name + ': ' + str; } function reduceToSingleString(output, base, braces) { var length = output.reduce(function(prev, cur) { if (cur.indexOf('\n') >= 0) ; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; }, 0); if (length > 60) { return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; } return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray$1(ar) { return Array.isArray(ar); } function isBoolean(arg) { return typeof arg === 'boolean'; } function isNull(arg) { return arg === null; } function isNumber(arg) { return typeof arg === 'number'; } function isString(arg) { return typeof arg === 'string'; } function isUndefined(arg) { return arg === void 0; } function isRegExp(re) { return isObject(re) && objectToString(re) === '[object RegExp]'; } function isObject(arg) { return typeof arg === 'object' && arg !== null; } function isDate(d) { return isObject(d) && objectToString(d) === '[object Date]'; } function isError(e) { return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error); } function isFunction(arg) { return typeof arg === 'function'; } function objectToString(o) { return Object.prototype.toString.call(o); } function _extend(origin, add) { // Don't do anything if add isn't an object if (!add || !isObject(add)) return origin; var keys = Object.keys(add); var i = keys.length; while (i--) { origin[keys[i]] = add[keys[i]]; } return origin; } function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } function BufferList() { this.head = null; this.tail = null; this.length = 0; } BufferList.prototype.push = function (v) { var entry = { data: v, next: null }; if (this.length > 0) this.tail.next = entry;else this.head = entry; this.tail = entry; ++this.length; }; BufferList.prototype.unshift = function (v) { var entry = { data: v, next: this.head }; if (this.length === 0) this.tail = entry; this.head = entry; ++this.length; }; BufferList.prototype.shift = function () { if (this.length === 0) return; var ret = this.head.data; if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; --this.length; return ret; }; BufferList.prototype.clear = function () { this.head = this.tail = null; this.length = 0; }; BufferList.prototype.join = function (s) { if (this.length === 0) return ''; var p = this.head; var ret = '' + p.data; while (p = p.next) { ret += s + p.data; }return ret; }; BufferList.prototype.concat = function (n) { if (this.length === 0) return Buffer.alloc(0); if (this.length === 1) return this.head.data; var ret = Buffer.allocUnsafe(n >>> 0); var p = this.head; var i = 0; while (p) { p.data.copy(ret, i); i += p.data.length; p = p.next; } return ret; }; // Copyright Joyent, Inc. and other Node contributors. var isBufferEncoding = Buffer.isEncoding || function(encoding) { switch (encoding && encoding.toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; default: return false; } }; function assertEncoding(encoding) { if (encoding && !isBufferEncoding(encoding)) { throw new Error('Unknown encoding: ' + encoding); } } // StringDecoder provides an interface for efficiently splitting a series of // buffers into a series of JS strings without breaking apart multi-byte // characters. CESU-8 is handled as part of the UTF-8 encoding. // // @TODO Handling all encodings inside a single object makes it very difficult // to reason about this code, so it should be split up in the future. // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code // points as used by CESU-8. function StringDecoder(encoding) { this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); assertEncoding(encoding); switch (this.encoding) { case 'utf8': // CESU-8 represents each of Surrogate Pair by 3-bytes this.surrogateSize = 3; break; case 'ucs2': case 'utf16le': // UTF-16 represents each of Surrogate Pair by 2-bytes this.surrogateSize = 2; this.detectIncompleteChar = utf16DetectIncompleteChar; break; case 'base64': // Base-64 stores 3 bytes in 4 chars, and pads the remainder. this.surrogateSize = 3; this.detectIncompleteChar = base64DetectIncompleteChar; break; default: this.write = passThroughWrite; return; } // Enough space to store all bytes of a single character. UTF-8 needs 4 // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). this.charBuffer = new Buffer(6); // Number of bytes received for the current incomplete multi-byte character. this.charReceived = 0; // Number of bytes expected for the current incomplete multi-byte character. this.charLength = 0; } // write decodes the given buffer and returns it as JS string that is // guaranteed to not contain any partial multi-byte characters. Any partial // character found at the end of the buffer is buffered up, and will be // returned when calling write again with the remaining bytes. // // Note: Converting a Buffer containing an orphan surrogate to a String // currently works, but converting a String to a Buffer (via `new Buffer`, or // Buffer#write) will replace incomplete surrogates with the unicode // replacement character. See https://codereview.chromium.org/121173009/ . StringDecoder.prototype.write = function(buffer) { var charStr = ''; // if our last write ended with an incomplete multibyte character while (this.charLength) { // determine how many remaining bytes this buffer has to offer for this char var available = (buffer.length >= this.charLength - this.charReceived) ? this.charLength - this.charReceived : buffer.length; // add the new bytes to the char buffer buffer.copy(this.charBuffer, this.charReceived, 0, available); this.charReceived += available; if (this.charReceived < this.charLength) { // still not enough chars in this buffer? wait for more ... return ''; } // remove bytes belonging to the current character from the buffer buffer = buffer.slice(available, buffer.length); // get the character that was split charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character var charCode = charStr.charCodeAt(charStr.length - 1); if (charCode >= 0xD800 && charCode <= 0xDBFF) { this.charLength += this.surrogateSize; charStr = ''; continue; } this.charReceived = this.charLength = 0; // if there are no more bytes in this buffer, just emit our char if (buffer.length === 0) { return charStr; } break; } // determine and set charLength / charReceived this.detectIncompleteChar(buffer); var end = buffer.length; if (this.charLength) { // buffer the incomplete character bytes we got buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); end -= this.charReceived; } charStr += buffer.toString(this.encoding, 0, end); var end = charStr.length - 1; var charCode = charStr.charCodeAt(end); // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character if (charCode >= 0xD800 && charCode <= 0xDBFF) { var size = this.surrogateSize; this.charLength += size; this.charReceived += size; this.charBuffer.copy(this.charBuffer, size, 0, size); buffer.copy(this.charBuffer, 0, 0, size); return charStr.substring(0, end); } // or just emit the charStr return charStr; }; // detectIncompleteChar determines if there is an incomplete UTF-8 character at // the end of the given buffer. If so, it sets this.charLength to the byte // length that character, and sets this.charReceived to the number of bytes // that are available for this character. StringDecoder.prototype.detectIncompleteChar = function(buffer) { // determine how many bytes we have to check at the end of this buffer var i = (buffer.length >= 3) ? 3 : buffer.length; // Figure out if one of the last i bytes of our buffer announces an // incomplete char. for (; i > 0; i--) { var c = buffer[buffer.length - i]; // See http://en.wikipedia.org/wiki/UTF-8#Description // 110XXXXX if (i == 1 && c >> 5 == 0x06) { this.charLength = 2; break; } // 1110XXXX if (i <= 2 && c >> 4 == 0x0E) { this.charLength = 3; break; } // 11110XXX if (i <= 3 && c >> 3 == 0x1E) { this.charLength = 4; break; } } this.charReceived = i; }; StringDecoder.prototype.end = function(buffer) { var res = ''; if (buffer && buffer.length) res = this.write(buffer); if (this.charReceived) { var cr = this.charReceived; var buf = this.charBuffer; var enc = this.encoding; res += buf.slice(0, cr).toString(enc); } return res; }; function passThroughWrite(buffer) { return buffer.toString(this.encoding); } function utf16DetectIncompleteChar(buffer) { this.charReceived = buffer.length % 2; this.charLength = this.charReceived ? 2 : 0; } function base64DetectIncompleteChar(buffer) { this.charReceived = buffer.length % 3; this.charLength = this.charReceived ? 3 : 0; } Readable.ReadableState = ReadableState; var debug = debuglog('stream'); inherits$1(Readable, EventEmitter); function prependListener(emitter, event, fn) { // Sadly this is not cacheable as some libraries bundle their own // event emitter implementation with them. if (typeof emitter.prependListener === 'function') { return emitter.prependListener(event, fn); } else { // This is a hack to make sure that our error handler is attached before any // userland ones. NEVER DO THIS. This is here only because this code needs // to continue to work with older versions of Node.js that do not include // the prependListener() method. The goal is to eventually remove this hack. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn); else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn); else emitter._events[event] = [fn, emitter._events[event]]; } } function listenerCount$1 (emitter, type) { return emitter.listeners(type).length; } function ReadableState(options, stream) { options = options || {}; // object stream flag. Used to make read(n) ignore n and to // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. this.highWaterMark = ~ ~this.highWaterMark; // A linked list is used to store data chunks instead of an array because the // linked list can remove elements from the beginning faster than // array.shift() this.buffer = new BufferList(); this.length = 0; this.pipes = null; this.pipesCount = 0; this.flowing = null; this.ended = false; this.endEmitted = false; this.reading = false; // a flag to be able to tell if the onwrite cb is called immediately, // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; // whenever we return null, then we set a flag to say // that we're awaiting a 'readable' event emission. this.needReadable = false; this.emittedReadable = false; this.readableListening = false; this.resumeScheduled = false; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // when piping, we only care about 'readable' events that happen // after read()ing all the bytes and not getting any pushback. this.ranOut = false; // the number of writers that are awaiting a drain event in .pipe()s this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled this.readingMore = false; this.decoder = null; this.encoding = null; if (options.encoding) { this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } function Readable(options) { if (!(this instanceof Readable)) return new Readable(options); this._readableState = new ReadableState(options, this); // legacy this.readable = true; if (options && typeof options.read === 'function') this._read = options.read; EventEmitter.call(this); } // Manually shove something into the read() buffer. // This returns true if the highWaterMark has not been hit yet, // similar to how Writable.write() returns true if you should // write() some more. Readable.prototype.push = function (chunk, encoding) { var state = this._readableState; if (!state.objectMode && typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } } return readableAddChunk(this, state, chunk, encoding, false); }; // Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { var state = this._readableState; return readableAddChunk(this, state, chunk, '', true); }; Readable.prototype.isPaused = function () { return this._readableState.flowing === false; }; function readableAddChunk(stream, state, chunk, encoding, addToFront) { var er = chunkInvalid(state, chunk); if (er) { stream.emit('error', er); } else if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else if (state.objectMode || chunk && chunk.length > 0) { if (state.ended && !addToFront) { var e = new Error('stream.push() after EOF'); stream.emit('error', e); } else if (state.endEmitted && addToFront) { var _e = new Error('stream.unshift() after end event'); stream.emit('error', _e); } else { var skipAdd; if (state.decoder && !addToFront && !encoding) { chunk = state.decoder.write(chunk); skipAdd = !state.objectMode && chunk.length === 0; } if (!addToFront) state.reading = false; // Don't add to the buffer if we've decoded to an empty string chunk and // we're not in object mode if (!skipAdd) { // if we want the data now, just emit it. if (state.flowing && state.length === 0 && !state.sync) { stream.emit('data', chunk); stream.read(0); } else { // update the buffer info. state.length += state.objectMode ? 1 : chunk.length; if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } } maybeReadMore(stream, state); } } else if (!addToFront) { state.reading = false; } return needMoreData(state); } // if it's past the high water mark, we can push in some more. // Also, if we have no data yet, we can stand some // more bytes. This is to work around cases where hwm=0, // such as the repl. Also, if the push() triggered a // readable event, and the user called read(largeNumber) such that // needReadable was set, then we ought to push more, so that another // 'readable' event will be triggered. function needMoreData(state) { return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); } // backwards compatibility. Readable.prototype.setEncoding = function (enc) { this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; }; // Don't raise the hwm > 8MB var MAX_HWM = 0x800000; function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { n = MAX_HWM; } else { // Get the next highest power of 2 to prevent increasing hwm excessively in // tiny amounts n--; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; n++; } return n; } // This function is designed to be inlinable, so please take care when making // changes to the function body. function howMuchToRead(n, state) { if (n <= 0 || state.length === 0 && state.ended) return 0; if (state.objectMode) return 1; if (n !== n) { // Only flow one buffer at a time if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; } // If we're asking for more than the current hwm, then raise the hwm. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); if (n <= state.length) return n; // Don't have enough if (!state.ended) { state.needReadable = true; return 0; } return state.length; } // you can override either this method, or the async _read(n) below. Readable.prototype.read = function (n) { debug('read', n); n = parseInt(n, 10); var state = this._readableState; var nOrig = n; if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we // already have a bunch of data in the buffer, then just trigger // the 'readable' event and move on. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { debug('read: emitReadable', state.length, state.ended); if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); return null; } n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { if (state.length === 0) endReadable(this); return null; } // All the actual chunk generation logic needs to be // *below* the call to _read. The reason is that in certain // synthetic stream cases, such as passthrough streams, _read // may be a completely synchronous operation which may change // the state of the read buffer, providing enough data when // before there was *not* enough. // // So, the steps are: // 1. Figure out what the state of things will be after we do // a read from the buffer. // // 2. If that resulting state will trigger a _read, then call _read. // Note that this may be asynchronous, or synchronous. Yes, it is // deeply ugly to write APIs this way, but that still doesn't mean // that the Readable class should behave improperly, as streams are // designed to be sync/async agnostic. // Take note if the _read call is sync or async (ie, if the read call // has returned yet), so that we know whether or not it's safe to emit // 'readable' etc. // // 3. Actually pull the requested chunks out of the buffer and return. // if we need a readable event, then we need to do some reading. var doRead = state.needReadable; debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some if (state.length === 0 || state.length - n < state.highWaterMark) { doRead = true; debug('length less than watermark', doRead); } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. if (state.ended || state.reading) { doRead = false; debug('reading or ended', doRead); } else if (doRead) { debug('do read'); state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. if (state.length === 0) state.needReadable = true; // call internal read method this._read(state.highWaterMark); state.sync = false; // If _read pushed data synchronously, then `reading` will be false, // and we need to re-evaluate how much data we can return to the user. if (!state.reading) n = howMuchToRead(nOrig, state); } var ret; if (n > 0) ret = fromList(n, state);else ret = null; if (ret === null) { state.needReadable = true; n = 0; } else { state.length -= n; } if (state.length === 0) { // If we have nothing in the buffer, then we want to know // as soon as we *do* get something into the buffer. if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. if (nOrig !== n && state.ended) endReadable(this); } if (ret !== null) this.emit('data', ret); return ret; }; function chunkInvalid(state, chunk) { var er = null; if (!isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } return er; } function onEofChunk(stream, state) { if (state.ended) return; if (state.decoder) { var chunk = state.decoder.end(); if (chunk && chunk.length) { state.buffer.push(chunk); state.length += state.objectMode ? 1 : chunk.length; } } state.ended = true; // emit 'readable' now to make sure it gets picked up. emitReadable(stream); } // Don't emit readable right away in sync mode, because this can trigger // another read() call => stack overflow. This way, it might trigger // a nextTick recursion warning, but that's not so bad. function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream); } } function emitReadable_(stream) { debug('emit readable'); stream.emit('readable'); flow(stream); } // at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if // it's in progress. // However, if we're not ended, or reading, and the length < hwm, // then go ahead and try to read some more preemptively. function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; nextTick(maybeReadMore_, stream, state); } } function maybeReadMore_(stream, state) { var len = state.length; while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. break;else len = state.length; } state.readingMore = false; } // abstract method. to be overridden in specific implementation classes. // call cb(er, data) where data is <= n in length. // for virtual (non-string, non-buffer) streams, "length" is somewhat // arbitrary, and perhaps not very meaningful. Readable.prototype._read = function (n) { this.emit('error', new Error('not implemented')); }; Readable.prototype.pipe = function (dest, pipeOpts) { var src = this; var state = this._readableState; switch (state.pipesCount) { case 0: state.pipes = dest; break; case 1: state.pipes = [state.pipes, dest]; break; default: state.pipes.push(dest); break; } state.pipesCount += 1; debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== false); var endFn = doEnd ? onend : cleanup; if (state.endEmitted) nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable) { debug('onunpipe'); if (readable === src) { cleanup(); } } function onend() { debug('onend'); dest.end(); } // when the dest drains, it reduces the awaitDrain counter // on the source. This would be more elegant with a .once() // handler in flow(), but adding and removing repeatedly is // too slow. var ondrain = pipeOnDrain(src); dest.on('drain', ondrain); var cleanedUp = false; function cleanup() { debug('cleanup'); // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); dest.removeListener('error', onerror); dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); src.removeListener('end', cleanup); src.removeListener('data', ondata); cleanedUp = true; // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } // If the user pushes more data while we're writing to dest then we'll end up // in ondata again. However, we only want to increase awaitDrain once because // dest will only emit one 'drain' event for the multiple writes. // => Introduce a guard on increasing awaitDrain. var increasedAwaitDrain = false; src.on('data', ondata); function ondata(chunk) { debug('ondata'); increasedAwaitDrain = false; var ret = dest.write(chunk); if (false === ret && !increasedAwaitDrain) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. // => Check whether `dest` is still a piping destination. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { debug('false write response, pause', src._readableState.awaitDrain); src._readableState.awaitDrain++; increasedAwaitDrain = true; } src.pause(); } } // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. function onerror(er) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er); } // Make sure our error handler is attached before userland ones. prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. function onclose() { dest.removeListener('finish', onfinish); unpipe(); } dest.once('close', onclose); function onfinish() { debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } dest.once('finish', onfinish); function unpipe() { debug('unpipe'); src.unpipe(dest); } // tell the dest that it's being piped to dest.emit('pipe', src); // start the flow if it hasn't been started already. if (!state.flowing) { debug('pipe resume'); src.resume(); } return dest; }; function pipeOnDrain(src) { return function () { var state = src._readableState; debug('pipeOnDrain', state.awaitDrain); if (state.awaitDrain) state.awaitDrain--; if (state.awaitDrain === 0 && src.listeners('data').length) { state.flowing = true; flow(src); } }; } Readable.prototype.unpipe = function (dest) { var state = this._readableState; // if we're not piping anywhere, then do nothing. if (state.pipesCount === 0) return this; // just one destination. most common case. if (state.pipesCount === 1) { // passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; if (!dest) dest = state.pipes; // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; if (dest) dest.emit('unpipe', this); return this; } // slow case. multiple pipe destinations. if (!dest) { // remove all. var dests = state.pipes; var len = state.pipesCount; state.pipes = null; state.pipesCount = 0; state.flowing = false; for (var _i = 0; _i < len; _i++) { dests[_i].emit('unpipe', this); }return this; } // try to find the right one. var i = indexOf(state.pipes, dest); if (i === -1) return this; state.pipes.splice(i, 1); state.pipesCount -= 1; if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this); return this; }; // set up data events if they are asked for // Ensure readable listeners eventually get something Readable.prototype.on = function (ev, fn) { var res = EventEmitter.prototype.on.call(this, ev, fn); if (ev === 'data') { // Start flowing on next tick if stream isn't explicitly paused if (this._readableState.flowing !== false) this.resume(); } else if (ev === 'readable') { var state = this._readableState; if (!state.endEmitted && !state.readableListening) { state.readableListening = state.needReadable = true; state.emittedReadable = false; if (!state.reading) { nextTick(nReadingNextTick, this); } else if (state.length) { emitReadable(this); } } } return res; }; Readable.prototype.addListener = Readable.prototype.on; function nReadingNextTick(self) { debug('readable nexttick read 0'); self.read(0); } // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. Readable.prototype.resume = function () { var state = this._readableState; if (!state.flowing) { debug('resume'); state.flowing = true; resume(this, state); } return this; }; function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; nextTick(resume_, stream, state); } } function resume_(stream, state) { if (!state.reading) { debug('resume read 0'); stream.read(0); } state.resumeScheduled = false; state.awaitDrain = 0; stream.emit('resume'); flow(stream); if (state.flowing && !state.reading) stream.read(0); } Readable.prototype.pause = function () { debug('call pause flowing=%j', this._readableState.flowing); if (false !== this._readableState.flowing) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } return this; }; function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); while (state.flowing && stream.read() !== null) {} } // wrap an old-style stream as the async data source. // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. Readable.prototype.wrap = function (stream) { var state = this._readableState; var paused = false; var self = this; stream.on('end', function () { debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) self.push(chunk); } self.push(null); }); stream.on('data', function (chunk) { debug('wrapped data'); if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; var ret = self.push(chunk); if (!ret) { paused = true; stream.pause(); } }); // proxy all the other methods. // important when wrapping filters and duplexes. for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { this[i] = function (method) { return function () { return stream[method].apply(stream, arguments); }; }(i); } } // proxy certain important events. var events = ['error', 'close', 'destroy', 'pause', 'resume']; forEach(events, function (ev) { stream.on(ev, self.emit.bind(self, ev)); }); // when we try to consume some more bytes, simply unpause the // underlying stream. self._read = function (n) { debug('wrapped _read', n); if (paused) { paused = false; stream.resume(); } }; return self; }; // exposed for testing purposes only. Readable._fromList = fromList; // Pluck off n bytes from an array of buffers. // Length is the combined lengths of all the buffers in the list. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromList(n, state) { // nothing buffered if (state.length === 0) return null; var ret; if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { // read it all, truncate the list if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); state.buffer.clear(); } else { // read part of list ret = fromListPartial(n, state.buffer, state.decoder); } return ret; } // Extracts only enough buffered data to satisfy the amount requested. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromListPartial(n, list, hasStrings) { var ret; if (n < list.head.data.length) { // slice is the same for buffers and strings ret = list.head.data.slice(0, n); list.head.data = list.head.data.slice(n); } else if (n === list.head.data.length) { // first chunk is a perfect match ret = list.shift(); } else { // result spans more than one buffer ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } return ret; } // Copies a specified amount of characters from the list of buffered data // chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBufferString(n, list) { var p = list.head; var c = 1; var ret = p.data; n -= ret.length; while (p = p.next) { var str = p.data; var nb = n > str.length ? str.length : n; if (nb === str.length) ret += str;else ret += str.slice(0, n); n -= nb; if (n === 0) { if (nb === str.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = str.slice(nb); } break; } ++c; } list.length -= c; return ret; } // Copies a specified amount of bytes from the list of buffered data chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBuffer(n, list) { var ret = Buffer.allocUnsafe(n); var p = list.head; var c = 1; p.data.copy(ret); n -= p.data.length; while (p = p.next) { var buf = p.data; var nb = n > buf.length ? buf.length : n; buf.copy(ret, ret.length - n, 0, nb); n -= nb; if (n === 0) { if (nb === buf.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = buf.slice(nb); } break; } ++c; } list.length -= c; return ret; } function endReadable(stream) { var state = stream._readableState; // If we get here before consuming all the bytes, then that is a // bug in node. Should never happen. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); if (!state.endEmitted) { state.ended = true; nextTick(endReadableNT, state, stream); } } function endReadableNT(state, stream) { // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); } } function forEach(xs, f) { for (var i = 0, l = xs.length; i < l; i++) { f(xs[i], i); } } function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; } // A bit simpler than readable streams. Writable.WritableState = WritableState; inherits$1(Writable, EventEmitter); function nop() {} function WriteReq(chunk, encoding, cb) { this.chunk = chunk; this.encoding = encoding; this.callback = cb; this.next = null; } function WritableState(options, stream) { Object.defineProperty(this, 'buffer', { get: deprecate(function () { return this.getBuffer(); }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') }); options = options || {}; // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. this.highWaterMark = ~ ~this.highWaterMark; this.needDrain = false; // at the start of calling end() this.ending = false; // when end() has been called, and returned this.ended = false; // when 'finish' is emitted this.finished = false; // should we decode strings into buffers before passing to _write? // this is here so that some node-core streams can optimize string // handling at a lower level. var noDecode = options.decodeStrings === false; this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement // of how much we're waiting to get pushed to some underlying // socket or file. this.length = 0; // a flag to see when we're in the middle of a write. this.writing = false; // when true all writes will be buffered until .uncork() call this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; // a flag to know if we're processing previously buffered items, which // may call the _write() callback in the same tick, so that we don't // end up in an overlapped onwrite situation. this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) this.onwrite = function (er) { onwrite(stream, er); }; // the callback that the user supplies to write(chunk,encoding,cb) this.writecb = null; // the amount that is being written when _write is called. this.writelen = 0; this.bufferedRequest = null; this.lastBufferedRequest = null; // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams this.prefinished = false; // True if the error was already emitted and should not be thrown again this.errorEmitted = false; // count buffered requests this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two this.corkedRequestsFree = new CorkedRequest(this); } WritableState.prototype.getBuffer = function writableStateGetBuffer() { var current = this.bufferedRequest; var out = []; while (current) { out.push(current); current = current.next; } return out; }; function Writable(options) { // Writable ctor is applied to Duplexes, though they're not // instanceof Writable, they're instanceof Readable. if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); this._writableState = new WritableState(options, this); // legacy. this.writable = true; if (options) { if (typeof options.write === 'function') this._write = options.write; if (typeof options.writev === 'function') this._writev = options.writev; } EventEmitter.call(this); } // Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { this.emit('error', new Error('Cannot pipe, not readable')); }; function writeAfterEnd(stream, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); nextTick(cb, er); } // If we get something that is not a buffer, string, null, or undefined, // and we're not in objectMode, then that's an error. // Otherwise stream chunks are all considered to be of length=1, and the // watermarks determine how many objects to keep in the buffer, rather than // how many bytes or characters. function validChunk(stream, state, chunk, cb) { var valid = true; var er = false; // Always throw error if a null is written // if we are not in object mode then throw // if it is not a buffer, string, or undefined. if (chunk === null) { er = new TypeError('May not write null values to stream'); } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } if (er) { stream.emit('error', er); nextTick(cb, er); valid = false; } return valid; } Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; if (typeof cb !== 'function') cb = nop; if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { state.pendingcb++; ret = writeOrBuffer(this, state, chunk, encoding, cb); } return ret; }; Writable.prototype.cork = function () { var state = this._writableState; state.corked++; }; Writable.prototype.uncork = function () { var state = this._writableState; if (state.corked) { state.corked--; if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } }; Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { // node::ParseEncoding() requires lower case. if (typeof encoding === 'string') encoding = encoding.toLowerCase(); if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); this._writableState.defaultEncoding = encoding; return this; }; function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { chunk = Buffer.from(chunk, encoding); } return chunk; } // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. function writeOrBuffer(stream, state, chunk, encoding, cb) { chunk = decodeChunk(state, chunk, encoding); if (Buffer.isBuffer(chunk)) encoding = 'buffer'; var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); if (last) { last.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); } return ret; } function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writelen = len; state.writecb = cb; state.writing = true; state.sync = true; if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb; if (sync) nextTick(cb, er);else cb(er); stream._writableState.errorEmitted = true; stream.emit('error', er); } function onwriteStateUpdate(state) { state.writing = false; state.writecb = null; state.length -= state.writelen; state.writelen = 0; } function onwrite(stream, er) { var state = stream._writableState; var sync = state.sync; var cb = state.writecb; onwriteStateUpdate(state); if (er) onwriteError(stream, state, sync, er, cb);else { // Check if we're actually ready to finish, but don't emit yet var finished = needFinish(state); if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { /**/ nextTick(afterWrite, stream, state, finished, cb); /**/ } else { afterWrite(stream, state, finished, cb); } } } function afterWrite(stream, state, finished, cb) { if (!finished) onwriteDrain(stream, state); state.pendingcb--; cb(); finishMaybe(stream, state); } // Must force callback to be called on nextTick, so that we don't // emit 'drain' before the write() consumer gets the 'false' return // value, and has a chance to attach a 'drain' listener. function onwriteDrain(stream, state) { if (state.length === 0 && state.needDrain) { state.needDrain = false; stream.emit('drain'); } } // if there's something in the buffer waiting, then process it function clearBuffer(stream, state) { state.bufferProcessing = true; var entry = state.bufferedRequest; if (stream._writev && entry && entry.next) { // Fast case, write everything using _writev() var l = state.bufferedRequestCount; var buffer = new Array(l); var holder = state.corkedRequestsFree; holder.entry = entry; var count = 0; while (entry) { buffer[count] = entry; entry = entry.next; count += 1; } doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; if (holder.next) { state.corkedRequestsFree = holder.next; holder.next = null; } else { state.corkedRequestsFree = new CorkedRequest(state); } } else { // Slow case, write chunks one-by-one while (entry) { var chunk = entry.chunk; var encoding = entry.encoding; var cb = entry.callback; var len = state.objectMode ? 1 : chunk.length; doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. if (state.writing) { break; } } if (entry === null) state.lastBufferedRequest = null; } state.bufferedRequestCount = 0; state.bufferedRequest = entry; state.bufferProcessing = false; } Writable.prototype._write = function (chunk, encoding, cb) { cb(new Error('not implemented')); }; Writable.prototype._writev = null; Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; if (typeof chunk === 'function') { cb = chunk; chunk = null; encoding = null; } else if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks if (state.corked) { state.corked = 1; this.uncork(); } // ignore unnecessary end() calls. if (!state.ending && !state.finished) endWritable(this, state, cb); }; function needFinish(state) { return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } function prefinish(stream, state) { if (!state.prefinished) { state.prefinished = true; stream.emit('prefinish'); } } function finishMaybe(stream, state) { var need = needFinish(state); if (need) { if (state.pendingcb === 0) { prefinish(stream, state); state.finished = true; stream.emit('finish'); } else { prefinish(stream, state); } } return need; } function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); if (cb) { if (state.finished) nextTick(cb);else stream.once('finish', cb); } state.ended = true; stream.writable = false; } // It seems a linked list but it is not // there will be only 2 of these for each stream function CorkedRequest(state) { var _this = this; this.next = null; this.entry = null; this.finish = function (err) { var entry = _this.entry; _this.entry = null; while (entry) { var cb = entry.callback; state.pendingcb--; cb(err); entry = entry.next; } if (state.corkedRequestsFree) { state.corkedRequestsFree.next = _this; } else { state.corkedRequestsFree = _this; } }; } inherits$1(Duplex, Readable); var keys = Object.keys(Writable.prototype); for (var v = 0; v < keys.length; v++) { var method = keys[v]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } function Duplex(options) { if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); if (options && options.readable === false) this.readable = false; if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. nextTick(onEndNT, this); } function onEndNT(self) { self.end(); } // a transform stream is a readable/writable stream where you do inherits$1(Transform, Duplex); function TransformState(stream) { this.afterTransform = function (er, data) { return afterTransform(stream, er, data); }; this.needTransform = false; this.transforming = false; this.writecb = null; this.writechunk = null; this.writeencoding = null; } function afterTransform(stream, er, data) { var ts = stream._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); ts.writechunk = null; ts.writecb = null; if (data !== null && data !== undefined) stream.push(data); cb(er); var rs = stream._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { stream._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); this._transformState = new TransformState(this); // when the writable side finishes, then flush out anything remaining. var stream = this; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. this._readableState.sync = false; if (options) { if (typeof options.transform === 'function') this._transform = options.transform; if (typeof options.flush === 'function') this._flush = options.flush; } this.once('prefinish', function () { if (typeof this._flush === 'function') this._flush(function (er) { done(stream, er); });else done(stream); }); } Transform.prototype.push = function (chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // // Call `push(newChunk)` to pass along transformed output // to the readable side. You may call 'push' zero or more times. // // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function (chunk, encoding, cb) { throw new Error('Not implemented'); }; Transform.prototype._write = function (chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. Transform.prototype._read = function (n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in // will get processed, now that we've asked for it. ts.needTransform = true; } }; function done(stream, er) { if (er) return stream.emit('error', er); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; var ts = stream._transformState; if (ws.length) throw new Error('Calling transform done when ws.length != 0'); if (ts.transforming) throw new Error('Calling transform done when still transforming'); return stream.push(null); } inherits$1(PassThrough, Transform); function PassThrough(options) { if (!(this instanceof PassThrough)) return new PassThrough(options); Transform.call(this, options); } PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; inherits$1(Stream, EventEmitter); Stream.Readable = Readable; Stream.Writable = Writable; Stream.Duplex = Duplex; Stream.Transform = Transform; Stream.PassThrough = PassThrough; // Backwards-compat with node 0.4.x Stream.Stream = Stream; // old-style streams. Note that the pipe method (the only relevant // part of this class) is overridden in the Readable class. function Stream() { EventEmitter.call(this); } Stream.prototype.pipe = function(dest, options) { var source = this; function ondata(chunk) { if (dest.writable) { if (false === dest.write(chunk) && source.pause) { source.pause(); } } } source.on('data', ondata); function ondrain() { if (source.readable && source.resume) { source.resume(); } } dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when // source gets the 'end' or 'close' events. Only dest.end() once. if (!dest._isStdio && (!options || options.end !== false)) { source.on('end', onend); source.on('close', onclose); } var didOnEnd = false; function onend() { if (didOnEnd) return; didOnEnd = true; dest.end(); } function onclose() { if (didOnEnd) return; didOnEnd = true; if (typeof dest.destroy === 'function') dest.destroy(); } // don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EventEmitter.listenerCount(this, 'error') === 0) { throw er; // Unhandled stream error in pipe. } } source.on('error', onerror); dest.on('error', onerror); // remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); } source.on('end', cleanup); source.on('close', cleanup); dest.on('close', cleanup); dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C) return dest; }; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest(); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } /* The MIT License (MIT) Copyright (c) 2016 CoderPuppy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var _endianness; function endianness() { if (typeof _endianness === 'undefined') { var a = new ArrayBuffer(2); var b = new Uint8Array(a); var c = new Uint16Array(a); b[0] = 1; b[1] = 2; if (c[0] === 258) { _endianness = 'BE'; } else if (c[0] === 513){ _endianness = 'LE'; } else { throw new Error('unable to figure out endianess'); } } return _endianness; } function hostname() { if (typeof global$1.location !== 'undefined') { return global$1.location.hostname } else return ''; } function loadavg() { return []; } function uptime() { return 0; } function freemem() { return Number.MAX_VALUE; } function totalmem() { return Number.MAX_VALUE; } function cpus() { return []; } function type() { return 'Browser'; } function release () { if (typeof global$1.navigator !== 'undefined') { return global$1.navigator.appVersion; } return ''; } function networkInterfaces(){} function getNetworkInterfaces(){} function tmpDir() { return '/tmp'; } var tmpdir = tmpDir; var EOL = '\n'; var os = { EOL: EOL, tmpdir: tmpdir, tmpDir: tmpDir, networkInterfaces:networkInterfaces, getNetworkInterfaces: getNetworkInterfaces, release: release, type: type, cpus: cpus, totalmem: totalmem, freemem: freemem, uptime: uptime, loadavg: loadavg, hostname: hostname, endianness: endianness, }; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; /** * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var funcTag = '[object Function]', genTag = '[object GeneratorFunction]', symbolTag = '[object Symbol]'; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty$1 = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString$1 = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Symbol$1 = root.Symbol, splice = arrayProto.splice; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), nativeCreate = getNative(Object, 'create'); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty$1.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty$1.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = isKey(path, object) ? [path] : castPath(path); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject$1(value) || isMasked(value)) { return false; } var pattern = (isFunction$1(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @returns {Array} Returns the cast property path array. */ function castPath(value) { return isArray$2(value) ? value : stringToPath(value); } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray$2(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function(string) { string = toString$1(string); var result = []; if (reLeadingDot.test(string)) { result.push(''); } string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result); return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Assign cache to `_.memoize`. memoize.Cache = MapCache; /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray$2 = Array.isArray; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction$1(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject$1(value) ? objectToString$1.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject$1(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString$1.call(value) == symbolTag); } /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString$1(value) { return value == null ? '' : baseToString(value); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } var lodash_get = get; function getProp(obj, path, defaultValue) { return obj[path] === undefined ? defaultValue : obj[path]; } function setProp(obj, path, value) { var pathArray = Array.isArray(path) ? path : path.split('.'); var _pathArray = _toArray(pathArray), key = _pathArray[0], restPath = _pathArray.slice(1); return _objectSpread({}, obj, _defineProperty({}, key, pathArray.length > 1 ? setProp(obj[key] || {}, restPath, value) : value)); } function unsetProp(obj, path) { var pathArray = Array.isArray(path) ? path : path.split('.'); var _pathArray2 = _toArray(pathArray), key = _pathArray2[0], restPath = _pathArray2.slice(1); if (_typeof(obj[key]) !== 'object') { // This will never be hit in the current code because unwind does the check before calling unsetProp /* istanbul ignore next */ return obj; } if (pathArray.length === 1) { return Object.keys(obj).filter(function (prop) { return prop !== key; }).reduce(function (acc, prop) { return Object.assign(acc, _defineProperty({}, prop, obj[prop])); }, {}); } return Object.keys(obj).reduce(function (acc, prop) { return _objectSpread({}, acc, _defineProperty({}, prop, prop !== key ? obj[prop] : unsetProp(obj[key], restPath))); }, {}); } function flattenReducer(acc, arr) { try { // This is faster but susceptible to `RangeError: Maximum call stack size exceeded` acc.push.apply(acc, _toConsumableArray(arr)); return acc; } catch (err) { // Fallback to a slower but safer option return acc.concat(arr); } } function fastJoin(arr, separator) { var isFirst = true; return arr.reduce(function (acc, elem) { if (elem === null || elem === undefined) { elem = ''; } if (isFirst) { isFirst = false; return "".concat(elem); } return "".concat(acc).concat(separator).concat(elem); }, ''); } var utils = { getProp: getProp, setProp: setProp, unsetProp: unsetProp, fastJoin: fastJoin, flattenReducer: flattenReducer }; var getProp$1 = utils.getProp, fastJoin$1 = utils.fastJoin, flattenReducer$1 = utils.flattenReducer; var JSON2CSVBase = /*#__PURE__*/ function () { function JSON2CSVBase(opts) { _classCallCheck(this, JSON2CSVBase); this.opts = this.preprocessOpts(opts); } /** * Check passing opts and set defaults. * * @param {Json2CsvOptions} opts Options object containing fields, * delimiter, default value, quote mark, header, etc. */ _createClass(JSON2CSVBase, [{ key: "preprocessOpts", value: function preprocessOpts(opts) { var processedOpts = Object.assign({}, opts); processedOpts.transforms = !Array.isArray(processedOpts.transforms) ? processedOpts.transforms ? [processedOpts.transforms] : [] : processedOpts.transforms; processedOpts.delimiter = processedOpts.delimiter || ','; processedOpts.eol = processedOpts.eol || os.EOL; processedOpts.quote = typeof processedOpts.quote === 'string' ? processedOpts.quote : '"'; processedOpts.escapedQuote = typeof processedOpts.escapedQuote === 'string' ? processedOpts.escapedQuote : "".concat(processedOpts.quote).concat(processedOpts.quote); processedOpts.header = processedOpts.header !== false; processedOpts.includeEmptyRows = processedOpts.includeEmptyRows || false; processedOpts.withBOM = processedOpts.withBOM || false; return processedOpts; } /** * Check and normalize the fields configuration. * * @param {(string|object)[]} fields Fields configuration provided by the user * or inferred from the data * @returns {object[]} preprocessed FieldsInfo array */ }, { key: "preprocessFieldsInfo", value: function preprocessFieldsInfo(fields) { var _this = this; return fields.map(function (fieldInfo) { if (typeof fieldInfo === 'string') { return { label: fieldInfo, value: fieldInfo.includes('.') || fieldInfo.includes('[') ? function (row) { return lodash_get(row, fieldInfo, _this.opts.defaultValue); } : function (row) { return getProp$1(row, fieldInfo, _this.opts.defaultValue); } }; } if (_typeof(fieldInfo) === 'object') { var defaultValue = 'default' in fieldInfo ? fieldInfo.default : _this.opts.defaultValue; if (typeof fieldInfo.value === 'string') { return { label: fieldInfo.label || fieldInfo.value, value: fieldInfo.value.includes('.') || fieldInfo.value.includes('[') ? function (row) { return lodash_get(row, fieldInfo.value, defaultValue); } : function (row) { return getProp$1(row, fieldInfo.value, defaultValue); } }; } if (typeof fieldInfo.value === 'function') { var label = fieldInfo.label || fieldInfo.value.name || ''; var field = { label: label, default: defaultValue }; return { label: label, value: function value(row) { var value = fieldInfo.value(row, field); return value === null || value === undefined ? defaultValue : value; } }; } } throw new Error('Invalid field info option. ' + JSON.stringify(fieldInfo)); }); } /** * Create the title row with all the provided fields as column headings * * @returns {String} titles as a string */ }, { key: "getHeader", value: function getHeader() { var _this2 = this; return fastJoin$1(this.opts.fields.map(function (fieldInfo) { return _this2.processValue(fieldInfo.label); }), this.opts.delimiter); } /** * Preprocess each object according to the given transforms (unwind, flatten, etc.). * @param {Object} row JSON object to be converted in a CSV row */ }, { key: "preprocessRow", value: function preprocessRow(row) { return this.opts.transforms.reduce(function (rows, transform) { return rows.map(function (row) { return transform(row); }).reduce(flattenReducer$1, []); }, [row]); } /** * Create the content of a specific CSV row * * @param {Object} row JSON object to be converted in a CSV row * @returns {String} CSV string (row) */ }, { key: "processRow", value: function processRow(row) { var _this3 = this; if (!row) { return undefined; } var processedRow = this.opts.fields.map(function (fieldInfo) { return _this3.processCell(row, fieldInfo); }); if (!this.opts.includeEmptyRows && processedRow.every(function (field) { return field === undefined; })) { return undefined; } return fastJoin$1(processedRow, this.opts.delimiter); } /** * Create the content of a specfic CSV row cell * * @param {Object} row JSON object representing the CSV row that the cell belongs to * @param {FieldInfo} fieldInfo Details of the field to process to be a CSV cell * @returns {String} CSV string (cell) */ }, { key: "processCell", value: function processCell(row, fieldInfo) { return this.processValue(fieldInfo.value(row)); } /** * Create the content of a specfic CSV row cell * * @param {Any} value Value to be included in a CSV cell * @returns {String} Value stringified and processed */ }, { key: "processValue", value: function processValue(value) { if (value === null || value === undefined) { return undefined; } var valueType = _typeof(value); if (valueType !== 'boolean' && valueType !== 'number' && valueType !== 'string') { value = JSON.stringify(value); if (value === undefined) { return undefined; } if (value[0] === '"') { value = value.replace(/^"(.+)"$/, '$1'); } } if (typeof value === 'string') { if (this.opts.excelStrings) { if (value.includes(this.opts.quote)) { value = value.replace(new RegExp(this.opts.quote, 'g'), "".concat(this.opts.escapedQuote).concat(this.opts.escapedQuote)); } value = "\"=\"\"".concat(value, "\"\"\""); } else { if (value.includes(this.opts.quote)) { value = value.replace(new RegExp(this.opts.quote, 'g'), this.opts.escapedQuote); } value = "".concat(this.opts.quote).concat(value).concat(this.opts.quote); } } return value; } }]); return JSON2CSVBase; }(); var JSON2CSVBase_1 = JSON2CSVBase; var fastJoin$2 = utils.fastJoin, flattenReducer$2 = utils.flattenReducer; var JSON2CSVParser = /*#__PURE__*/ function (_JSON2CSVBase) { _inherits(JSON2CSVParser, _JSON2CSVBase); function JSON2CSVParser(opts) { var _this; _classCallCheck(this, JSON2CSVParser); _this = _possibleConstructorReturn(this, _getPrototypeOf(JSON2CSVParser).call(this, opts)); if (_this.opts.fields) { _this.opts.fields = _this.preprocessFieldsInfo(_this.opts.fields); } return _this; } /** * Main function that converts json to csv. * * @param {Array|Object} data Array of JSON objects to be converted to CSV * @returns {String} The CSV formated data as a string */ _createClass(JSON2CSVParser, [{ key: "parse", value: function parse(data) { var processedData = this.preprocessData(data); if (!this.opts.fields) { this.opts.fields = processedData.reduce(function (fields, item) { Object.keys(item).forEach(function (field) { if (!fields.includes(field)) { fields.push(field); } }); return fields; }, []); this.opts.fields = this.preprocessFieldsInfo(this.opts.fields); } var header = this.opts.header ? this.getHeader() : ''; var rows = this.processData(processedData); var csv = (this.opts.withBOM ? "\uFEFF" : '') + header + (header && rows ? this.opts.eol : '') + rows; return csv; } /** * Preprocess the data according to the give opts (unwind, flatten, etc.) and calculate the fields and field names if they are not provided. * * @param {Array|Object} data Array or object to be converted to CSV */ }, { key: "preprocessData", value: function preprocessData(data) { var _this2 = this; var processedData = Array.isArray(data) ? data : [data]; if (!this.opts.fields && (processedData.length === 0 || _typeof(processedData[0]) !== 'object')) { throw new Error('Data should not be empty or the "fields" option should be included'); } if (this.opts.transforms.length === 0) return processedData; return processedData.map(function (row) { return _this2.preprocessRow(row); }).reduce(flattenReducer$2, []); } /** * Create the content row by row below the header * * @param {Array} data Array of JSON objects to be converted to CSV * @returns {String} CSV string (body) */ }, { key: "processData", value: function processData(data) { var _this3 = this; return fastJoin$2(data.map(function (row) { return _this3.processRow(row); }).filter(function (row) { return row; }), // Filter empty rows this.opts.eol); } }]); return JSON2CSVParser; }(JSON2CSVBase_1); var JSON2CSVParser_1 = JSON2CSVParser; /*global Buffer*/ // Named constants with unique integer values var C = {}; // Tokens var LEFT_BRACE = C.LEFT_BRACE = 0x1; var RIGHT_BRACE = C.RIGHT_BRACE = 0x2; var LEFT_BRACKET = C.LEFT_BRACKET = 0x3; var RIGHT_BRACKET = C.RIGHT_BRACKET = 0x4; var COLON = C.COLON = 0x5; var COMMA = C.COMMA = 0x6; var TRUE = C.TRUE = 0x7; var FALSE = C.FALSE = 0x8; var NULL = C.NULL = 0x9; var STRING = C.STRING = 0xa; var NUMBER = C.NUMBER = 0xb; // Tokenizer States var START = C.START = 0x11; var STOP = C.STOP = 0x12; var TRUE1 = C.TRUE1 = 0x21; var TRUE2 = C.TRUE2 = 0x22; var TRUE3 = C.TRUE3 = 0x23; var FALSE1 = C.FALSE1 = 0x31; var FALSE2 = C.FALSE2 = 0x32; var FALSE3 = C.FALSE3 = 0x33; var FALSE4 = C.FALSE4 = 0x34; var NULL1 = C.NULL1 = 0x41; var NULL2 = C.NULL2 = 0x42; var NULL3 = C.NULL3 = 0x43; var NUMBER1 = C.NUMBER1 = 0x51; var NUMBER3 = C.NUMBER3 = 0x53; var STRING1 = C.STRING1 = 0x61; var STRING2 = C.STRING2 = 0x62; var STRING3 = C.STRING3 = 0x63; var STRING4 = C.STRING4 = 0x64; var STRING5 = C.STRING5 = 0x65; var STRING6 = C.STRING6 = 0x66; // Parser States var VALUE = C.VALUE = 0x71; var KEY = C.KEY = 0x72; // Parser Modes var OBJECT = C.OBJECT = 0x81; var ARRAY = C.ARRAY = 0x82; // Character constants var BACK_SLASH = "\\".charCodeAt(0); var FORWARD_SLASH = "\/".charCodeAt(0); var BACKSPACE = "\b".charCodeAt(0); var FORM_FEED = "\f".charCodeAt(0); var NEWLINE = "\n".charCodeAt(0); var CARRIAGE_RETURN = "\r".charCodeAt(0); var TAB = "\t".charCodeAt(0); var STRING_BUFFER_SIZE = 64 * 1024; function Parser() { this.tState = START; this.value = undefined; this.string = undefined; // string data this.stringBuffer = Buffer.alloc ? Buffer.alloc(STRING_BUFFER_SIZE) : new Buffer(STRING_BUFFER_SIZE); this.stringBufferOffset = 0; this.unicode = undefined; // unicode escapes this.highSurrogate = undefined; this.key = undefined; this.mode = undefined; this.stack = []; this.state = VALUE; this.bytes_remaining = 0; // number of bytes remaining in multi byte utf8 char to read after split boundary this.bytes_in_sequence = 0; // bytes in multi byte utf8 char to read this.temp_buffs = { "2": new Buffer(2), "3": new Buffer(3), "4": new Buffer(4) }; // for rebuilding chars split before boundary is reached // Stream offset this.offset = -1; } // Slow code to string converter (only used when throwing syntax errors) Parser.toknam = function (code) { var keys = Object.keys(C); for (var i = 0, l = keys.length; i < l; i++) { var key = keys[i]; if (C[key] === code) { return key; } } return code && ("0x" + code.toString(16)); }; var proto = Parser.prototype; proto.onError = function (err) { throw err; }; proto.charError = function (buffer, i) { this.tState = STOP; this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer[i])) + " at position " + i + " in state " + Parser.toknam(this.tState))); }; proto.appendStringChar = function (char) { if (this.stringBufferOffset >= STRING_BUFFER_SIZE) { this.string += this.stringBuffer.toString('utf8'); this.stringBufferOffset = 0; } this.stringBuffer[this.stringBufferOffset++] = char; }; proto.appendStringBuf = function (buf, start, end) { var size = buf.length; if (typeof start === 'number') { if (typeof end === 'number') { if (end < 0) { // adding a negative end decreeses the size size = buf.length - start + end; } else { size = end - start; } } else { size = buf.length - start; } } if (size < 0) { size = 0; } if (this.stringBufferOffset + size > STRING_BUFFER_SIZE) { this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); this.stringBufferOffset = 0; } buf.copy(this.stringBuffer, this.stringBufferOffset, start, end); this.stringBufferOffset += size; }; proto.write = function (buffer) { if (typeof buffer === "string") buffer = new Buffer(buffer); var n; for (var i = 0, l = buffer.length; i < l; i++) { if (this.tState === START){ n = buffer[i]; this.offset++; if(n === 0x7b){ this.onToken(LEFT_BRACE, "{"); // { }else if(n === 0x7d){ this.onToken(RIGHT_BRACE, "}"); // } }else if(n === 0x5b){ this.onToken(LEFT_BRACKET, "["); // [ }else if(n === 0x5d){ this.onToken(RIGHT_BRACKET, "]"); // ] }else if(n === 0x3a){ this.onToken(COLON, ":"); // : }else if(n === 0x2c){ this.onToken(COMMA, ","); // , }else if(n === 0x74){ this.tState = TRUE1; // t }else if(n === 0x66){ this.tState = FALSE1; // f }else if(n === 0x6e){ this.tState = NULL1; // n }else if(n === 0x22){ // " this.string = ""; this.stringBufferOffset = 0; this.tState = STRING1; }else if(n === 0x2d){ this.string = "-"; this.tState = NUMBER1; // - }else{ if (n >= 0x30 && n < 0x40) { // 1-9 this.string = String.fromCharCode(n); this.tState = NUMBER3; } else if (n === 0x20 || n === 0x09 || n === 0x0a || n === 0x0d) ; else { return this.charError(buffer, i); } } }else if (this.tState === STRING1){ // After open quote n = buffer[i]; // get current byte from buffer // check for carry over of a multi byte char split between data chunks // & fill temp buffer it with start of this data chunk up to the boundary limit set in the last iteration if (this.bytes_remaining > 0) { for (var j = 0; j < this.bytes_remaining; j++) { this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence - this.bytes_remaining + j] = buffer[j]; } this.appendStringBuf(this.temp_buffs[this.bytes_in_sequence]); this.bytes_in_sequence = this.bytes_remaining = 0; i = i + j - 1; } else if (this.bytes_remaining === 0 && n >= 128) { // else if no remainder bytes carried over, parse multi byte (>=128) chars one at a time if (n <= 193 || n > 244) { return this.onError(new Error("Invalid UTF-8 character at position " + i + " in state " + Parser.toknam(this.tState))); } if ((n >= 194) && (n <= 223)) this.bytes_in_sequence = 2; if ((n >= 224) && (n <= 239)) this.bytes_in_sequence = 3; if ((n >= 240) && (n <= 244)) this.bytes_in_sequence = 4; if ((this.bytes_in_sequence + i) > buffer.length) { // if bytes needed to complete char fall outside buffer length, we have a boundary split for (var k = 0; k <= (buffer.length - 1 - i); k++) { this.temp_buffs[this.bytes_in_sequence][k] = buffer[i + k]; // fill temp buffer of correct size with bytes available in this chunk } this.bytes_remaining = (i + this.bytes_in_sequence) - buffer.length; i = buffer.length - 1; } else { this.appendStringBuf(buffer, i, i + this.bytes_in_sequence); i = i + this.bytes_in_sequence - 1; } } else if (n === 0x22) { this.tState = START; this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); this.stringBufferOffset = 0; this.onToken(STRING, this.string); this.offset += Buffer.byteLength(this.string, 'utf8') + 1; this.string = undefined; } else if (n === 0x5c) { this.tState = STRING2; } else if (n >= 0x20) { this.appendStringChar(n); } else { return this.charError(buffer, i); } }else if (this.tState === STRING2){ // After backslash n = buffer[i]; if(n === 0x22){ this.appendStringChar(n); this.tState = STRING1; }else if(n === 0x5c){ this.appendStringChar(BACK_SLASH); this.tState = STRING1; }else if(n === 0x2f){ this.appendStringChar(FORWARD_SLASH); this.tState = STRING1; }else if(n === 0x62){ this.appendStringChar(BACKSPACE); this.tState = STRING1; }else if(n === 0x66){ this.appendStringChar(FORM_FEED); this.tState = STRING1; }else if(n === 0x6e){ this.appendStringChar(NEWLINE); this.tState = STRING1; }else if(n === 0x72){ this.appendStringChar(CARRIAGE_RETURN); this.tState = STRING1; }else if(n === 0x74){ this.appendStringChar(TAB); this.tState = STRING1; }else if(n === 0x75){ this.unicode = ""; this.tState = STRING3; }else{ return this.charError(buffer, i); } }else if (this.tState === STRING3 || this.tState === STRING4 || this.tState === STRING5 || this.tState === STRING6){ // unicode hex codes n = buffer[i]; // 0-9 A-F a-f if ((n >= 0x30 && n < 0x40) || (n > 0x40 && n <= 0x46) || (n > 0x60 && n <= 0x66)) { this.unicode += String.fromCharCode(n); if (this.tState++ === STRING6) { var intVal = parseInt(this.unicode, 16); this.unicode = undefined; if (this.highSurrogate !== undefined && intVal >= 0xDC00 && intVal < (0xDFFF + 1)) { //<56320,57343> - lowSurrogate this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal))); this.highSurrogate = undefined; } else if (this.highSurrogate === undefined && intVal >= 0xD800 && intVal < (0xDBFF + 1)) { //<55296,56319> - highSurrogate this.highSurrogate = intVal; } else { if (this.highSurrogate !== undefined) { this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate))); this.highSurrogate = undefined; } this.appendStringBuf(new Buffer(String.fromCharCode(intVal))); } this.tState = STRING1; } } else { return this.charError(buffer, i); } } else if (this.tState === NUMBER1 || this.tState === NUMBER3) { n = buffer[i]; switch (n) { case 0x30: // 0 case 0x31: // 1 case 0x32: // 2 case 0x33: // 3 case 0x34: // 4 case 0x35: // 5 case 0x36: // 6 case 0x37: // 7 case 0x38: // 8 case 0x39: // 9 case 0x2e: // . case 0x65: // e case 0x45: // E case 0x2b: // + case 0x2d: // - this.string += String.fromCharCode(n); this.tState = NUMBER3; break; default: this.tState = START; var result = Number(this.string); if (isNaN(result)){ return this.charError(buffer, i); } if ((this.string.match(/[0-9]+/) == this.string) && (result.toString() != this.string)) { // Long string of digits which is an ID string and not valid and/or safe JavaScript integer Number this.onToken(STRING, this.string); } else { this.onToken(NUMBER, result); } this.offset += this.string.length - 1; this.string = undefined; i--; break; } }else if (this.tState === TRUE1){ // r if (buffer[i] === 0x72) { this.tState = TRUE2; } else { return this.charError(buffer, i); } }else if (this.tState === TRUE2){ // u if (buffer[i] === 0x75) { this.tState = TRUE3; } else { return this.charError(buffer, i); } }else if (this.tState === TRUE3){ // e if (buffer[i] === 0x65) { this.tState = START; this.onToken(TRUE, true); this.offset+= 3; } else { return this.charError(buffer, i); } }else if (this.tState === FALSE1){ // a if (buffer[i] === 0x61) { this.tState = FALSE2; } else { return this.charError(buffer, i); } }else if (this.tState === FALSE2){ // l if (buffer[i] === 0x6c) { this.tState = FALSE3; } else { return this.charError(buffer, i); } }else if (this.tState === FALSE3){ // s if (buffer[i] === 0x73) { this.tState = FALSE4; } else { return this.charError(buffer, i); } }else if (this.tState === FALSE4){ // e if (buffer[i] === 0x65) { this.tState = START; this.onToken(FALSE, false); this.offset+= 4; } else { return this.charError(buffer, i); } }else if (this.tState === NULL1){ // u if (buffer[i] === 0x75) { this.tState = NULL2; } else { return this.charError(buffer, i); } }else if (this.tState === NULL2){ // l if (buffer[i] === 0x6c) { this.tState = NULL3; } else { return this.charError(buffer, i); } }else if (this.tState === NULL3){ // l if (buffer[i] === 0x6c) { this.tState = START; this.onToken(NULL, null); this.offset += 3; } else { return this.charError(buffer, i); } } } }; proto.onToken = function (token, value) { // Override this to get events }; proto.parseError = function (token, value) { this.tState = STOP; this.onError(new Error("Unexpected " + Parser.toknam(token) + (value ? ("(" + JSON.stringify(value) + ")") : "") + " in state " + Parser.toknam(this.state))); }; proto.push = function () { this.stack.push({value: this.value, key: this.key, mode: this.mode}); }; proto.pop = function () { var value = this.value; var parent = this.stack.pop(); this.value = parent.value; this.key = parent.key; this.mode = parent.mode; this.emit(value); if (!this.mode) { this.state = VALUE; } }; proto.emit = function (value) { if (this.mode) { this.state = COMMA; } this.onValue(value); }; proto.onValue = function (value) { // Override me }; proto.onToken = function (token, value) { if(this.state === VALUE){ if(token === STRING || token === NUMBER || token === TRUE || token === FALSE || token === NULL){ if (this.value) { this.value[this.key] = value; } this.emit(value); }else if(token === LEFT_BRACE){ this.push(); if (this.value) { this.value = this.value[this.key] = {}; } else { this.value = {}; } this.key = undefined; this.state = KEY; this.mode = OBJECT; }else if(token === LEFT_BRACKET){ this.push(); if (this.value) { this.value = this.value[this.key] = []; } else { this.value = []; } this.key = 0; this.mode = ARRAY; this.state = VALUE; }else if(token === RIGHT_BRACE){ if (this.mode === OBJECT) { this.pop(); } else { return this.parseError(token, value); } }else if(token === RIGHT_BRACKET){ if (this.mode === ARRAY) { this.pop(); } else { return this.parseError(token, value); } }else{ return this.parseError(token, value); } }else if(this.state === KEY){ if (token === STRING) { this.key = value; this.state = COLON; } else if (token === RIGHT_BRACE) { this.pop(); } else { return this.parseError(token, value); } }else if(this.state === COLON){ if (token === COLON) { this.state = VALUE; } else { return this.parseError(token, value); } }else if(this.state === COMMA){ if (token === COMMA) { if (this.mode === ARRAY) { this.key++; this.state = VALUE; } else if (this.mode === OBJECT) { this.state = KEY; } } else if (token === RIGHT_BRACKET && this.mode === ARRAY || token === RIGHT_BRACE && this.mode === OBJECT) { this.pop(); } else { return this.parseError(token, value); } }else{ return this.parseError(token, value); } }; Parser.C = C; var jsonparse = Parser; var Transform$1 = Stream.Transform; var JSON2CSVTransform = /*#__PURE__*/ function (_Transform) { _inherits(JSON2CSVTransform, _Transform); function JSON2CSVTransform(opts, transformOpts) { var _this; _classCallCheck(this, JSON2CSVTransform); _this = _possibleConstructorReturn(this, _getPrototypeOf(JSON2CSVTransform).call(this, transformOpts)); // Inherit methods from JSON2CSVBase since extends doesn't // allow multiple inheritance and manually preprocess opts Object.getOwnPropertyNames(JSON2CSVBase_1.prototype).forEach(function (key) { return _this[key] = JSON2CSVBase_1.prototype[key]; }); _this.opts = _this.preprocessOpts(opts); _this._data = ''; _this._hasWritten = false; if (_this._readableState.objectMode) { _this.initObjectModeParse(); } else if (_this.opts.ndjson) { _this.initNDJSONParse(); } else { _this.initJSONParser(); } if (_this.opts.withBOM) { _this.push("\uFEFF"); } if (_this.opts.fields) { _this.opts.fields = _this.preprocessFieldsInfo(_this.opts.fields); _this.pushHeader(); } return _this; } /** * Init the transform with a parser to process data in object mode. * It receives JSON objects one by one and send them to `pushLine for processing. */ _createClass(JSON2CSVTransform, [{ key: "initObjectModeParse", value: function initObjectModeParse() { var transform = this; this.parser = { write: function write(line) { transform.pushLine(line); }, getPendingData: function getPendingData() { return undefined; } }; } /** * Init the transform with a parser to process NDJSON data. * It maintains a buffer of received data, parses each line * as JSON and send it to `pushLine for processing. */ }, { key: "initNDJSONParse", value: function initNDJSONParse() { var transform = this; this.parser = { _data: '', write: function write(chunk) { this._data += chunk.toString(); var lines = this._data.split('\n').map(function (line) { return line.trim(); }).filter(function (line) { return line !== ''; }); var pendingData = false; lines.forEach(function (line, i) { try { transform.pushLine(JSON.parse(line)); } catch (e) { if (i === lines.length - 1) { pendingData = true; } else { e.message = "Invalid JSON (".concat(line, ")"); transform.emit('error', e); } } }); this._data = pendingData ? this._data.slice(this._data.lastIndexOf('\n')) : ''; }, getPendingData: function getPendingData() { return this._data; } }; } /** * Init the transform with a parser to process JSON data. * It maintains a buffer of received data, parses each as JSON * item if the data is an array or the data itself otherwise * and send it to `pushLine` for processing. */ }, { key: "initJSONParser", value: function initJSONParser() { var transform = this; this.parser = new jsonparse(); this.parser.onValue = function (value) { if (this.stack.length !== this.depthToEmit) return; transform.pushLine(value); }; this.parser._onToken = this.parser.onToken; this.parser.onToken = function (token, value) { transform.parser._onToken(token, value); if (this.stack.length === 0 && !transform.opts.fields && this.mode !== jsonparse.C.ARRAY && this.mode !== jsonparse.C.OBJECT) { this.onError(new Error('Data should not be empty or the "fields" option should be included')); } if (this.stack.length === 1) { if (this.depthToEmit === undefined) { // If Array emit its content, else emit itself this.depthToEmit = this.mode === jsonparse.C.ARRAY ? 1 : 0; } if (this.depthToEmit !== 0 && this.stack.length === 1) { // No need to store the whole root array in memory this.value = undefined; } } }; this.parser.getPendingData = function () { return this.value; }; this.parser.onError = function (err) { if (err.message.includes('Unexpected')) { err.message = "Invalid JSON (".concat(err.message, ")"); } transform.emit('error', err); }; } /** * Main function that send data to the parse to be processed. * * @param {Buffer} chunk Incoming data * @param {String} encoding Encoding of the incoming data. Defaults to 'utf8' * @param {Function} done Called when the proceesing of the supplied chunk is done */ }, { key: "_transform", value: function _transform(chunk, encoding, done) { this.parser.write(chunk); done(); } }, { key: "_flush", value: function _flush(done) { if (this.parser.getPendingData()) { done(new Error('Invalid data received from stdin', this.parser.getPendingData())); } done(); } /** * Generate the csv header and pushes it downstream. */ }, { key: "pushHeader", value: function pushHeader() { if (this.opts.header) { var header = this.getHeader(); this.emit('header', header); this.push(header); this._hasWritten = true; } } /** * Transforms an incoming json data to csv and pushes it downstream. * * @param {Object} data JSON object to be converted in a CSV row */ }, { key: "pushLine", value: function pushLine(data) { var _this2 = this; var processedData = this.preprocessRow(data); if (!this._hasWritten) { this.opts.fields = this.opts.fields || this.preprocessFieldsInfo(Object.keys(processedData[0])); this.pushHeader(); } processedData.forEach(function (row) { var line = _this2.processRow(row, _this2.opts); if (line === undefined) return; _this2.emit('line', line); _this2.push(_this2._hasWritten ? _this2.opts.eol + line : line); _this2._hasWritten = true; }); } }]); return JSON2CSVTransform; }(Transform$1); var JSON2CSVTransform_1 = JSON2CSVTransform; var Transform$2 = Stream.Transform; var fastJoin$3 = utils.fastJoin; var JSON2CSVAsyncParser = /*#__PURE__*/ function () { function JSON2CSVAsyncParser(opts, transformOpts) { _classCallCheck(this, JSON2CSVAsyncParser); this.input = new Transform$2(transformOpts); this.input._read = function () {}; this.transform = new JSON2CSVTransform_1(opts, transformOpts); this.processor = this.input.pipe(this.transform); } _createClass(JSON2CSVAsyncParser, [{ key: "fromInput", value: function fromInput(input) { if (this._input) { throw new Error('Async parser already has an input.'); } this._input = input; this.input = this._input.pipe(this.processor); return this; } }, { key: "throughTransform", value: function throughTransform(transform) { if (this._output) { throw new Error('Can\'t add transforms once an output has been added.'); } this.processor = this.processor.pipe(transform); return this; } }, { key: "toOutput", value: function toOutput(output) { if (this._output) { throw new Error('Async parser already has an output.'); } this._output = output; this.processor = this.processor.pipe(output); return this; } }, { key: "promise", value: function promise() { var _this = this; var returnCSV = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return new Promise(function (resolve, reject) { if (!returnCSV) { _this.processor.on('finish', function () { return resolve(); }).on('error', function (err) { return reject(err); }); return; } var csvBuffer = []; _this.processor.on('data', function (chunk) { return csvBuffer.push(chunk.toString()); }).on('finish', function () { return resolve(fastJoin$3(csvBuffer, '')); }).on('error', function (err) { return reject(err); }); }); } }]); return JSON2CSVAsyncParser; }(); var JSON2CSVAsyncParser_1 = JSON2CSVAsyncParser; /** * Performs the flattening of a data row recursively * * @param {String} separator Separator to be used as the flattened field name * @returns {Object => Object} Flattened object */ function flatten() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$objects = _ref.objects, objects = _ref$objects === void 0 ? true : _ref$objects, _ref$arrays = _ref.arrays, arrays = _ref$arrays === void 0 ? false : _ref$arrays, _ref$separator = _ref.separator, separator = _ref$separator === void 0 ? '.' : _ref$separator; function step(obj, flatDataRow, currentPath) { Object.keys(obj).forEach(function (key) { var newPath = currentPath ? "".concat(currentPath).concat(separator).concat(key) : key; var value = obj[key]; if (objects && _typeof(value) === 'object' && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== '[object Function]' && Object.keys(value).length) { step(value, flatDataRow, newPath); return; } if (arrays && Array.isArray(value)) { step(value, flatDataRow, newPath); return; } flatDataRow[newPath] = value; }); return flatDataRow; } return function (dataRow) { return step(dataRow, {}); }; } var flatten_1 = flatten; var setProp$1 = utils.setProp, unsetProp$1 = utils.unsetProp, flattenReducer$3 = utils.flattenReducer; function getUnwindablePaths(obj, currentPath) { return Object.keys(obj).reduce(function (unwindablePaths, key) { var newPath = currentPath ? "".concat(currentPath, ".").concat(key) : key; var value = obj[key]; if (_typeof(value) === 'object' && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== '[object Function]' && Object.keys(value).length) { unwindablePaths = unwindablePaths.concat(getUnwindablePaths(value, newPath)); } else if (Array.isArray(value)) { unwindablePaths.push(newPath); unwindablePaths = unwindablePaths.concat(value.map(function (arrObj) { return getUnwindablePaths(arrObj, newPath); }).reduce(flattenReducer$3, []).filter(function (item, index, arr) { return arr.indexOf(item) !== index; })); } return unwindablePaths; }, []); } /** * Performs the unwind recursively in specified sequence * * @param {String[]} unwindPaths The paths as strings to be used to deconstruct the array * @returns {Object => Array} Array of objects containing all rows after unwind of chosen paths */ function unwind() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$paths = _ref.paths, paths = _ref$paths === void 0 ? undefined : _ref$paths, _ref$blankOut = _ref.blankOut, blankOut = _ref$blankOut === void 0 ? false : _ref$blankOut; function unwindReducer(rows, unwindPath) { return rows.map(function (row) { var unwindArray = lodash_get(row, unwindPath); if (!Array.isArray(unwindArray)) { return row; } if (!unwindArray.length) { return unsetProp$1(row, unwindPath); } return unwindArray.map(function (unwindRow, index) { var clonedRow = blankOut && index > 0 ? {} : row; return setProp$1(clonedRow, unwindPath, unwindRow); }); }).reduce(flattenReducer$3, []); } paths = Array.isArray(paths) ? paths : paths ? [paths] : undefined; return function (dataRow) { return (paths || getUnwindablePaths(dataRow)).reduce(unwindReducer, [dataRow]); }; } var unwind_1 = unwind; var Readable$1 = Stream.Readable; var Parser$1 = JSON2CSVParser_1; var AsyncParser = JSON2CSVAsyncParser_1; var Transform$3 = JSON2CSVTransform_1; // Convenience method to keep the API similar to version 3.X var parse = function parse(data, opts) { return new JSON2CSVParser_1(opts).parse(data); }; var parseAsync = function parseAsync(data, opts, transformOpts) { try { if (!(data instanceof Readable$1)) { transformOpts = Object.assign({}, transformOpts, { objectMode: true }); } var asyncParser = new JSON2CSVAsyncParser_1(opts, transformOpts); var promise = asyncParser.promise(); if (Array.isArray(data)) { data.forEach(function (item) { return asyncParser.input.push(item); }); asyncParser.input.push(null); } else if (data instanceof Readable$1) { asyncParser.fromInput(data); } else { asyncParser.input.push(data); asyncParser.input.push(null); } return promise; } catch (err) { return Promise.reject(err); } }; var transforms = { flatten: flatten_1, unwind: unwind_1 }; var json2csv = { Parser: Parser$1, AsyncParser: AsyncParser, Transform: Transform$3, parse: parse, parseAsync: parseAsync, transforms: transforms }; exports.AsyncParser = AsyncParser; exports.Parser = Parser$1; exports.Transform = Transform$3; exports.default = json2csv; exports.parse = parse; exports.parseAsync = parseAsync; exports.transforms = transforms; Object.defineProperty(exports, '__esModule', { value: true }); })); /***/ }), /***/ 4241: /***/ (function(module) { module.exports = function load (src, opts, cb) { var head = document.head || document.getElementsByTagName('head')[0] var script = document.createElement('script') if (typeof opts === 'function') { cb = opts opts = {} } opts = opts || {} cb = cb || function() {} script.type = opts.type || 'text/javascript' script.charset = opts.charset || 'utf8'; script.async = 'async' in opts ? !!opts.async : true script.src = src if (opts.attrs) { setAttributes(script, opts.attrs) } if (opts.text) { script.text = '' + opts.text } var onend = 'onload' in script ? stdOnEnd : ieOnEnd onend(script, cb) // some good legacy browsers (firefox) fail the 'in' detection above // so as a fallback we always set onload // old IE will ignore this and new IE will set onload if (!script.onload) { stdOnEnd(script, cb); } head.appendChild(script) } function setAttributes(script, attrs) { for (var attr in attrs) { script.setAttribute(attr, attrs[attr]); } } function stdOnEnd (script, cb) { script.onload = function () { this.onerror = this.onload = null cb(null, script) } script.onerror = function () { // this.onload = null here is necessary // because even IE9 works not like others this.onerror = this.onload = null cb(new Error('Failed to load ' + this.src), script) } } function ieOnEnd (script, cb) { script.onreadystatechange = function () { if (this.readyState != 'complete' && this.readyState != 'loaded') return this.onreadystatechange = null cb(null, script) // there is no way to catch loading errors in IE8 } } /***/ }), /***/ 415: /***/ (function(module) { /*!*************************************************** * mark.js v8.11.1 * https://markjs.io/ * Copyright (c) 2014–2018, Julian Kühnel * Released under the MIT license https://git.io/vwTVl *****************************************************/ (function (global, factory) { true ? module.exports = factory() : 0; }(this, (function () { 'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var DOMIterator = function () { function DOMIterator(ctx) { var iframes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; var iframesTimeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5000; classCallCheck(this, DOMIterator); this.ctx = ctx; this.iframes = iframes; this.exclude = exclude; this.iframesTimeout = iframesTimeout; } createClass(DOMIterator, [{ key: 'getContexts', value: function getContexts() { var ctx = void 0, filteredCtx = []; if (typeof this.ctx === 'undefined' || !this.ctx) { ctx = []; } else if (NodeList.prototype.isPrototypeOf(this.ctx)) { ctx = Array.prototype.slice.call(this.ctx); } else if (Array.isArray(this.ctx)) { ctx = this.ctx; } else if (typeof this.ctx === 'string') { ctx = Array.prototype.slice.call(document.querySelectorAll(this.ctx)); } else { ctx = [this.ctx]; } ctx.forEach(function (ctx) { var isDescendant = filteredCtx.filter(function (contexts) { return contexts.contains(ctx); }).length > 0; if (filteredCtx.indexOf(ctx) === -1 && !isDescendant) { filteredCtx.push(ctx); } }); return filteredCtx; } }, { key: 'getIframeContents', value: function getIframeContents(ifr, successFn) { var errorFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {}; var doc = void 0; try { var ifrWin = ifr.contentWindow; doc = ifrWin.document; if (!ifrWin || !doc) { throw new Error('iframe inaccessible'); } } catch (e) { errorFn(); } if (doc) { successFn(doc); } } }, { key: 'isIframeBlank', value: function isIframeBlank(ifr) { var bl = 'about:blank', src = ifr.getAttribute('src').trim(), href = ifr.contentWindow.location.href; return href === bl && src !== bl && src; } }, { key: 'observeIframeLoad', value: function observeIframeLoad(ifr, successFn, errorFn) { var _this = this; var called = false, tout = null; var listener = function listener() { if (called) { return; } called = true; clearTimeout(tout); try { if (!_this.isIframeBlank(ifr)) { ifr.removeEventListener('load', listener); _this.getIframeContents(ifr, successFn, errorFn); } } catch (e) { errorFn(); } }; ifr.addEventListener('load', listener); tout = setTimeout(listener, this.iframesTimeout); } }, { key: 'onIframeReady', value: function onIframeReady(ifr, successFn, errorFn) { try { if (ifr.contentWindow.document.readyState === 'complete') { if (this.isIframeBlank(ifr)) { this.observeIframeLoad(ifr, successFn, errorFn); } else { this.getIframeContents(ifr, successFn, errorFn); } } else { this.observeIframeLoad(ifr, successFn, errorFn); } } catch (e) { errorFn(); } } }, { key: 'waitForIframes', value: function waitForIframes(ctx, done) { var _this2 = this; var eachCalled = 0; this.forEachIframe(ctx, function () { return true; }, function (ifr) { eachCalled++; _this2.waitForIframes(ifr.querySelector('html'), function () { if (! --eachCalled) { done(); } }); }, function (handled) { if (!handled) { done(); } }); } }, { key: 'forEachIframe', value: function forEachIframe(ctx, filter, each) { var _this3 = this; var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {}; var ifr = ctx.querySelectorAll('iframe'), open = ifr.length, handled = 0; ifr = Array.prototype.slice.call(ifr); var checkEnd = function checkEnd() { if (--open <= 0) { end(handled); } }; if (!open) { checkEnd(); } ifr.forEach(function (ifr) { if (DOMIterator.matches(ifr, _this3.exclude)) { checkEnd(); } else { _this3.onIframeReady(ifr, function (con) { if (filter(ifr)) { handled++; each(con); } checkEnd(); }, checkEnd); } }); } }, { key: 'createIterator', value: function createIterator(ctx, whatToShow, filter) { return document.createNodeIterator(ctx, whatToShow, filter, false); } }, { key: 'createInstanceOnIframe', value: function createInstanceOnIframe(contents) { return new DOMIterator(contents.querySelector('html'), this.iframes); } }, { key: 'compareNodeIframe', value: function compareNodeIframe(node, prevNode, ifr) { var compCurr = node.compareDocumentPosition(ifr), prev = Node.DOCUMENT_POSITION_PRECEDING; if (compCurr & prev) { if (prevNode !== null) { var compPrev = prevNode.compareDocumentPosition(ifr), after = Node.DOCUMENT_POSITION_FOLLOWING; if (compPrev & after) { return true; } } else { return true; } } return false; } }, { key: 'getIteratorNode', value: function getIteratorNode(itr) { var prevNode = itr.previousNode(); var node = void 0; if (prevNode === null) { node = itr.nextNode(); } else { node = itr.nextNode() && itr.nextNode(); } return { prevNode: prevNode, node: node }; } }, { key: 'checkIframeFilter', value: function checkIframeFilter(node, prevNode, currIfr, ifr) { var key = false, handled = false; ifr.forEach(function (ifrDict, i) { if (ifrDict.val === currIfr) { key = i; handled = ifrDict.handled; } }); if (this.compareNodeIframe(node, prevNode, currIfr)) { if (key === false && !handled) { ifr.push({ val: currIfr, handled: true }); } else if (key !== false && !handled) { ifr[key].handled = true; } return true; } if (key === false) { ifr.push({ val: currIfr, handled: false }); } return false; } }, { key: 'handleOpenIframes', value: function handleOpenIframes(ifr, whatToShow, eCb, fCb) { var _this4 = this; ifr.forEach(function (ifrDict) { if (!ifrDict.handled) { _this4.getIframeContents(ifrDict.val, function (con) { _this4.createInstanceOnIframe(con).forEachNode(whatToShow, eCb, fCb); }); } }); } }, { key: 'iterateThroughNodes', value: function iterateThroughNodes(whatToShow, ctx, eachCb, filterCb, doneCb) { var _this5 = this; var itr = this.createIterator(ctx, whatToShow, filterCb); var ifr = [], elements = [], node = void 0, prevNode = void 0, retrieveNodes = function retrieveNodes() { var _getIteratorNode = _this5.getIteratorNode(itr); prevNode = _getIteratorNode.prevNode; node = _getIteratorNode.node; return node; }; while (retrieveNodes()) { if (this.iframes) { this.forEachIframe(ctx, function (currIfr) { return _this5.checkIframeFilter(node, prevNode, currIfr, ifr); }, function (con) { _this5.createInstanceOnIframe(con).forEachNode(whatToShow, function (ifrNode) { return elements.push(ifrNode); }, filterCb); }); } elements.push(node); } elements.forEach(function (node) { eachCb(node); }); if (this.iframes) { this.handleOpenIframes(ifr, whatToShow, eachCb, filterCb); } doneCb(); } }, { key: 'forEachNode', value: function forEachNode(whatToShow, each, filter) { var _this6 = this; var done = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {}; var contexts = this.getContexts(); var open = contexts.length; if (!open) { done(); } contexts.forEach(function (ctx) { var ready = function ready() { _this6.iterateThroughNodes(whatToShow, ctx, each, filter, function () { if (--open <= 0) { done(); } }); }; if (_this6.iframes) { _this6.waitForIframes(ctx, ready); } else { ready(); } }); } }], [{ key: 'matches', value: function matches(element, selector) { var selectors = typeof selector === 'string' ? [selector] : selector, fn = element.matches || element.matchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.webkitMatchesSelector; if (fn) { var match = false; selectors.every(function (sel) { if (fn.call(element, sel)) { match = true; return false; } return true; }); return match; } else { return false; } } }]); return DOMIterator; }(); var Mark$1 = function () { function Mark(ctx) { classCallCheck(this, Mark); this.ctx = ctx; this.ie = false; var ua = window.navigator.userAgent; if (ua.indexOf('MSIE') > -1 || ua.indexOf('Trident') > -1) { this.ie = true; } } createClass(Mark, [{ key: 'log', value: function log(msg) { var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'debug'; var log = this.opt.log; if (!this.opt.debug) { return; } if ((typeof log === 'undefined' ? 'undefined' : _typeof(log)) === 'object' && typeof log[level] === 'function') { log[level]('mark.js: ' + msg); } } }, { key: 'escapeStr', value: function escapeStr(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } }, { key: 'createRegExp', value: function createRegExp(str) { if (this.opt.wildcards !== 'disabled') { str = this.setupWildcardsRegExp(str); } str = this.escapeStr(str); if (Object.keys(this.opt.synonyms).length) { str = this.createSynonymsRegExp(str); } if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) { str = this.setupIgnoreJoinersRegExp(str); } if (this.opt.diacritics) { str = this.createDiacriticsRegExp(str); } str = this.createMergedBlanksRegExp(str); if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) { str = this.createJoinersRegExp(str); } if (this.opt.wildcards !== 'disabled') { str = this.createWildcardsRegExp(str); } str = this.createAccuracyRegExp(str); return str; } }, { key: 'createSynonymsRegExp', value: function createSynonymsRegExp(str) { var syn = this.opt.synonyms, sens = this.opt.caseSensitive ? '' : 'i', joinerPlaceholder = this.opt.ignoreJoiners || this.opt.ignorePunctuation.length ? '\0' : ''; for (var index in syn) { if (syn.hasOwnProperty(index)) { var value = syn[index], k1 = this.opt.wildcards !== 'disabled' ? this.setupWildcardsRegExp(index) : this.escapeStr(index), k2 = this.opt.wildcards !== 'disabled' ? this.setupWildcardsRegExp(value) : this.escapeStr(value); if (k1 !== '' && k2 !== '') { str = str.replace(new RegExp('(' + this.escapeStr(k1) + '|' + this.escapeStr(k2) + ')', 'gm' + sens), joinerPlaceholder + ('(' + this.processSynomyms(k1) + '|') + (this.processSynomyms(k2) + ')') + joinerPlaceholder); } } } return str; } }, { key: 'processSynomyms', value: function processSynomyms(str) { if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) { str = this.setupIgnoreJoinersRegExp(str); } return str; } }, { key: 'setupWildcardsRegExp', value: function setupWildcardsRegExp(str) { str = str.replace(/(?:\\)*\?/g, function (val) { return val.charAt(0) === '\\' ? '?' : '\x01'; }); return str.replace(/(?:\\)*\*/g, function (val) { return val.charAt(0) === '\\' ? '*' : '\x02'; }); } }, { key: 'createWildcardsRegExp', value: function createWildcardsRegExp(str) { var spaces = this.opt.wildcards === 'withSpaces'; return str.replace(/\u0001/g, spaces ? '[\\S\\s]?' : '\\S?').replace(/\u0002/g, spaces ? '[\\S\\s]*?' : '\\S*'); } }, { key: 'setupIgnoreJoinersRegExp', value: function setupIgnoreJoinersRegExp(str) { return str.replace(/[^(|)\\]/g, function (val, indx, original) { var nextChar = original.charAt(indx + 1); if (/[(|)\\]/.test(nextChar) || nextChar === '') { return val; } else { return val + '\0'; } }); } }, { key: 'createJoinersRegExp', value: function createJoinersRegExp(str) { var joiner = []; var ignorePunctuation = this.opt.ignorePunctuation; if (Array.isArray(ignorePunctuation) && ignorePunctuation.length) { joiner.push(this.escapeStr(ignorePunctuation.join(''))); } if (this.opt.ignoreJoiners) { joiner.push('\\u00ad\\u200b\\u200c\\u200d'); } return joiner.length ? str.split(/\u0000+/).join('[' + joiner.join('') + ']*') : str; } }, { key: 'createDiacriticsRegExp', value: function createDiacriticsRegExp(str) { var sens = this.opt.caseSensitive ? '' : 'i', dct = this.opt.caseSensitive ? ['aàáảãạăằắẳẵặâầấẩẫậäåāą', 'AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ', 'cçćč', 'CÇĆČ', 'dđď', 'DĐĎ', 'eèéẻẽẹêềếểễệëěēę', 'EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ', 'iìíỉĩịîïī', 'IÌÍỈĨỊÎÏĪ', 'lł', 'LŁ', 'nñňń', 'NÑŇŃ', 'oòóỏõọôồốổỗộơởỡớờợöøō', 'OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ', 'rř', 'RŘ', 'sšśșş', 'SŠŚȘŞ', 'tťțţ', 'TŤȚŢ', 'uùúủũụưừứửữựûüůū', 'UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ', 'yýỳỷỹỵÿ', 'YÝỲỶỸỴŸ', 'zžżź', 'ZŽŻŹ'] : ['aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ', 'cçćčCÇĆČ', 'dđďDĐĎ', 'eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ', 'iìíỉĩịîïīIÌÍỈĨỊÎÏĪ', 'lłLŁ', 'nñňńNÑŇŃ', 'oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ', 'rřRŘ', 'sšśșşSŠŚȘŞ', 'tťțţTŤȚŢ', 'uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ', 'yýỳỷỹỵÿYÝỲỶỸỴŸ', 'zžżźZŽŻŹ']; var handled = []; str.split('').forEach(function (ch) { dct.every(function (dct) { if (dct.indexOf(ch) !== -1) { if (handled.indexOf(dct) > -1) { return false; } str = str.replace(new RegExp('[' + dct + ']', 'gm' + sens), '[' + dct + ']'); handled.push(dct); } return true; }); }); return str; } }, { key: 'createMergedBlanksRegExp', value: function createMergedBlanksRegExp(str) { return str.replace(/[\s]+/gmi, '[\\s]+'); } }, { key: 'createAccuracyRegExp', value: function createAccuracyRegExp(str) { var _this = this; var chars = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~¡¿'; var acc = this.opt.accuracy, val = typeof acc === 'string' ? acc : acc.value, ls = typeof acc === 'string' ? [] : acc.limiters, lsJoin = ''; ls.forEach(function (limiter) { lsJoin += '|' + _this.escapeStr(limiter); }); switch (val) { case 'partially': default: return '()(' + str + ')'; case 'complementary': lsJoin = '\\s' + (lsJoin ? lsJoin : this.escapeStr(chars)); return '()([^' + lsJoin + ']*' + str + '[^' + lsJoin + ']*)'; case 'exactly': return '(^|\\s' + lsJoin + ')(' + str + ')(?=$|\\s' + lsJoin + ')'; } } }, { key: 'getSeparatedKeywords', value: function getSeparatedKeywords(sv) { var _this2 = this; var stack = []; sv.forEach(function (kw) { if (!_this2.opt.separateWordSearch) { if (kw.trim() && stack.indexOf(kw) === -1) { stack.push(kw); } } else { kw.split(' ').forEach(function (kwSplitted) { if (kwSplitted.trim() && stack.indexOf(kwSplitted) === -1) { stack.push(kwSplitted); } }); } }); return { 'keywords': stack.sort(function (a, b) { return b.length - a.length; }), 'length': stack.length }; } }, { key: 'isNumeric', value: function isNumeric(value) { return Number(parseFloat(value)) == value; } }, { key: 'checkRanges', value: function checkRanges(array) { var _this3 = this; if (!Array.isArray(array) || Object.prototype.toString.call(array[0]) !== '[object Object]') { this.log('markRanges() will only accept an array of objects'); this.opt.noMatch(array); return []; } var stack = []; var last = 0; array.sort(function (a, b) { return a.start - b.start; }).forEach(function (item) { var _callNoMatchOnInvalid = _this3.callNoMatchOnInvalidRanges(item, last), start = _callNoMatchOnInvalid.start, end = _callNoMatchOnInvalid.end, valid = _callNoMatchOnInvalid.valid; if (valid) { item.start = start; item.length = end - start; stack.push(item); last = end; } }); return stack; } }, { key: 'callNoMatchOnInvalidRanges', value: function callNoMatchOnInvalidRanges(range, last) { var start = void 0, end = void 0, valid = false; if (range && typeof range.start !== 'undefined') { start = parseInt(range.start, 10); end = start + parseInt(range.length, 10); if (this.isNumeric(range.start) && this.isNumeric(range.length) && end - last > 0 && end - start > 0) { valid = true; } else { this.log('Ignoring invalid or overlapping range: ' + ('' + JSON.stringify(range))); this.opt.noMatch(range); } } else { this.log('Ignoring invalid range: ' + JSON.stringify(range)); this.opt.noMatch(range); } return { start: start, end: end, valid: valid }; } }, { key: 'checkWhitespaceRanges', value: function checkWhitespaceRanges(range, originalLength, string) { var end = void 0, valid = true, max = string.length, offset = originalLength - max, start = parseInt(range.start, 10) - offset; start = start > max ? max : start; end = start + parseInt(range.length, 10); if (end > max) { end = max; this.log('End range automatically set to the max value of ' + max); } if (start < 0 || end - start < 0 || start > max || end > max) { valid = false; this.log('Invalid range: ' + JSON.stringify(range)); this.opt.noMatch(range); } else if (string.substring(start, end).replace(/\s+/g, '') === '') { valid = false; this.log('Skipping whitespace only range: ' + JSON.stringify(range)); this.opt.noMatch(range); } return { start: start, end: end, valid: valid }; } }, { key: 'getTextNodes', value: function getTextNodes(cb) { var _this4 = this; var val = '', nodes = []; this.iterator.forEachNode(NodeFilter.SHOW_TEXT, function (node) { nodes.push({ start: val.length, end: (val += node.textContent).length, node: node }); }, function (node) { if (_this4.matchesExclude(node.parentNode)) { return NodeFilter.FILTER_REJECT; } else { return NodeFilter.FILTER_ACCEPT; } }, function () { cb({ value: val, nodes: nodes }); }); } }, { key: 'matchesExclude', value: function matchesExclude(el) { return DOMIterator.matches(el, this.opt.exclude.concat(['script', 'style', 'title', 'head', 'html'])); } }, { key: 'wrapRangeInTextNode', value: function wrapRangeInTextNode(node, start, end) { var hEl = !this.opt.element ? 'mark' : this.opt.element, startNode = node.splitText(start), ret = startNode.splitText(end - start); var repl = document.createElement(hEl); repl.setAttribute('data-markjs', 'true'); if (this.opt.className) { repl.setAttribute('class', this.opt.className); } repl.textContent = startNode.textContent; startNode.parentNode.replaceChild(repl, startNode); return ret; } }, { key: 'wrapRangeInMappedTextNode', value: function wrapRangeInMappedTextNode(dict, start, end, filterCb, eachCb) { var _this5 = this; dict.nodes.every(function (n, i) { var sibl = dict.nodes[i + 1]; if (typeof sibl === 'undefined' || sibl.start > start) { if (!filterCb(n.node)) { return false; } var s = start - n.start, e = (end > n.end ? n.end : end) - n.start, startStr = dict.value.substr(0, n.start), endStr = dict.value.substr(e + n.start); n.node = _this5.wrapRangeInTextNode(n.node, s, e); dict.value = startStr + endStr; dict.nodes.forEach(function (k, j) { if (j >= i) { if (dict.nodes[j].start > 0 && j !== i) { dict.nodes[j].start -= e; } dict.nodes[j].end -= e; } }); end -= e; eachCb(n.node.previousSibling, n.start); if (end > n.end) { start = n.end; } else { return false; } } return true; }); } }, { key: 'wrapMatches', value: function wrapMatches(regex, ignoreGroups, filterCb, eachCb, endCb) { var _this6 = this; var matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1; this.getTextNodes(function (dict) { dict.nodes.forEach(function (node) { node = node.node; var match = void 0; while ((match = regex.exec(node.textContent)) !== null && match[matchIdx] !== '') { if (!filterCb(match[matchIdx], node)) { continue; } var pos = match.index; if (matchIdx !== 0) { for (var i = 1; i < matchIdx; i++) { pos += match[i].length; } } node = _this6.wrapRangeInTextNode(node, pos, pos + match[matchIdx].length); eachCb(node.previousSibling); regex.lastIndex = 0; } }); endCb(); }); } }, { key: 'wrapMatchesAcrossElements', value: function wrapMatchesAcrossElements(regex, ignoreGroups, filterCb, eachCb, endCb) { var _this7 = this; var matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1; this.getTextNodes(function (dict) { var match = void 0; while ((match = regex.exec(dict.value)) !== null && match[matchIdx] !== '') { var start = match.index; if (matchIdx !== 0) { for (var i = 1; i < matchIdx; i++) { start += match[i].length; } } var end = start + match[matchIdx].length; _this7.wrapRangeInMappedTextNode(dict, start, end, function (node) { return filterCb(match[matchIdx], node); }, function (node, lastIndex) { regex.lastIndex = lastIndex; eachCb(node); }); } endCb(); }); } }, { key: 'wrapRangeFromIndex', value: function wrapRangeFromIndex(ranges, filterCb, eachCb, endCb) { var _this8 = this; this.getTextNodes(function (dict) { var originalLength = dict.value.length; ranges.forEach(function (range, counter) { var _checkWhitespaceRange = _this8.checkWhitespaceRanges(range, originalLength, dict.value), start = _checkWhitespaceRange.start, end = _checkWhitespaceRange.end, valid = _checkWhitespaceRange.valid; if (valid) { _this8.wrapRangeInMappedTextNode(dict, start, end, function (node) { return filterCb(node, range, dict.value.substring(start, end), counter); }, function (node) { eachCb(node, range); }); } }); endCb(); }); } }, { key: 'unwrapMatches', value: function unwrapMatches(node) { var parent = node.parentNode; var docFrag = document.createDocumentFragment(); while (node.firstChild) { docFrag.appendChild(node.removeChild(node.firstChild)); } parent.replaceChild(docFrag, node); if (!this.ie) { parent.normalize(); } else { this.normalizeTextNode(parent); } } }, { key: 'normalizeTextNode', value: function normalizeTextNode(node) { if (!node) { return; } if (node.nodeType === 3) { while (node.nextSibling && node.nextSibling.nodeType === 3) { node.nodeValue += node.nextSibling.nodeValue; node.parentNode.removeChild(node.nextSibling); } } else { this.normalizeTextNode(node.firstChild); } this.normalizeTextNode(node.nextSibling); } }, { key: 'markRegExp', value: function markRegExp(regexp, opt) { var _this9 = this; this.opt = opt; this.log('Searching with expression "' + regexp + '"'); var totalMatches = 0, fn = 'wrapMatches'; var eachCb = function eachCb(element) { totalMatches++; _this9.opt.each(element); }; if (this.opt.acrossElements) { fn = 'wrapMatchesAcrossElements'; } this[fn](regexp, this.opt.ignoreGroups, function (match, node) { return _this9.opt.filter(node, match, totalMatches); }, eachCb, function () { if (totalMatches === 0) { _this9.opt.noMatch(regexp); } _this9.opt.done(totalMatches); }); } }, { key: 'mark', value: function mark(sv, opt) { var _this10 = this; this.opt = opt; var totalMatches = 0, fn = 'wrapMatches'; var _getSeparatedKeywords = this.getSeparatedKeywords(typeof sv === 'string' ? [sv] : sv), kwArr = _getSeparatedKeywords.keywords, kwArrLen = _getSeparatedKeywords.length, sens = this.opt.caseSensitive ? '' : 'i', handler = function handler(kw) { var regex = new RegExp(_this10.createRegExp(kw), 'gm' + sens), matches = 0; _this10.log('Searching with expression "' + regex + '"'); _this10[fn](regex, 1, function (term, node) { return _this10.opt.filter(node, kw, totalMatches, matches); }, function (element) { matches++; totalMatches++; _this10.opt.each(element); }, function () { if (matches === 0) { _this10.opt.noMatch(kw); } if (kwArr[kwArrLen - 1] === kw) { _this10.opt.done(totalMatches); } else { handler(kwArr[kwArr.indexOf(kw) + 1]); } }); }; if (this.opt.acrossElements) { fn = 'wrapMatchesAcrossElements'; } if (kwArrLen === 0) { this.opt.done(totalMatches); } else { handler(kwArr[0]); } } }, { key: 'markRanges', value: function markRanges(rawRanges, opt) { var _this11 = this; this.opt = opt; var totalMatches = 0, ranges = this.checkRanges(rawRanges); if (ranges && ranges.length) { this.log('Starting to mark with the following ranges: ' + JSON.stringify(ranges)); this.wrapRangeFromIndex(ranges, function (node, range, match, counter) { return _this11.opt.filter(node, range, match, counter); }, function (element, range) { totalMatches++; _this11.opt.each(element, range); }, function () { _this11.opt.done(totalMatches); }); } else { this.opt.done(totalMatches); } } }, { key: 'unmark', value: function unmark(opt) { var _this12 = this; this.opt = opt; var sel = this.opt.element ? this.opt.element : '*'; sel += '[data-markjs]'; if (this.opt.className) { sel += '.' + this.opt.className; } this.log('Removal selector "' + sel + '"'); this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT, function (node) { _this12.unwrapMatches(node); }, function (node) { var matchesSel = DOMIterator.matches(node, sel), matchesExclude = _this12.matchesExclude(node); if (!matchesSel || matchesExclude) { return NodeFilter.FILTER_REJECT; } else { return NodeFilter.FILTER_ACCEPT; } }, this.opt.done); } }, { key: 'opt', set: function set$$1(val) { this._opt = _extends({}, { 'element': '', 'className': '', 'exclude': [], 'iframes': false, 'iframesTimeout': 5000, 'separateWordSearch': true, 'diacritics': true, 'synonyms': {}, 'accuracy': 'partially', 'acrossElements': false, 'caseSensitive': false, 'ignoreJoiners': false, 'ignoreGroups': 0, 'ignorePunctuation': [], 'wildcards': 'disabled', 'each': function each() {}, 'noMatch': function noMatch() {}, 'filter': function filter() { return true; }, 'done': function done() {}, 'debug': false, 'log': window.console }, val); }, get: function get$$1() { return this._opt; } }, { key: 'iterator', get: function get$$1() { return new DOMIterator(this.ctx, this.opt.iframes, this.opt.exclude, this.opt.iframesTimeout); } }]); return Mark; }(); function Mark(ctx) { var _this = this; var instance = new Mark$1(ctx); this.mark = function (sv, opt) { instance.mark(sv, opt); return _this; }; this.markRegExp = function (sv, opt) { instance.markRegExp(sv, opt); return _this; }; this.markRanges = function (sv, opt) { instance.markRanges(sv, opt); return _this; }; this.unmark = function (opt) { instance.unmark(opt); return _this; }; return this; } return Mark; }))); /***/ }), /***/ 3097: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var safeIsNaN = Number.isNaN || function ponyfill(value) { return typeof value === 'number' && value !== value; }; function isEqual(first, second) { if (first === second) { return true; } if (safeIsNaN(first) && safeIsNaN(second)) { return true; } return false; } function areInputsEqual(newInputs, lastInputs) { if (newInputs.length !== lastInputs.length) { return false; } for (var i = 0; i < newInputs.length; i++) { if (!isEqual(newInputs[i], lastInputs[i])) { return false; } } return true; } function memoizeOne(resultFn, isEqual) { if (isEqual === void 0) { isEqual = areInputsEqual; } var lastThis; var lastArgs = []; var lastResult; var calledOnce = false; function memoized() { var newArgs = []; for (var _i = 0; _i < arguments.length; _i++) { newArgs[_i] = arguments[_i]; } if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) { return lastResult; } lastResult = resultFn.apply(this, newArgs); calledOnce = true; lastThis = this; lastArgs = newArgs; return lastResult; } return memoized; } /* harmony default export */ __webpack_exports__["default"] = (memoizeOne); /***/ }), /***/ 9921: /***/ (function(module) { "use strict"; var numberIsNaN = function (value) { return value !== value; }; module.exports = function is(a, b) { if (a === 0 && b === 0) { return 1 / a === 1 / b; } if (a === b) { return true; } if (numberIsNaN(a) && numberIsNaN(b)) { return true; } return false; }; /***/ }), /***/ 911: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var define = __webpack_require__(1898); var callBind = __webpack_require__(3784); var implementation = __webpack_require__(9921); var getPolyfill = __webpack_require__(4836); var shim = __webpack_require__(3726); var polyfill = callBind(getPolyfill(), Object); define(polyfill, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }); module.exports = polyfill; /***/ }), /***/ 4836: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var implementation = __webpack_require__(9921); module.exports = function getPolyfill() { return typeof Object.is === 'function' ? Object.is : implementation; }; /***/ }), /***/ 3726: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var getPolyfill = __webpack_require__(4836); var define = __webpack_require__(1898); module.exports = function shimObjectIs() { var polyfill = getPolyfill(); define(Object, { is: polyfill }, { is: function testObjectIs() { return Object.is !== polyfill; } }); return polyfill; }; /***/ }), /***/ 8541: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var keysShim; if (!Object.keys) { // modified from https://github.com/es-shims/es5-shim var has = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var isArgs = __webpack_require__(7411); // eslint-disable-line global-require var isEnumerable = Object.prototype.propertyIsEnumerable; var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); var dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ]; var equalsConstructorPrototype = function (o) { var ctor = o.constructor; return ctor && ctor.prototype === o; }; var excludedKeys = { $applicationCache: true, $console: true, $external: true, $frame: true, $frameElement: true, $frames: true, $innerHeight: true, $innerWidth: true, $onmozfullscreenchange: true, $onmozfullscreenerror: true, $outerHeight: true, $outerWidth: true, $pageXOffset: true, $pageYOffset: true, $parent: true, $scrollLeft: true, $scrollTop: true, $scrollX: true, $scrollY: true, $self: true, $webkitIndexedDB: true, $webkitStorageInfo: true, $window: true }; var hasAutomationEqualityBug = (function () { /* global window */ if (typeof window === 'undefined') { return false; } for (var k in window) { try { if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { try { equalsConstructorPrototype(window[k]); } catch (e) { return true; } } } catch (e) { return true; } } return false; }()); var equalsConstructorPrototypeIfNotBuggy = function (o) { /* global window */ if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(o); } try { return equalsConstructorPrototype(o); } catch (e) { return false; } }; keysShim = function keys(object) { var isObject = object !== null && typeof object === 'object'; var isFunction = toStr.call(object) === '[object Function]'; var isArguments = isArgs(object); var isString = isObject && toStr.call(object) === '[object String]'; var theKeys = []; if (!isObject && !isFunction && !isArguments) { throw new TypeError('Object.keys called on a non-object'); } var skipProto = hasProtoEnumBug && isFunction; if (isString && object.length > 0 && !has.call(object, 0)) { for (var i = 0; i < object.length; ++i) { theKeys.push(String(i)); } } if (isArguments && object.length > 0) { for (var j = 0; j < object.length; ++j) { theKeys.push(String(j)); } } else { for (var name in object) { if (!(skipProto && name === 'prototype') && has.call(object, name)) { theKeys.push(String(name)); } } } if (hasDontEnumBug) { var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); for (var k = 0; k < dontEnums.length; ++k) { if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { theKeys.push(dontEnums[k]); } } } return theKeys; }; } module.exports = keysShim; /***/ }), /***/ 8555: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var slice = Array.prototype.slice; var isArgs = __webpack_require__(7411); var origKeys = Object.keys; var keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__(8541); var originalKeys = Object.keys; keysShim.shim = function shimObjectKeys() { if (Object.keys) { var keysWorksWithArguments = (function () { // Safari 5.0 bug var args = Object.keys(arguments); return args && args.length === arguments.length; }(1, 2)); if (!keysWorksWithArguments) { Object.keys = function keys(object) { // eslint-disable-line func-name-matching if (isArgs(object)) { return originalKeys(slice.call(object)); } return originalKeys(object); }; } } else { Object.keys = keysShim; } return Object.keys || keysShim; }; module.exports = keysShim; /***/ }), /***/ 7411: /***/ (function(module) { "use strict"; var toStr = Object.prototype.toString; module.exports = function isArguments(value) { var str = toStr.call(value); var isArgs = str === '[object Arguments]'; if (!isArgs) { isArgs = str !== '[object Array]' && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && toStr.call(value.callee) === '[object Function]'; } return isArgs; }; /***/ }), /***/ 8745: /***/ (function(module) { /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */ var hasElementType = typeof Element !== 'undefined'; var hasMap = typeof Map === 'function'; var hasSet = typeof Set === 'function'; var hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView; // Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js function equal(a, b) { // START: fast-deep-equal es6/index.js 3.1.3 if (a === b) return true; if (a && b && typeof a == 'object' && typeof b == 'object') { if (a.constructor !== b.constructor) return false; var length, i, keys; if (Array.isArray(a)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false; return true; } // START: Modifications: // 1. Extra `has &&` helpers in initial condition allow es6 code // to co-exist with es5. // 2. Replace `for of` with es5 compliant iteration using `for`. // Basically, take: // // ```js // for (i of a.entries()) // if (!b.has(i[0])) return false; // ``` // // ... and convert to: // // ```js // it = a.entries(); // while (!(i = it.next()).done) // if (!b.has(i.value[0])) return false; // ``` // // **Note**: `i` access switches to `i.value`. var it; if (hasMap && (a instanceof Map) && (b instanceof Map)) { if (a.size !== b.size) return false; it = a.entries(); while (!(i = it.next()).done) if (!b.has(i.value[0])) return false; it = a.entries(); while (!(i = it.next()).done) if (!equal(i.value[1], b.get(i.value[0]))) return false; return true; } if (hasSet && (a instanceof Set) && (b instanceof Set)) { if (a.size !== b.size) return false; it = a.entries(); while (!(i = it.next()).done) if (!b.has(i.value[0])) return false; return true; } // END: Modifications if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { length = a.length; if (length != b.length) return false; for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; return true; } if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; // START: Modifications: // Apply guards for `Object.create(null)` handling. See: // - https://github.com/FormidableLabs/react-fast-compare/issues/64 // - https://github.com/epoberezkin/fast-deep-equal/issues/49 if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === 'function' && typeof b.valueOf === 'function') return a.valueOf() === b.valueOf(); if (a.toString !== Object.prototype.toString && typeof a.toString === 'function' && typeof b.toString === 'function') return a.toString() === b.toString(); // END: Modifications keys = Object.keys(a); length = keys.length; if (length !== Object.keys(b).length) return false; for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; // END: fast-deep-equal // START: react-fast-compare // custom handling for DOM elements if (hasElementType && a instanceof Element) return false; // custom handling for React/Preact for (i = length; i-- !== 0;) { if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) { // React-specific: avoid traversing React elements' _owner // Preact-specific: avoid traversing Preact elements' __v and __o // __v = $_original / $_vnode // __o = $_owner // These properties contain circular references and are not needed when // comparing the actual elements (and not their owners) // .$$typeof and ._store on just reasonable markers of elements continue; } // all other properties should be traversed as usual if (!equal(a[keys[i]], b[keys[i]])) return false; } // END: react-fast-compare // START: fast-deep-equal return true; } return a !== a && b !== b; } // end fast-deep-equal module.exports = function isEqual(a, b) { try { return equal(a, b); } catch (error) { if (((error.message || '').match(/stack|recursion/i))) { // warn on circular references, don't crash // browsers give this different errors name and messages: // chrome/safari: "RangeError", "Maximum call stack size exceeded" // firefox: "InternalError", too much recursion" // edge: "Error", "Out of stack space" console.warn('react-fast-compare cannot handle circular refs'); return false; } // some other error. we should definitely know about these throw error; } }; /***/ }), /***/ 8357: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = format; var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; function toTitleCase(string) { return string.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function (match, index, title) { if (index > 0 && index + match.length !== title.length && match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" && (title.charAt(index + match.length) !== "-" || title.charAt(index - 1) === "-") && title.charAt(index - 1).search(/[^\s-]/) < 0) { return match.toLowerCase(); } if (match.substr(1).search(/[A-Z]|\../) > -1) { return match; } return match.charAt(0).toUpperCase() + match.substr(1); }); } // See if s could be an email address. We don't want to send personal data like email. // https://support.google.com/analytics/answer/2795983?hl=en function mightBeEmail(s) { // There's no point trying to validate rfc822 fully, just look for ...@... return typeof s === "string" && s.indexOf("@") !== -1; } var redacted = "REDACTED (Potential Email Address)"; function redactEmail(string) { if (mightBeEmail(string)) { console.warn("This arg looks like an email address, redacting."); return redacted; } return string; } function format() { var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; var titleCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var redactingEmail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var _str = s || ""; if (titleCase) { _str = toTitleCase(s); } if (redactingEmail) { _str = redactEmail(_str); } return _str; } /***/ }), /***/ 416: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = exports.GA4 = void 0; var _gtag = _interopRequireDefault(__webpack_require__(5529)); var _format = _interopRequireDefault(__webpack_require__(8357)); var _excluded = ["eventCategory", "eventAction", "eventLabel", "eventValue", "hitType"], _excluded2 = ["title", "location"], _excluded3 = ["page", "hitType"]; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* Links https://developers.google.com/gtagjs/reference/api https://developers.google.com/tag-platform/gtagjs/reference */ /** * @typedef GaOptions * @type {Object} * @property {boolean} [cookieUpdate=true] * @property {number} [cookieExpires=63072000] Default two years * @property {string} [cookieDomain="auto"] * @property {string} [cookieFlags] * @property {string} [userId] * @property {string} [clientId] * @property {boolean} [anonymizeIp] * @property {string} [contentGroup1] * @property {string} [contentGroup2] * @property {string} [contentGroup3] * @property {string} [contentGroup4] * @property {string} [contentGroup5] * @property {boolean} [allowAdFeatures=true] * @property {boolean} [allowAdPersonalizationSignals] * @property {boolean} [nonInteraction] * @property {string} [page] */ /** * @typedef UaEventOptions * @type {Object} * @property {string} action * @property {string} category * @property {string} [label] * @property {number} [value] * @property {boolean} [nonInteraction] * @property {('beacon'|'xhr'|'image')} [transport] */ /** * @typedef InitOptions * @type {Object} * @property {string} trackingId * @property {GaOptions|any} [gaOptions] * @property {Object} [gtagOptions] New parameter */ var GA4 = /*#__PURE__*/function () { function GA4() { var _this = this; _classCallCheck(this, GA4); _defineProperty(this, "reset", function () { _this.isInitialized = false; _this._testMode = false; _this._currentMeasurementId; _this._hasLoadedGA = false; _this._isQueuing = false; _this._queueGtag = []; }); _defineProperty(this, "_gtag", function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (!_this._testMode) { if (_this._isQueuing) { _this._queueGtag.push(args); } else { _gtag["default"].apply(void 0, args); } } else { _this._queueGtag.push(args); } }); _defineProperty(this, "_loadGA", function (GA_MEASUREMENT_ID, nonce) { var gtagUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "https://www.googletagmanager.com/gtag/js"; if (typeof window === "undefined" || typeof document === "undefined") { return; } if (!_this._hasLoadedGA) { // Global Site Tag (gtag.js) - Google Analytics var script = document.createElement("script"); script.async = true; script.src = "".concat(gtagUrl, "?id=").concat(GA_MEASUREMENT_ID); if (nonce) { script.setAttribute("nonce", nonce); } document.body.appendChild(script); window.dataLayer = window.dataLayer || []; window.gtag = function gtag() { window.dataLayer.push(arguments); }; _this._hasLoadedGA = true; } }); _defineProperty(this, "_toGtagOptions", function (gaOptions) { if (!gaOptions) { return; } var mapFields = { // Old https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#cookieUpdate // New https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id#cookie_update cookieUpdate: "cookie_update", cookieExpires: "cookie_expires", cookieDomain: "cookie_domain", cookieFlags: "cookie_flags", // must be in set method? userId: "user_id", clientId: "client_id", anonymizeIp: "anonymize_ip", // https://support.google.com/analytics/answer/2853546?hl=en#zippy=%2Cin-this-article contentGroup1: "content_group1", contentGroup2: "content_group2", contentGroup3: "content_group3", contentGroup4: "content_group4", contentGroup5: "content_group5", // https://support.google.com/analytics/answer/9050852?hl=en allowAdFeatures: "allow_google_signals", allowAdPersonalizationSignals: "allow_ad_personalization_signals", nonInteraction: "non_interaction", page: "page_path", hitCallback: "event_callback" }; var gtagOptions = Object.entries(gaOptions).reduce(function (prev, _ref) { var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; if (mapFields[key]) { prev[mapFields[key]] = value; } else { prev[key] = value; } return prev; }, {}); return gtagOptions; }); _defineProperty(this, "initialize", function (GA_MEASUREMENT_ID) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!GA_MEASUREMENT_ID) { throw new Error("Require GA_MEASUREMENT_ID"); } var initConfigs = typeof GA_MEASUREMENT_ID === "string" ? [{ trackingId: GA_MEASUREMENT_ID }] : GA_MEASUREMENT_ID; _this._currentMeasurementId = initConfigs[0].trackingId; var gaOptions = options.gaOptions, gtagOptions = options.gtagOptions, nonce = options.nonce, _options$testMode = options.testMode, testMode = _options$testMode === void 0 ? false : _options$testMode, gtagUrl = options.gtagUrl; _this._testMode = testMode; if (!testMode) { _this._loadGA(_this._currentMeasurementId, nonce, gtagUrl); } if (!_this.isInitialized) { _this._gtag("js", new Date()); initConfigs.forEach(function (config) { var mergedGtagOptions = _objectSpread(_objectSpread(_objectSpread({}, _this._toGtagOptions(_objectSpread(_objectSpread({}, gaOptions), config.gaOptions))), gtagOptions), config.gtagOptions); if (Object.keys(mergedGtagOptions).length) { _this._gtag("config", config.trackingId, mergedGtagOptions); } else { _this._gtag("config", config.trackingId); } }); } _this.isInitialized = true; if (!testMode) { var queues = _toConsumableArray(_this._queueGtag); _this._queueGtag = []; _this._isQueuing = false; while (queues.length) { var queue = queues.shift(); _this._gtag.apply(_this, _toConsumableArray(queue)); if (queue[0] === "get") { _this._isQueuing = true; } } } }); _defineProperty(this, "set", function (fieldsObject) { if (!fieldsObject) { console.warn("`fieldsObject` is required in .set()"); return; } if (_typeof(fieldsObject) !== "object") { console.warn("Expected `fieldsObject` arg to be an Object"); return; } if (Object.keys(fieldsObject).length === 0) { console.warn("empty `fieldsObject` given to .set()"); } _this._gaCommand("set", fieldsObject); }); _defineProperty(this, "_gaCommandSendEvent", function (eventCategory, eventAction, eventLabel, eventValue, fieldsObject) { _this._gtag("event", eventAction, _objectSpread(_objectSpread({ event_category: eventCategory, event_label: eventLabel, value: eventValue }, fieldsObject && { non_interaction: fieldsObject.nonInteraction }), _this._toGtagOptions(fieldsObject))); }); _defineProperty(this, "_gaCommandSendEventParameters", function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } if (typeof args[0] === "string") { _this._gaCommandSendEvent.apply(_this, _toConsumableArray(args.slice(1))); } else { var _args$ = args[0], eventCategory = _args$.eventCategory, eventAction = _args$.eventAction, eventLabel = _args$.eventLabel, eventValue = _args$.eventValue, hitType = _args$.hitType, rest = _objectWithoutProperties(_args$, _excluded); _this._gaCommandSendEvent(eventCategory, eventAction, eventLabel, eventValue, rest); } }); _defineProperty(this, "_gaCommandSendTiming", function (timingCategory, timingVar, timingValue, timingLabel) { _this._gtag("event", "timing_complete", { name: timingVar, value: timingValue, event_category: timingCategory, event_label: timingLabel }); }); _defineProperty(this, "_gaCommandSendPageview", function (page, fieldsObject) { if (fieldsObject && Object.keys(fieldsObject).length) { var _this$_toGtagOptions = _this._toGtagOptions(fieldsObject), title = _this$_toGtagOptions.title, location = _this$_toGtagOptions.location, rest = _objectWithoutProperties(_this$_toGtagOptions, _excluded2); _this._gtag("event", "page_view", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, page && { page_path: page }), title && { page_title: title }), location && { page_location: location }), rest)); } else if (page) { _this._gtag("event", "page_view", { page_path: page }); } else { _this._gtag("event", "page_view"); } }); _defineProperty(this, "_gaCommandSendPageviewParameters", function () { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } if (typeof args[0] === "string") { _this._gaCommandSendPageview.apply(_this, _toConsumableArray(args.slice(1))); } else { var _args$2 = args[0], page = _args$2.page, hitType = _args$2.hitType, rest = _objectWithoutProperties(_args$2, _excluded3); _this._gaCommandSendPageview(page, rest); } }); _defineProperty(this, "_gaCommandSend", function () { for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } var hitType = typeof args[0] === "string" ? args[0] : args[0].hitType; switch (hitType) { case "event": _this._gaCommandSendEventParameters.apply(_this, args); break; case "pageview": _this._gaCommandSendPageviewParameters.apply(_this, args); break; case "timing": _this._gaCommandSendTiming.apply(_this, _toConsumableArray(args.slice(1))); break; case "screenview": case "transaction": case "item": case "social": case "exception": console.warn("Unsupported send command: ".concat(hitType)); break; default: console.warn("Send command doesn't exist: ".concat(hitType)); } }); _defineProperty(this, "_gaCommandSet", function () { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } if (typeof args[0] === "string") { args[0] = _defineProperty({}, args[0], args[1]); } _this._gtag("set", _this._toGtagOptions(args[0])); }); _defineProperty(this, "_gaCommand", function (command) { for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { args[_key6 - 1] = arguments[_key6]; } switch (command) { case "send": _this._gaCommandSend.apply(_this, args); break; case "set": _this._gaCommandSet.apply(_this, args); break; default: console.warn("Command doesn't exist: ".concat(command)); } }); _defineProperty(this, "ga", function () { for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { args[_key7] = arguments[_key7]; } if (typeof args[0] === "string") { _this._gaCommand.apply(_this, args); } else { var readyCallback = args[0]; _this._gtag("get", _this._currentMeasurementId, "client_id", function (clientId) { _this._isQueuing = false; var queues = _this._queueGtag; readyCallback({ get: function get(property) { return property === "clientId" ? clientId : property === "trackingId" ? _this._currentMeasurementId : property === "apiVersion" ? "1" : undefined; } }); while (queues.length) { var queue = queues.shift(); _this._gtag.apply(_this, _toConsumableArray(queue)); } }); _this._isQueuing = true; } return _this.ga; }); _defineProperty(this, "event", function (optionsOrName, params) { if (typeof optionsOrName === "string") { _this._gtag("event", optionsOrName, _this._toGtagOptions(params)); } else { var action = optionsOrName.action, category = optionsOrName.category, label = optionsOrName.label, value = optionsOrName.value, nonInteraction = optionsOrName.nonInteraction, transport = optionsOrName.transport; if (!category || !action) { console.warn("args.category AND args.action are required in event()"); return; } // Required Fields var fieldObject = { hitType: "event", eventCategory: (0, _format["default"])(category), eventAction: (0, _format["default"])(action) }; // Optional Fields if (label) { fieldObject.eventLabel = (0, _format["default"])(label); } if (typeof value !== "undefined") { if (typeof value !== "number") { console.warn("Expected `args.value` arg to be a Number."); } else { fieldObject.eventValue = value; } } if (typeof nonInteraction !== "undefined") { if (typeof nonInteraction !== "boolean") { console.warn("`args.nonInteraction` must be a boolean."); } else { fieldObject.nonInteraction = nonInteraction; } } if (typeof transport !== "undefined") { if (typeof transport !== "string") { console.warn("`args.transport` must be a string."); } else { if (["beacon", "xhr", "image"].indexOf(transport) === -1) { console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"); } fieldObject.transport = transport; } } _this._gaCommand("send", fieldObject); } }); _defineProperty(this, "send", function (fieldObject) { _this._gaCommand("send", fieldObject); }); this.reset(); } _createClass(GA4, [{ key: "gtag", value: function gtag() { this._gtag.apply(this, arguments); } }]); return GA4; }(); exports.GA4 = GA4; var _default = new GA4(); exports["default"] = _default; /***/ }), /***/ 5529: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var gtag = function gtag() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (typeof window !== "undefined") { var _window; if (typeof window.gtag === "undefined") { window.dataLayer = window.dataLayer || []; window.gtag = function gtag() { window.dataLayer.push(arguments); }; } (_window = window).gtag.apply(_window, args); } }; var _default = gtag; exports["default"] = _default; /***/ }), /***/ 7088: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } __webpack_unused_export__ = ({ value: true }); exports.Ay = __webpack_unused_export__ = void 0; var _ga = _interopRequireWildcard(__webpack_require__(416)); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var ReactGAImplementation = _ga.GA4; __webpack_unused_export__ = ReactGAImplementation; var _default = _ga["default"]; exports.Ay = _default; /***/ }), /***/ 7604: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var _warn = __webpack_require__(8571); var _warn2 = _interopRequireDefault(_warn); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // https://developers.google.com/tag-manager/quickstart var Snippets = { tags: function tags(_ref) { var id = _ref.id, events = _ref.events, dataLayer = _ref.dataLayer, dataLayerName = _ref.dataLayerName, preview = _ref.preview, auth = _ref.auth; var gtm_auth = '>m_auth=' + auth; var gtm_preview = '>m_preview=' + preview; if (!id) (0, _warn2.default)('GTM Id is required'); var iframe = '\n '; var script = '\n (function(w,d,s,l,i){w[l]=w[l]||[];\n w[l].push({\'gtm.start\': new Date().getTime(),event:\'gtm.js\', ' + JSON.stringify(events).slice(1, -1) + '});\n var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!=\'dataLayer\'?\'&l=\'+l:\'\';\n j.async=true;j.src=\'https://www.googletagmanager.com/gtm.js?id=\'+i+dl+\'' + gtm_auth + gtm_preview + '>m_cookies_win=x\';\n f.parentNode.insertBefore(j,f);\n })(window,document,\'script\',\'' + dataLayerName + '\',\'' + id + '\');'; var dataLayerVar = this.dataLayer(dataLayer, dataLayerName); return { iframe: iframe, script: script, dataLayerVar: dataLayerVar }; }, dataLayer: function dataLayer(_dataLayer, dataLayerName) { return '\n window.' + dataLayerName + ' = window.' + dataLayerName + ' || [];\n window.' + dataLayerName + '.push(' + JSON.stringify(_dataLayer) + ')'; } }; module.exports = Snippets; /***/ }), /***/ 2706: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var _Snippets = __webpack_require__(7604); var _Snippets2 = _interopRequireDefault(_Snippets); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var TagManager = { dataScript: function dataScript(dataLayer) { var script = document.createElement('script'); script.innerHTML = dataLayer; return script; }, gtm: function gtm(args) { var snippets = _Snippets2.default.tags(args); var noScript = function noScript() { var noscript = document.createElement('noscript'); noscript.innerHTML = snippets.iframe; return noscript; }; var script = function script() { var script = document.createElement('script'); script.innerHTML = snippets.script; return script; }; var dataScript = this.dataScript(snippets.dataLayerVar); return { noScript: noScript, script: script, dataScript: dataScript }; }, initialize: function initialize(_ref) { var gtmId = _ref.gtmId, _ref$events = _ref.events, events = _ref$events === undefined ? {} : _ref$events, dataLayer = _ref.dataLayer, _ref$dataLayerName = _ref.dataLayerName, dataLayerName = _ref$dataLayerName === undefined ? 'dataLayer' : _ref$dataLayerName, _ref$auth = _ref.auth, auth = _ref$auth === undefined ? '' : _ref$auth, _ref$preview = _ref.preview, preview = _ref$preview === undefined ? '' : _ref$preview; var gtm = this.gtm({ id: gtmId, events: events, dataLayer: dataLayer || undefined, dataLayerName: dataLayerName, auth: auth, preview: preview }); if (dataLayer) document.head.appendChild(gtm.dataScript); document.head.insertBefore(gtm.script(), document.head.childNodes[0]); document.body.insertBefore(gtm.noScript(), document.body.childNodes[0]); }, dataLayer: function dataLayer(_ref2) { var _dataLayer = _ref2.dataLayer, _ref2$dataLayerName = _ref2.dataLayerName, dataLayerName = _ref2$dataLayerName === undefined ? 'dataLayer' : _ref2$dataLayerName; if (window[dataLayerName]) return window[dataLayerName].push(_dataLayer); var snippets = _Snippets2.default.dataLayer(_dataLayer, dataLayerName); var dataScript = this.dataScript(snippets); document.head.insertBefore(dataScript, document.head.childNodes[0]); } }; module.exports = TagManager; /***/ }), /***/ 2201: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var _TagManager = __webpack_require__(2706); var _TagManager2 = _interopRequireDefault(_TagManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = _TagManager2.default; /***/ }), /***/ 8571: /***/ (function(__unused_webpack_module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); var warn = function warn(s) { console.warn('[react-gtm]', s); }; exports["default"] = warn; /***/ }), /***/ 7775: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); var _reactFastCompare = _interopRequireDefault(__webpack_require__(8745)); var _props = __webpack_require__(2938); var _utils = __webpack_require__(3273); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var SEEK_ON_PLAY_EXPIRY = 5000; var Player = /*#__PURE__*/function (_Component) { _inherits(Player, _Component); var _super = _createSuper(Player); function Player() { var _this; _classCallCheck(this, Player); for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { _args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(_args)); _defineProperty(_assertThisInitialized(_this), "mounted", false); _defineProperty(_assertThisInitialized(_this), "isReady", false); _defineProperty(_assertThisInitialized(_this), "isPlaying", false); _defineProperty(_assertThisInitialized(_this), "isLoading", true); _defineProperty(_assertThisInitialized(_this), "loadOnReady", null); _defineProperty(_assertThisInitialized(_this), "startOnPlay", true); _defineProperty(_assertThisInitialized(_this), "seekOnPlay", null); _defineProperty(_assertThisInitialized(_this), "onDurationCalled", false); _defineProperty(_assertThisInitialized(_this), "handlePlayerMount", function (player) { if (_this.player) { _this.progress(); // Ensure onProgress is still called in strict mode return; // Return here to prevent loading twice in strict mode } _this.player = player; _this.player.load(_this.props.url); _this.progress(); }); _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function (key) { if (!_this.player) return null; return _this.player[key]; }); _defineProperty(_assertThisInitialized(_this), "progress", function () { if (_this.props.url && _this.player && _this.isReady) { var playedSeconds = _this.getCurrentTime() || 0; var loadedSeconds = _this.getSecondsLoaded(); var duration = _this.getDuration(); if (duration) { var progress = { playedSeconds: playedSeconds, played: playedSeconds / duration }; if (loadedSeconds !== null) { progress.loadedSeconds = loadedSeconds; progress.loaded = loadedSeconds / duration; } // Only call onProgress if values have changed if (progress.playedSeconds !== _this.prevPlayed || progress.loadedSeconds !== _this.prevLoaded) { _this.props.onProgress(progress); } _this.prevPlayed = progress.playedSeconds; _this.prevLoaded = progress.loadedSeconds; } } _this.progressTimeout = setTimeout(_this.progress, _this.props.progressFrequency || _this.props.progressInterval); }); _defineProperty(_assertThisInitialized(_this), "handleReady", function () { if (!_this.mounted) return; _this.isReady = true; _this.isLoading = false; var _this$props = _this.props, onReady = _this$props.onReady, playing = _this$props.playing, volume = _this$props.volume, muted = _this$props.muted; onReady(); if (!muted && volume !== null) { _this.player.setVolume(volume); } if (_this.loadOnReady) { _this.player.load(_this.loadOnReady, true); _this.loadOnReady = null; } else if (playing) { _this.player.play(); } _this.handleDurationCheck(); }); _defineProperty(_assertThisInitialized(_this), "handlePlay", function () { _this.isPlaying = true; _this.isLoading = false; var _this$props2 = _this.props, onStart = _this$props2.onStart, onPlay = _this$props2.onPlay, playbackRate = _this$props2.playbackRate; if (_this.startOnPlay) { if (_this.player.setPlaybackRate && playbackRate !== 1) { _this.player.setPlaybackRate(playbackRate); } onStart(); _this.startOnPlay = false; } onPlay(); if (_this.seekOnPlay) { _this.seekTo(_this.seekOnPlay); _this.seekOnPlay = null; } _this.handleDurationCheck(); }); _defineProperty(_assertThisInitialized(_this), "handlePause", function (e) { _this.isPlaying = false; if (!_this.isLoading) { _this.props.onPause(e); } }); _defineProperty(_assertThisInitialized(_this), "handleEnded", function () { var _this$props3 = _this.props, activePlayer = _this$props3.activePlayer, loop = _this$props3.loop, onEnded = _this$props3.onEnded; if (activePlayer.loopOnEnded && loop) { _this.seekTo(0); } if (!loop) { _this.isPlaying = false; onEnded(); } }); _defineProperty(_assertThisInitialized(_this), "handleError", function () { var _this$props4; _this.isLoading = false; (_this$props4 = _this.props).onError.apply(_this$props4, arguments); }); _defineProperty(_assertThisInitialized(_this), "handleDurationCheck", function () { clearTimeout(_this.durationCheckTimeout); var duration = _this.getDuration(); if (duration) { if (!_this.onDurationCalled) { _this.props.onDuration(duration); _this.onDurationCalled = true; } } else { _this.durationCheckTimeout = setTimeout(_this.handleDurationCheck, 100); } }); _defineProperty(_assertThisInitialized(_this), "handleLoaded", function () { // Sometimes we know loading has stopped but onReady/onPlay are never called // so this provides a way for players to avoid getting stuck _this.isLoading = false; }); return _this; } _createClass(Player, [{ key: "componentDidMount", value: function componentDidMount() { this.mounted = true; } }, { key: "componentWillUnmount", value: function componentWillUnmount() { clearTimeout(this.progressTimeout); clearTimeout(this.durationCheckTimeout); if (this.isReady && this.props.stopOnUnmount) { this.player.stop(); if (this.player.disablePIP) { this.player.disablePIP(); } } this.mounted = false; } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this2 = this; // If there isn’t a player available, don’t do anything if (!this.player) { return; } // Invoke player methods based on changed props var _this$props5 = this.props, url = _this$props5.url, playing = _this$props5.playing, volume = _this$props5.volume, muted = _this$props5.muted, playbackRate = _this$props5.playbackRate, pip = _this$props5.pip, loop = _this$props5.loop, activePlayer = _this$props5.activePlayer, disableDeferredLoading = _this$props5.disableDeferredLoading; if (!(0, _reactFastCompare["default"])(prevProps.url, url)) { if (this.isLoading && !activePlayer.forceLoad && !disableDeferredLoading && !(0, _utils.isMediaStream)(url)) { console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded")); this.loadOnReady = url; return; } this.isLoading = true; this.startOnPlay = true; this.onDurationCalled = false; this.player.load(url, this.isReady); } if (!prevProps.playing && playing && !this.isPlaying) { this.player.play(); } if (prevProps.playing && !playing && this.isPlaying) { this.player.pause(); } if (!prevProps.pip && pip && this.player.enablePIP) { this.player.enablePIP(); } if (prevProps.pip && !pip && this.player.disablePIP) { this.player.disablePIP(); } if (prevProps.volume !== volume && volume !== null) { this.player.setVolume(volume); } if (prevProps.muted !== muted) { if (muted) { this.player.mute(); } else { this.player.unmute(); if (volume !== null) { // Set volume next tick to fix a bug with DailyMotion setTimeout(function () { return _this2.player.setVolume(volume); }); } } } if (prevProps.playbackRate !== playbackRate && this.player.setPlaybackRate) { this.player.setPlaybackRate(playbackRate); } if (prevProps.loop !== loop && this.player.setLoop) { this.player.setLoop(loop); } } }, { key: "getDuration", value: function getDuration() { if (!this.isReady) return null; return this.player.getDuration(); } }, { key: "getCurrentTime", value: function getCurrentTime() { if (!this.isReady) return null; return this.player.getCurrentTime(); } }, { key: "getSecondsLoaded", value: function getSecondsLoaded() { if (!this.isReady) return null; return this.player.getSecondsLoaded(); } }, { key: "seekTo", value: function seekTo(amount, type, keepPlaying) { var _this3 = this; // When seeking before player is ready, store value and seek later if (!this.isReady) { if (amount !== 0) { this.seekOnPlay = amount; setTimeout(function () { _this3.seekOnPlay = null; }, SEEK_ON_PLAY_EXPIRY); } return; } var isFraction = !type ? amount > 0 && amount < 1 : type === 'fraction'; if (isFraction) { // Convert fraction to seconds based on duration var duration = this.player.getDuration(); if (!duration) { console.warn('ReactPlayer: could not seek using fraction – duration not yet available'); return; } this.player.seekTo(duration * amount, keepPlaying); return; } this.player.seekTo(amount, keepPlaying); } }, { key: "render", value: function render() { var Player = this.props.activePlayer; if (!Player) { return null; } return /*#__PURE__*/_react["default"].createElement(Player, _extends({}, this.props, { onMount: this.handlePlayerMount, onReady: this.handleReady, onPlay: this.handlePlay, onPause: this.handlePause, onEnded: this.handleEnded, onLoaded: this.handleLoaded, onError: this.handleError })); } }]); return Player; }(_react.Component); exports["default"] = Player; _defineProperty(Player, "displayName", 'Player'); _defineProperty(Player, "propTypes", _props.propTypes); _defineProperty(Player, "defaultProps", _props.defaultProps); /***/ }), /***/ 6476: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var ICON_SIZE = '64px'; var cache = {}; var Preview = /*#__PURE__*/function (_Component) { _inherits(Preview, _Component); var _super = _createSuper(Preview); function Preview() { var _this; _classCallCheck(this, Preview); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "mounted", false); _defineProperty(_assertThisInitialized(_this), "state", { image: null }); _defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (e) { if (e.key === 'Enter' || e.key === ' ') { _this.props.onClick(); } }); return _this; } _createClass(Preview, [{ key: "componentDidMount", value: function componentDidMount() { this.mounted = true; this.fetchImage(this.props); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this$props = this.props, url = _this$props.url, light = _this$props.light; if (prevProps.url !== url || prevProps.light !== light) { this.fetchImage(this.props); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.mounted = false; } }, { key: "fetchImage", value: function fetchImage(_ref) { var _this2 = this; var url = _ref.url, light = _ref.light, oEmbedUrl = _ref.oEmbedUrl; if ( /*#__PURE__*/_react["default"].isValidElement(light)) { return; } if (typeof light === 'string') { this.setState({ image: light }); return; } if (cache[url]) { this.setState({ image: cache[url] }); return; } this.setState({ image: null }); return window.fetch(oEmbedUrl.replace('{url}', url)).then(function (response) { return response.json(); }).then(function (data) { if (data.thumbnail_url && _this2.mounted) { var image = data.thumbnail_url.replace('height=100', 'height=480').replace('-d_295x166', '-d_640'); _this2.setState({ image: image }); cache[url] = image; } }); } }, { key: "render", value: function render() { var _this$props2 = this.props, light = _this$props2.light, onClick = _this$props2.onClick, playIcon = _this$props2.playIcon, previewTabIndex = _this$props2.previewTabIndex; var image = this.state.image; var isElement = /*#__PURE__*/_react["default"].isValidElement(light); var flexCenter = { display: 'flex', alignItems: 'center', justifyContent: 'center' }; var styles = { preview: _objectSpread({ width: '100%', height: '100%', backgroundImage: image && !isElement ? "url(".concat(image, ")") : undefined, backgroundSize: 'cover', backgroundPosition: 'center', cursor: 'pointer' }, flexCenter), shadow: _objectSpread({ background: 'radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)', borderRadius: ICON_SIZE, width: ICON_SIZE, height: ICON_SIZE, position: isElement ? 'absolute' : undefined }, flexCenter), playIcon: { borderStyle: 'solid', borderWidth: '16px 0 16px 26px', borderColor: 'transparent transparent transparent white', marginLeft: '7px' } }; var defaultPlayIcon = /*#__PURE__*/_react["default"].createElement("div", { style: styles.shadow, className: "react-player__shadow" }, /*#__PURE__*/_react["default"].createElement("div", { style: styles.playIcon, className: "react-player__play-icon" })); return /*#__PURE__*/_react["default"].createElement("div", { style: styles.preview, className: "react-player__preview", onClick: onClick, tabIndex: previewTabIndex, onKeyPress: this.handleKeyPress }, isElement ? light : null, playIcon || defaultPlayIcon); } }]); return Preview; }(_react.Component); exports["default"] = Preview; /***/ }), /***/ 6770: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createReactPlayer = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); var _deepmerge = _interopRequireDefault(__webpack_require__(3938)); var _memoizeOne = _interopRequireDefault(__webpack_require__(3097)); var _reactFastCompare = _interopRequireDefault(__webpack_require__(8745)); var _props = __webpack_require__(2938); var _utils = __webpack_require__(3273); var _Player3 = _interopRequireDefault(__webpack_require__(7775)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var Preview = /*#__PURE__*/(0, _react.lazy)(function () { return Promise.resolve().then(function () { return _interopRequireWildcard(__webpack_require__(6476)); }); }); var IS_BROWSER = typeof window !== 'undefined' && window.document; var IS_GLOBAL = typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.window && __webpack_require__.g.window.document; var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server // as Suspense is not supported yet var UniversalSuspense = IS_BROWSER || IS_GLOBAL ? _react.Suspense : function () { return null; }; var customPlayers = []; var createReactPlayer = function createReactPlayer(players, fallback) { var _class, _temp; return _temp = _class = /*#__PURE__*/function (_Component) { _inherits(ReactPlayer, _Component); var _super = _createSuper(ReactPlayer); function ReactPlayer() { var _this; _classCallCheck(this, ReactPlayer); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "state", { showPreview: !!_this.props.light }); _defineProperty(_assertThisInitialized(_this), "references", { wrapper: function wrapper(_wrapper) { _this.wrapper = _wrapper; }, player: function player(_player) { _this.player = _player; } }); _defineProperty(_assertThisInitialized(_this), "handleClickPreview", function (e) { _this.setState({ showPreview: false }); _this.props.onClickPreview(e); }); _defineProperty(_assertThisInitialized(_this), "showPreview", function () { _this.setState({ showPreview: true }); }); _defineProperty(_assertThisInitialized(_this), "getDuration", function () { if (!_this.player) return null; return _this.player.getDuration(); }); _defineProperty(_assertThisInitialized(_this), "getCurrentTime", function () { if (!_this.player) return null; return _this.player.getCurrentTime(); }); _defineProperty(_assertThisInitialized(_this), "getSecondsLoaded", function () { if (!_this.player) return null; return _this.player.getSecondsLoaded(); }); _defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function () { var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'player'; if (!_this.player) return null; return _this.player.getInternalPlayer(key); }); _defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type, keepPlaying) { if (!_this.player) return null; _this.player.seekTo(fraction, type, keepPlaying); }); _defineProperty(_assertThisInitialized(_this), "handleReady", function () { _this.props.onReady(_assertThisInitialized(_this)); }); _defineProperty(_assertThisInitialized(_this), "getActivePlayer", (0, _memoizeOne["default"])(function (url) { for (var _i = 0, _arr = [].concat(customPlayers, _toConsumableArray(players)); _i < _arr.length; _i++) { var player = _arr[_i]; if (player.canPlay(url)) { return player; } } if (fallback) { return fallback; } return null; })); _defineProperty(_assertThisInitialized(_this), "getConfig", (0, _memoizeOne["default"])(function (url, key) { var config = _this.props.config; return _deepmerge["default"].all([_props.defaultProps.config, _props.defaultProps.config[key] || {}, config, config[key] || {}]); })); _defineProperty(_assertThisInitialized(_this), "getAttributes", (0, _memoizeOne["default"])(function (url) { return (0, _utils.omit)(_this.props, SUPPORTED_PROPS); })); _defineProperty(_assertThisInitialized(_this), "renderActivePlayer", function (url) { if (!url) return null; var player = _this.getActivePlayer(url); if (!player) return null; var config = _this.getConfig(url, player.key); return /*#__PURE__*/_react["default"].createElement(_Player3["default"], _extends({}, _this.props, { key: player.key, ref: _this.references.player, config: config, activePlayer: player.lazyPlayer || player, onReady: _this.handleReady })); }); return _this; } _createClass(ReactPlayer, [{ key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps, nextState) { return !(0, _reactFastCompare["default"])(this.props, nextProps) || !(0, _reactFastCompare["default"])(this.state, nextState); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var light = this.props.light; if (!prevProps.light && light) { this.setState({ showPreview: true }); } if (prevProps.light && !light) { this.setState({ showPreview: false }); } } }, { key: "renderPreview", value: function renderPreview(url) { if (!url) return null; var _this$props = this.props, light = _this$props.light, playIcon = _this$props.playIcon, previewTabIndex = _this$props.previewTabIndex, oEmbedUrl = _this$props.oEmbedUrl; return /*#__PURE__*/_react["default"].createElement(Preview, { url: url, light: light, playIcon: playIcon, previewTabIndex: previewTabIndex, oEmbedUrl: oEmbedUrl, onClick: this.handleClickPreview }); } }, { key: "render", value: function render() { var _this$props2 = this.props, url = _this$props2.url, style = _this$props2.style, width = _this$props2.width, height = _this$props2.height, fallback = _this$props2.fallback, Wrapper = _this$props2.wrapper; var showPreview = this.state.showPreview; var attributes = this.getAttributes(url); var wrapperRef = typeof Wrapper === 'string' ? this.references.wrapper : undefined; return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({ ref: wrapperRef, style: _objectSpread(_objectSpread({}, style), {}, { width: width, height: height }) }, attributes), /*#__PURE__*/_react["default"].createElement(UniversalSuspense, { fallback: fallback }, showPreview ? this.renderPreview(url) : this.renderActivePlayer(url))); } }]); return ReactPlayer; }(_react.Component), _defineProperty(_class, "displayName", 'ReactPlayer'), _defineProperty(_class, "propTypes", _props.propTypes), _defineProperty(_class, "defaultProps", _props.defaultProps), _defineProperty(_class, "addCustomPlayer", function (player) { customPlayers.push(player); }), _defineProperty(_class, "removeCustomPlayers", function () { customPlayers.length = 0; }), _defineProperty(_class, "canPlay", function (url) { for (var _i2 = 0, _arr2 = [].concat(customPlayers, _toConsumableArray(players)); _i2 < _arr2.length; _i2++) { var _Player = _arr2[_i2]; if (_Player.canPlay(url)) { return true; } } return false; }), _defineProperty(_class, "canEnablePIP", function (url) { for (var _i3 = 0, _arr3 = [].concat(customPlayers, _toConsumableArray(players)); _i3 < _arr3.length; _i3++) { var _Player2 = _arr3[_i3]; if (_Player2.canEnablePIP && _Player2.canEnablePIP(url)) { return true; } } return false; }), _temp; }; exports.createReactPlayer = createReactPlayer; /***/ }), /***/ 6880: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); exports.A = void 0; var _players = _interopRequireDefault(__webpack_require__(8105)); var _ReactPlayer = __webpack_require__(6770); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // Fall back to FilePlayer if nothing else can play the URL var fallback = _players["default"][_players["default"].length - 1]; var _default = (0, _ReactPlayer.createReactPlayer)(_players["default"], fallback); exports.A = _default; /***/ }), /***/ 9257: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.canPlay = exports.FLV_EXTENSIONS = exports.DASH_EXTENSIONS = exports.HLS_EXTENSIONS = exports.VIDEO_EXTENSIONS = exports.AUDIO_EXTENSIONS = exports.MATCH_URL_KALTURA = exports.MATCH_URL_VIDYARD = exports.MATCH_URL_MIXCLOUD = exports.MATCH_URL_DAILYMOTION = exports.MATCH_URL_TWITCH_CHANNEL = exports.MATCH_URL_TWITCH_VIDEO = exports.MATCH_URL_WISTIA = exports.MATCH_URL_STREAMABLE = exports.MATCH_URL_FACEBOOK_WATCH = exports.MATCH_URL_FACEBOOK = exports.MATCH_URL_VIMEO = exports.MATCH_URL_SOUNDCLOUD = exports.MATCH_URL_YOUTUBE = void 0; var _utils = __webpack_require__(3273); function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//; exports.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE; var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/; exports.MATCH_URL_SOUNDCLOUD = MATCH_URL_SOUNDCLOUD; var MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/; exports.MATCH_URL_VIMEO = MATCH_URL_VIMEO; var MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/; exports.MATCH_URL_FACEBOOK = MATCH_URL_FACEBOOK; var MATCH_URL_FACEBOOK_WATCH = /^https?:\/\/fb\.watch\/.+$/; exports.MATCH_URL_FACEBOOK_WATCH = MATCH_URL_FACEBOOK_WATCH; var MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/; exports.MATCH_URL_STREAMABLE = MATCH_URL_STREAMABLE; var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/; exports.MATCH_URL_WISTIA = MATCH_URL_WISTIA; var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/; exports.MATCH_URL_TWITCH_VIDEO = MATCH_URL_TWITCH_VIDEO; var MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/; exports.MATCH_URL_TWITCH_CHANNEL = MATCH_URL_TWITCH_CHANNEL; var MATCH_URL_DAILYMOTION = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/; exports.MATCH_URL_DAILYMOTION = MATCH_URL_DAILYMOTION; var MATCH_URL_MIXCLOUD = /mixcloud\.com\/([^/]+\/[^/]+)/; exports.MATCH_URL_MIXCLOUD = MATCH_URL_MIXCLOUD; var MATCH_URL_VIDYARD = /vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/; exports.MATCH_URL_VIDYARD = MATCH_URL_VIDYARD; var MATCH_URL_KALTURA = /^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/; exports.MATCH_URL_KALTURA = MATCH_URL_KALTURA; var AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i; exports.AUDIO_EXTENSIONS = AUDIO_EXTENSIONS; var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i; exports.VIDEO_EXTENSIONS = VIDEO_EXTENSIONS; var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i; exports.HLS_EXTENSIONS = HLS_EXTENSIONS; var DASH_EXTENSIONS = /\.(mpd)($|\?)/i; exports.DASH_EXTENSIONS = DASH_EXTENSIONS; var FLV_EXTENSIONS = /\.(flv)($|\?)/i; exports.FLV_EXTENSIONS = FLV_EXTENSIONS; var canPlayFile = function canPlayFile(url) { if (url instanceof Array) { var _iterator = _createForOfIteratorHelper(url), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var item = _step.value; if (typeof item === 'string' && canPlayFile(item)) { return true; } if (canPlayFile(item.src)) { return true; } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return false; } if ((0, _utils.isMediaStream)(url) || (0, _utils.isBlobUrl)(url)) { return true; } return AUDIO_EXTENSIONS.test(url) || VIDEO_EXTENSIONS.test(url) || HLS_EXTENSIONS.test(url) || DASH_EXTENSIONS.test(url) || FLV_EXTENSIONS.test(url); }; var canPlay = { youtube: function youtube(url) { if (url instanceof Array) { return url.every(function (item) { return MATCH_URL_YOUTUBE.test(item); }); } return MATCH_URL_YOUTUBE.test(url); }, soundcloud: function soundcloud(url) { return MATCH_URL_SOUNDCLOUD.test(url) && !AUDIO_EXTENSIONS.test(url); }, vimeo: function vimeo(url) { return MATCH_URL_VIMEO.test(url) && !VIDEO_EXTENSIONS.test(url) && !HLS_EXTENSIONS.test(url); }, facebook: function facebook(url) { return MATCH_URL_FACEBOOK.test(url) || MATCH_URL_FACEBOOK_WATCH.test(url); }, streamable: function streamable(url) { return MATCH_URL_STREAMABLE.test(url); }, wistia: function wistia(url) { return MATCH_URL_WISTIA.test(url); }, twitch: function twitch(url) { return MATCH_URL_TWITCH_VIDEO.test(url) || MATCH_URL_TWITCH_CHANNEL.test(url); }, dailymotion: function dailymotion(url) { return MATCH_URL_DAILYMOTION.test(url); }, mixcloud: function mixcloud(url) { return MATCH_URL_MIXCLOUD.test(url); }, vidyard: function vidyard(url) { return MATCH_URL_VIDYARD.test(url); }, kaltura: function kaltura(url) { return MATCH_URL_KALTURA.test(url); }, file: canPlayFile }; exports.canPlay = canPlay; /***/ }), /***/ 8630: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); var _utils = __webpack_require__(3273); var _patterns = __webpack_require__(9257); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var SDK_URL = 'https://api.dmcdn.net/all.js'; var SDK_GLOBAL = 'DM'; var SDK_GLOBAL_READY = 'dmAsyncInit'; var DailyMotion = /*#__PURE__*/function (_Component) { _inherits(DailyMotion, _Component); var _super = _createSuper(DailyMotion); function DailyMotion() { var _this; _classCallCheck(this, DailyMotion); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); _defineProperty(_assertThisInitialized(_this), "onDurationChange", function () { var duration = _this.getDuration(); _this.props.onDuration(duration); }); _defineProperty(_assertThisInitialized(_this), "mute", function () { _this.callPlayer('setMuted', true); }); _defineProperty(_assertThisInitialized(_this), "unmute", function () { _this.callPlayer('setMuted', false); }); _defineProperty(_assertThisInitialized(_this), "ref", function (container) { _this.container = container; }); return _this; } _createClass(DailyMotion, [{ key: "componentDidMount", value: function componentDidMount() { this.props.onMount && this.props.onMount(this); } }, { key: "load", value: function load(url) { var _this2 = this; var _this$props = this.props, controls = _this$props.controls, config = _this$props.config, onError = _this$props.onError, playing = _this$props.playing; var _url$match = url.match(_patterns.MATCH_URL_DAILYMOTION), _url$match2 = _slicedToArray(_url$match, 2), id = _url$match2[1]; if (this.player) { this.player.load(id, { start: (0, _utils.parseStartTime)(url), autoplay: playing }); return; } (0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (DM) { return DM.player; }).then(function (DM) { if (!_this2.container) return; var Player = DM.player; _this2.player = new Player(_this2.container, { width: '100%', height: '100%', video: id, params: _objectSpread({ controls: controls, autoplay: _this2.props.playing, mute: _this2.props.muted, start: (0, _utils.parseStartTime)(url), origin: window.location.origin }, config.params), events: { apiready: _this2.props.onReady, seeked: function seeked() { return _this2.props.onSeek(_this2.player.currentTime); }, video_end: _this2.props.onEnded, durationchange: _this2.onDurationChange, pause: _this2.props.onPause, playing: _this2.props.onPlay, waiting: _this2.props.onBuffer, error: function error(event) { return onError(event); } } }); }, onError); } }, { key: "play", value: function play() { this.callPlayer('play'); } }, { key: "pause", value: function pause() { this.callPlayer('pause'); } }, { key: "stop", value: function stop() {// Nothing to do } }, { key: "seekTo", value: function seekTo(seconds) { var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; this.callPlayer('seek', seconds); if (!keepPlaying) { this.pause(); } } }, { key: "setVolume", value: function setVolume(fraction) { this.callPlayer('setVolume', fraction); } }, { key: "getDuration", value: function getDuration() { return this.player.duration || null; } }, { key: "getCurrentTime", value: function getCurrentTime() { return this.player.currentTime; } }, { key: "getSecondsLoaded", value: function getSecondsLoaded() { return this.player.bufferedTime; } }, { key: "render", value: function render() { var display = this.props.display; var style = { width: '100%', height: '100%', display: display }; return /*#__PURE__*/_react["default"].createElement("div", { style: style }, /*#__PURE__*/_react["default"].createElement("div", { ref: this.ref })); } }]); return DailyMotion; }(_react.Component); exports["default"] = DailyMotion; _defineProperty(DailyMotion, "displayName", 'DailyMotion'); _defineProperty(DailyMotion, "canPlay", _patterns.canPlay.dailymotion); _defineProperty(DailyMotion, "loopOnEnded", true); /***/ }), /***/ 1481: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); var _utils = __webpack_require__(3273); var _patterns = __webpack_require__(9257); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var SDK_URL = 'https://connect.facebook.net/en_US/sdk.js'; var SDK_GLOBAL = 'FB'; var SDK_GLOBAL_READY = 'fbAsyncInit'; var PLAYER_ID_PREFIX = 'facebook-player-'; var Facebook = /*#__PURE__*/function (_Component) { _inherits(Facebook, _Component); var _super = _createSuper(Facebook); function Facebook() { var _this; _classCallCheck(this, Facebook); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); _defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat((0, _utils.randomString)())); _defineProperty(_assertThisInitialized(_this), "mute", function () { _this.callPlayer('mute'); }); _defineProperty(_assertThisInitialized(_this), "unmute", function () { _this.callPlayer('unmute'); }); return _this; } _createClass(Facebook, [{ key: "componentDidMount", value: function componentDidMount() { this.props.onMount && this.props.onMount(this); } }, { key: "load", value: function load(url, isReady) { var _this2 = this; if (isReady) { (0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { return FB.XFBML.parse(); }); return; } (0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { FB.init({ appId: _this2.props.config.appId, xfbml: true, version: _this2.props.config.version }); FB.Event.subscribe('xfbml.render', function (msg) { // Here we know the SDK has loaded, even if onReady/onPlay // is not called due to a video that cannot be embedded _this2.props.onLoaded(); }); FB.Event.subscribe('xfbml.ready', function (msg) { if (msg.type === 'video' && msg.id === _this2.playerID) { _this2.player = msg.instance; _this2.player.subscribe('startedPlaying', _this2.props.onPlay); _this2.player.subscribe('paused', _this2.props.onPause); _this2.player.subscribe('finishedPlaying', _this2.props.onEnded); _this2.player.subscribe('startedBuffering', _this2.props.onBuffer); _this2.player.subscribe('finishedBuffering', _this2.props.onBufferEnd); _this2.player.subscribe('error', _this2.props.onError); if (_this2.props.muted) { _this2.callPlayer('mute'); } else { _this2.callPlayer('unmute'); } _this2.props.onReady(); // For some reason Facebook have added `visibility: hidden` // to the iframe when autoplay fails, so here we set it back document.getElementById(_this2.playerID).querySelector('iframe').style.visibility = 'visible'; } }); }); } }, { key: "play", value: function play() { this.callPlayer('play'); } }, { key: "pause", value: function pause() { this.callPlayer('pause'); } }, { key: "stop", value: function stop() {// Nothing to do } }, { key: "seekTo", value: function seekTo(seconds) { var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; this.callPlayer('seek', seconds); if (!keepPlaying) { this.pause(); } } }, { key: "setVolume", value: function setVolume(fraction) { this.callPlayer('setVolume', fraction); } }, { key: "getDuration", value: function getDuration() { return this.callPlayer('getDuration'); } }, { key: "getCurrentTime", value: function getCurrentTime() { return this.callPlayer('getCurrentPosition'); } }, { key: "getSecondsLoaded", value: function getSecondsLoaded() { return null; } }, { key: "render", value: function render() { var attributes = this.props.config.attributes; var style = { width: '100%', height: '100%' }; return /*#__PURE__*/_react["default"].createElement("div", _extends({ style: style, id: this.playerID, className: "fb-video", "data-href": this.props.url, "data-autoplay": this.props.playing ? 'true' : 'false', "data-allowfullscreen": "true", "data-controls": this.props.controls ? 'true' : 'false' }, attributes)); } }]); return Facebook; }(_react.Component); exports["default"] = Facebook; _defineProperty(Facebook, "displayName", 'Facebook'); _defineProperty(Facebook, "canPlay", _patterns.canPlay.facebook); _defineProperty(Facebook, "loopOnEnded", true); /***/ }), /***/ 4466: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _react = _interopRequireWildcard(__webpack_require__(6540)); var _utils = __webpack_require__(3273); var _patterns = __webpack_require__(9257); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var HAS_NAVIGATOR = typeof navigator !== 'undefined'; var IS_IPAD_PRO = HAS_NAVIGATOR && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; var IS_IOS = HAS_NAVIGATOR && (/iPad|iPhone|iPod/.test(navigator.userAgent) || IS_IPAD_PRO) && !window.MSStream; var IS_SAFARI = HAS_NAVIGATOR && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !window.MSStream; var HLS_SDK_URL = 'https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js'; var HLS_GLOBAL = 'Hls'; var DASH_SDK_URL = 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js'; var DASH_GLOBAL = 'dashjs'; var FLV_SDK_URL = 'https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js'; var FLV_GLOBAL = 'flvjs'; var MATCH_DROPBOX_URL = /www\.dropbox\.com\/.+/; var MATCH_CLOUDFLARE_STREAM = /https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/; var REPLACE_CLOUDFLARE_STREAM = 'https://videodelivery.net/{id}/manifest/video.m3u8'; var FilePlayer = /*#__PURE__*/function (_Component) { _inherits(FilePlayer, _Component); var _super = _createSuper(FilePlayer); function FilePlayer() { var _this; _classCallCheck(this, FilePlayer); for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { _args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(_args)); _defineProperty(_assertThisInitialized(_this), "onReady", function () { var _this$props; return (_this$props = _this.props).onReady.apply(_this$props, arguments); }); _defineProperty(_assertThisInitialized(_this), "onPlay", function () { var _this$props2; return (_this$props2 = _this.props).onPlay.apply(_this$props2, arguments); }); _defineProperty(_assertThisInitialized(_this), "onBuffer", function () { var _this$props3; return (_this$props3 = _this.props).onBuffer.apply(_this$props3, arguments); }); _defineProperty(_assertThisInitialized(_this), "onBufferEnd", function () { var _this$props4; return (_this$props4 = _this.props).onBufferEnd.apply(_this$props4, arguments); }); _defineProperty(_assertThisInitialized(_this), "onPause", function () { var _this$props5; return (_this$props5 = _this.props).onPause.apply(_this$props5, arguments); }); _defineProperty(_assertThisInitialized(_this), "onEnded", function () { var _this$props6; return (_this$props6 = _this.props).onEnded.apply(_this$props6, arguments); }); _defineProperty(_assertThisInitialized(_this), "onError", function () { var _this$props7; return (_this$props7 = _this.props).onError.apply(_this$props7, arguments); }); _defineProperty(_assertThisInitialized(_this), "onPlayBackRateChange", function (event) { return _this.props.onPlaybackRateChange(event.target.playbackRate); }); _defineProperty(_assertThisInitialized(_this), "onEnablePIP", function () { var _this$props8; return (_this$props8 = _this.props).onEnablePIP.apply(_this$props8, arguments); }); _defineProperty(_assertThisInitialized(_this), "onDisablePIP", function (e) { var _this$props9 = _this.props, onDisablePIP = _this$props9.onDisablePIP, playing = _this$props9.playing; onDisablePIP(e); if (playing) { _this.play(); } }); _defineProperty(_assertThisInitialized(_this), "onPresentationModeChange", function (e) { if (_this.player && (0, _utils.supportsWebKitPresentationMode)(_this.player)) { var webkitPresentationMode = _this.player.webkitPresentationMode; if (webkitPresentationMode === 'picture-in-picture') { _this.onEnablePIP(e); } else if (webkitPresentationMode === 'inline') { _this.onDisablePIP(e); } } }); _defineProperty(_assertThisInitialized(_this), "onSeek", function (e) { _this.props.onSeek(e.target.currentTime); }); _defineProperty(_assertThisInitialized(_this), "mute", function () { _this.player.muted = true; }); _defineProperty(_assertThisInitialized(_this), "unmute", function () { _this.player.muted = false; }); _defineProperty(_assertThisInitialized(_this), "renderSourceElement", function (source, index) { if (typeof source === 'string') { return /*#__PURE__*/_react["default"].createElement("source", { key: index, src: source }); } return /*#__PURE__*/_react["default"].createElement("source", _extends({ key: index }, source)); }); _defineProperty(_assertThisInitialized(_this), "renderTrack", function (track, index) { return /*#__PURE__*/_react["default"].createElement("track", _extends({ key: index }, track)); }); _defineProperty(_assertThisInitialized(_this), "ref", function (player) { if (_this.player) { // Store previous player to be used by removeListeners() _this.prevPlayer = _this.player; } _this.player = player; }); return _this; } _createClass(FilePlayer, [{ key: "componentDidMount", value: function componentDidMount() { this.props.onMount && this.props.onMount(this); this.addListeners(this.player); var src = this.getSource(this.props.url); // Ensure src is set in strict mode if (src) { this.player.src = src; } if (IS_IOS || this.props.config.forceDisableHls) { this.player.load(); } } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) { this.removeListeners(this.prevPlayer, prevProps.url); this.addListeners(this.player); } if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array) // Avoid infinite loop ) { this.player.srcObject = null; } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.player.removeAttribute('src'); this.removeListeners(this.player); if (this.hls) { this.hls.destroy(); } } }, { key: "addListeners", value: function addListeners(player) { var _this$props10 = this.props, url = _this$props10.url, playsinline = _this$props10.playsinline; player.addEventListener('play', this.onPlay); player.addEventListener('waiting', this.onBuffer); player.addEventListener('playing', this.onBufferEnd); player.addEventListener('pause', this.onPause); player.addEventListener('seeked', this.onSeek); player.addEventListener('ended', this.onEnded); player.addEventListener('error', this.onError); player.addEventListener('ratechange', this.onPlayBackRateChange); player.addEventListener('enterpictureinpicture', this.onEnablePIP); player.addEventListener('leavepictureinpicture', this.onDisablePIP); player.addEventListener('webkitpresentationmodechanged', this.onPresentationModeChange); if (!this.shouldUseHLS(url)) { // onReady is handled by hls.js player.addEventListener('canplay', this.onReady); } if (playsinline) { player.setAttribute('playsinline', ''); player.setAttribute('webkit-playsinline', ''); player.setAttribute('x5-playsinline', ''); } } }, { key: "removeListeners", value: function removeListeners(player, url) { player.removeEventListener('canplay', this.onReady); player.removeEventListener('play', this.onPlay); player.removeEventListener('waiting', this.onBuffer); player.removeEventListener('playing', this.onBufferEnd); player.removeEventListener('pause', this.onPause); player.removeEventListener('seeked', this.onSeek); player.removeEventListener('ended', this.onEnded); player.removeEventListener('error', this.onError); player.removeEventListener('ratechange', this.onPlayBackRateChange); player.removeEventListener('enterpictureinpicture', this.onEnablePIP); player.removeEventListener('leavepictureinpicture', this.onDisablePIP); player.removeEventListener('webkitpresentationmodechanged', this.onPresentationModeChange); if (!this.shouldUseHLS(url)) { // onReady is handled by hls.js player.removeEventListener('canplay', this.onReady); } } // Proxy methods to prevent listener leaks }, { key: "shouldUseAudio", value: function shouldUseAudio(props) { if (props.config.forceVideo) { return false; } if (props.config.attributes.poster) { return false; // Use