(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags"), require("devtools/client/shared/vendor/react-dom"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-redux"), require("devtools/client/shared/vendor/redux"), require("devtools/client/shared/vendor/immutable"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis")); else if(typeof define === 'function' && define.amd) define(["devtools/client/shared/vendor/react-prop-types", "devtools/client/shared/vendor/react-dom-factories", "devtools/client/shared/vendor/react", "Services", "devtools/shared/flags", "devtools/client/shared/vendor/react-dom", "devtools/client/shared/vendor/lodash", "devtools/client/shared/vendor/react-redux", "devtools/client/shared/vendor/redux", "devtools/client/shared/vendor/immutable", "devtools/client/sourceeditor/editor", "devtools/client/shared/vendor/WasmParser", "devtools/client/shared/vendor/WasmDis"], factory); else { var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("Services"), require("devtools/shared/flags"), require("devtools/client/shared/vendor/react-dom"), require("devtools/client/shared/vendor/lodash"), require("devtools/client/shared/vendor/react-redux"), require("devtools/client/shared/vendor/redux"), require("devtools/client/shared/vendor/immutable"), require("devtools/client/sourceeditor/editor"), require("devtools/client/shared/vendor/WasmParser"), require("devtools/client/shared/vendor/WasmDis")) : factory(root["devtools/client/shared/vendor/react-prop-types"], root["devtools/client/shared/vendor/react-dom-factories"], root["devtools/client/shared/vendor/react"], root["Services"], root["devtools/shared/flags"], root["devtools/client/shared/vendor/react-dom"], root["devtools/client/shared/vendor/lodash"], root["devtools/client/shared/vendor/react-redux"], root["devtools/client/shared/vendor/redux"], root["devtools/client/shared/vendor/immutable"], root["devtools/client/sourceeditor/editor"], root["devtools/client/shared/vendor/WasmParser"], root["devtools/client/shared/vendor/WasmDis"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_37__, __WEBPACK_EXTERNAL_MODULE_103__, __WEBPACK_EXTERNAL_MODULE_112__, __WEBPACK_EXTERNAL_MODULE_417__, __WEBPACK_EXTERNAL_MODULE_484__, __WEBPACK_EXTERNAL_MODULE_517__, __WEBPACK_EXTERNAL_MODULE_543__, __WEBPACK_EXTERNAL_MODULE_562__, __WEBPACK_EXTERNAL_MODULE_622__, __WEBPACK_EXTERNAL_MODULE_623__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/assets/build"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 611); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_1__; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const validProtocols = /(http|https|ftp|data|resource|chrome):/i; // URL Regex, common idioms: // // Lead-in (URL): // ( Capture because we need to know if there was a lead-in // character so we can include it as part of the text // preceding the match. We lack look-behind matching. // ^| The URL can start at the beginning of the string. // [\s(,;'"`] Or whitespace or some punctuation that does not imply // a context which would preclude a URL. // ) // // We do not need a trailing look-ahead because our regex's will terminate // because they run out of characters they can eat. // What we do not attempt to have the regexp do: // - Avoid trailing '.' and ')' characters. We let our greedy match absorb // these, but have a separate regex for extra characters to leave off at the // end. // // The Regex (apart from lead-in/lead-out): // ( Begin capture of the URL // (?: (potential detect beginnings) // https?:\/\/| Start with "http" or "https" // www\d{0,3}[.][a-z0-9.\-]{2,249}| // Start with "www", up to 3 numbers, then "." then // something that looks domain-namey. We differ from the // next case in that we do not constrain the top-level // domain as tightly and do not require a trailing path // indicator of "/". This is IDN root compatible. // [a-z0-9.\-]{2,250}[.][a-z]{2,4}\/ // Detect a non-www domain, but requiring a trailing "/" // to indicate a path. This only detects IDN domains // with a non-IDN root. This is reasonable in cases where // there is no explicit http/https start us out, but // unreasonable where there is. Our real fix is the bug // to port the Thunderbird/gecko linkification logic. // // Domain names can be up to 253 characters long, and are // limited to a-zA-Z0-9 and '-'. The roots don't have // hyphens unless they are IDN roots. Root zones can be // found here: http://www.iana.org/domains/root/db // ) // [-\w.!~*'();,/?:@&=+$#%]* // path onwards. We allow the set of characters that // encodeURI does not escape plus the result of escaping // (so also '%') // ) // eslint-disable-next-line max-len const urlRegex = /(^|[\s(,;'"`])((?:https?:\/\/|www\d{0,3}[.][a-z0-9.\-]{2,249}|[a-z0-9.\-]{2,250}[.][a-z]{2,4}\/)[-\w.!~*'();,/?:@&=+$#%]*)/im; // Set of terminators that are likely to have been part of the context rather // than part of the URL and so should be uneaten. This is '(', ',', ';', plus // quotes and question end-ing punctuation and the potential permutations with // parentheses (english-specific). const uneatLastUrlCharsRegex = /(?:[),;.!?`'"]|[.!?]\)|\)[.!?])$/; const ELLIPSIS = "\u2026"; const dom = __webpack_require__(1); const { span } = dom; /** * Returns true if the given object is a grip (see RDP protocol) */ function isGrip(object) { return object && object.actor; } function escapeNewLines(value) { return value.replace(/\r/gm, "\\r").replace(/\n/gm, "\\n"); } // Map from character code to the corresponding escape sequence. \0 // isn't here because it would require special treatment in some // situations. \b, \f, and \v aren't here because they aren't very // common. \' isn't here because there's no need, we only // double-quote strings. const escapeMap = { // Tab. 9: "\\t", // Newline. 0xa: "\\n", // Carriage return. 0xd: "\\r", // Quote. 0x22: '\\"', // Backslash. 0x5c: "\\\\" }; // Regexp that matches any character we might possibly want to escape. // Note that we over-match here, because it's difficult to, say, match // an unpaired surrogate with a regexp. The details are worked out by // the replacement function; see |escapeString|. const escapeRegexp = new RegExp("[" + // Quote and backslash. '"\\\\' + // Controls. "\x00-\x1f" + // More controls. "\x7f-\x9f" + // BOM "\ufeff" + // Specials, except for the replacement character. "\ufff0-\ufffc\ufffe\uffff" + // Surrogates. "\ud800-\udfff" + // Mathematical invisibles. "\u2061-\u2064" + // Line and paragraph separators. "\u2028-\u2029" + // Private use area. "\ue000-\uf8ff" + "]", "g"); /** * Escape a string so that the result is viewable and valid JS. * Control characters, other invisibles, invalid characters, * backslash, and double quotes are escaped. The resulting string is * surrounded by double quotes. * * @param {String} str * the input * @param {Boolean} escapeWhitespace * if true, TAB, CR, and NL characters will be escaped * @return {String} the escaped string */ function escapeString(str, escapeWhitespace) { return `"${str.replace(escapeRegexp, (match, offset) => { const c = match.charCodeAt(0); if (c in escapeMap) { if (!escapeWhitespace && (c === 9 || c === 0xa || c === 0xd)) { return match[0]; } return escapeMap[c]; } if (c >= 0xd800 && c <= 0xdfff) { // Find the full code point containing the surrogate, with a // special case for a trailing surrogate at the start of the // string. if (c >= 0xdc00 && offset > 0) { --offset; } const codePoint = str.codePointAt(offset); if (codePoint >= 0xd800 && codePoint <= 0xdfff) { // Unpaired surrogate. return `\\u${codePoint.toString(16)}`; } else if (codePoint >= 0xf0000 && codePoint <= 0x10fffd) { // Private use area. Because we visit each pair of a such a // character, return the empty string for one half and the // real result for the other, to avoid duplication. if (c <= 0xdbff) { return `\\u{${codePoint.toString(16)}}`; } return ""; } // Other surrogate characters are passed through. return match; } return `\\u${`0000${c.toString(16)}`.substr(-4)}`; })}"`; } /** * Escape a property name, if needed. "Escaping" in this context * means surrounding the property name with quotes. * * @param {String} * name the property name * @return {String} either the input, or the input surrounded by * quotes, properly quoted in JS syntax. */ function maybeEscapePropertyName(name) { // Quote the property name if it needs quoting. This particular // test is an approximation; see // https://mathiasbynens.be/notes/javascript-properties. However, // the full solution requires a fair amount of Unicode data, and so // let's defer that until either it's important, or the \p regexp // syntax lands, see // https://github.com/tc39/proposal-regexp-unicode-property-escapes. if (!/^\w+$/.test(name)) { name = escapeString(name); } return name; } function cropMultipleLines(text, limit) { return escapeNewLines(cropString(text, limit)); } function rawCropString(text, limit, alternativeText = ELLIPSIS) { // Crop the string only if a limit is actually specified. if (!limit || limit <= 0) { return text; } // Set the limit at least to the length of the alternative text // plus one character of the original text. if (limit <= alternativeText.length) { limit = alternativeText.length + 1; } const halfLimit = (limit - alternativeText.length) / 2; if (text.length > limit) { return text.substr(0, Math.ceil(halfLimit)) + alternativeText + text.substr(text.length - Math.floor(halfLimit)); } return text; } function cropString(text, limit, alternativeText) { return rawCropString(sanitizeString(`${text}`), limit, alternativeText); } function sanitizeString(text) { // Replace all non-printable characters, except of // (horizontal) tab (HT: \x09) and newline (LF: \x0A, CR: \x0D), // with unicode replacement character (u+fffd). // eslint-disable-next-line no-control-regex const re = new RegExp("[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]", "g"); return text.replace(re, "\ufffd"); } function parseURLParams(url) { url = new URL(url); return parseURLEncodedText(url.searchParams); } function parseURLEncodedText(text) { const params = []; // In case the text is empty just return the empty parameters if (text == "") { return params; } const searchParams = new URLSearchParams(text); const entries = [...searchParams.entries()]; return entries.map(entry => { return { name: entry[0], value: entry[1] }; }); } function getFileName(url) { const split = splitURLBase(url); return split.name; } function splitURLBase(url) { if (!isDataURL(url)) { return splitURLTrue(url); } return {}; } function getURLDisplayString(url) { return cropString(url); } function isDataURL(url) { return url && url.substr(0, 5) == "data:"; } function splitURLTrue(url) { const reSplitFile = /(.*?):\/{2,3}([^\/]*)(.*?)([^\/]*?)($|\?.*)/; const m = reSplitFile.exec(url); if (!m) { return { name: url, path: url }; } else if (m[4] == "" && m[5] == "") { return { protocol: m[1], domain: m[2], path: m[3], name: m[3] != "/" ? m[3] : m[2] }; } return { protocol: m[1], domain: m[2], path: m[2] + m[3], name: m[4] + m[5] }; } /** * Wrap the provided render() method of a rep in a try/catch block that will * render a fallback rep if the render fails. */ function wrapRender(renderMethod) { const wrappedFunction = function (props) { try { return renderMethod.call(this, props); } catch (e) { console.error(e); return span({ className: "objectBox objectBox-failure", title: "This object could not be rendered, " + "please file a bug on bugzilla.mozilla.org" }, /* Labels have to be hardcoded for reps, see Bug 1317038. */ "Invalid object"); } }; wrappedFunction.propTypes = renderMethod.propTypes; return wrappedFunction; } /** * Get preview items from a Grip. * * @param {Object} Grip from which we want the preview items * @return {Array} Array of the preview items of the grip, or an empty array * if the grip does not have preview items */ function getGripPreviewItems(grip) { if (!grip) { return []; } // Promise resolved value Grip if (grip.promiseState && grip.promiseState.value) { return [grip.promiseState.value]; } // Array Grip if (grip.preview && grip.preview.items) { return grip.preview.items; } // Node Grip if (grip.preview && grip.preview.childNodes) { return grip.preview.childNodes; } // Set or Map Grip if (grip.preview && grip.preview.entries) { return grip.preview.entries.reduce((res, entry) => res.concat(entry), []); } // Event Grip if (grip.preview && grip.preview.target) { const keys = Object.keys(grip.preview.properties); const values = Object.values(grip.preview.properties); return [grip.preview.target, ...keys, ...values]; } // RegEx Grip if (grip.displayString) { return [grip.displayString]; } // Generic Grip if (grip.preview && grip.preview.ownProperties) { let propertiesValues = Object.values(grip.preview.ownProperties).map(property => property.value || property); const propertyKeys = Object.keys(grip.preview.ownProperties); propertiesValues = propertiesValues.concat(propertyKeys); // ArrayBuffer Grip if (grip.preview.safeGetterValues) { propertiesValues = propertiesValues.concat(Object.values(grip.preview.safeGetterValues).map(property => property.getterValue || property)); } return propertiesValues; } return []; } /** * Get the type of an object. * * @param {Object} Grip from which we want the type. * @param {boolean} noGrip true if the object is not a grip. * @return {boolean} */ function getGripType(object, noGrip) { if (noGrip || Object(object) !== object) { return typeof object; } if (object.type === "object") { return object.class; } return object.type; } /** * Determines whether a grip is a string containing a URL. * * @param string grip * The grip, which may contain a URL. * @return boolean * Whether the grip is a string containing a URL. */ function containsURL(grip) { // An URL can't be shorter than 5 char (e.g. "ftp:"). if (typeof grip !== "string" || grip.length < 5) { return false; } return validProtocols.test(grip); } /** * Determines whether a string token is a valid URL. * * @param string token * The token. * @return boolean * Whether the token is a URL. */ function isURL(token) { try { if (!validProtocols.test(token)) { return false; } new URL(token); return true; } catch (e) { return false; } } /** * Returns new array in which `char` are interleaved between the original items. * * @param {Array} items * @param {String} char * @returns Array */ function interleave(items, char) { return items.reduce((res, item, index) => { if (index !== items.length - 1) { return res.concat(item, char); } return res.concat(item); }, []); } const ellipsisElement = span({ key: "more", className: "more-ellipsis", title: `more${ELLIPSIS}` }, ELLIPSIS); module.exports = { interleave, isGrip, isURL, cropString, containsURL, rawCropString, sanitizeString, escapeString, wrapRender, cropMultipleLines, parseURLParams, parseURLEncodedText, getFileName, getURLDisplayString, maybeEscapePropertyName, getGripPreviewItems, getGripType, ellipsisElement, ELLIPSIS, uneatLastUrlCharsRegex, urlRegex }; /***/ }), /* 3 */, /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ module.exports = { MODE: { TINY: Symbol("TINY"), SHORT: Symbol("SHORT"), LONG: Symbol("LONG") } }; /***/ }), /* 5 */, /* 6 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_6__; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const networkRequest = __webpack_require__(13); const workerUtils = __webpack_require__(14); module.exports = { networkRequest, workerUtils }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { var freeGlobal = __webpack_require__(43); /** 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')(); module.exports = root; /***/ }), /* 9 */ /***/ (function(module, exports) { /** * 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 = Array.isArray; module.exports = isArray; /***/ }), /* 10 */, /* 11 */ /***/ (function(module, exports) { /** * 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 != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /* 12 */, /* 13 */ /***/ (function(module, exports) { /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function networkRequest(url, opts) { return fetch(url, { cache: opts.loadFromCache ? "default" : "no-cache" }).then(res => { if (res.status >= 200 && res.status < 300) { if (res.headers.get("Content-Type") === "application/wasm") { return res.arrayBuffer().then(buffer => ({ content: buffer, isDwarf: true })); } return res.text().then(text => ({ content: text })); } return Promise.reject(`request failed with status ${res.status}`); }); } module.exports = networkRequest; /***/ }), /* 14 */ /***/ (function(module, exports) { function WorkerDispatcher() { this.msgId = 1; this.worker = null; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ WorkerDispatcher.prototype = { start(url, win = window) { this.worker = new win.Worker(url); this.worker.onerror = () => { console.error(`Error in worker ${url}`); }; }, stop() { if (!this.worker) { return; } this.worker.terminate(); this.worker = null; }, task(method, { queue = false } = {}) { const calls = []; const push = args => { return new Promise((resolve, reject) => { if (queue && calls.length === 0) { Promise.resolve().then(flush); } calls.push([args, resolve, reject]); if (!queue) { flush(); } }); }; const flush = () => { const items = calls.slice(); calls.length = 0; if (!this.worker) { return; } const id = this.msgId++; this.worker.postMessage({ id, method, calls: items.map(item => item[0]) }); const listener = ({ data: result }) => { if (result.id !== id) { return; } if (!this.worker) { return; } this.worker.removeEventListener("message", listener); result.results.forEach((resultData, i) => { const [, resolve, reject] = items[i]; if (resultData.error) { reject(resultData.error); } else { resolve(resultData.response); } }); }; this.worker.addEventListener("message", listener); }; return (...args) => push(args); }, invoke(method, ...args) { return this.task(method)(...args); } }; function workerHandler(publicInterface) { return function (msg) { const { id, method, calls } = msg.data; Promise.all(calls.map(args => { try { const response = publicInterface[method].apply(undefined, args); if (response instanceof Promise) { return response.then(val => ({ response: val }), // Error can't be sent via postMessage, so be sure to // convert to string. err => ({ error: err.toString() })); } return { response }; } catch (error) { // Error can't be sent via postMessage, so be sure to convert to // string. return { error: error.toString() }; } })).then(results => { self.postMessage({ id, results }); }); }; } module.exports = { WorkerDispatcher, workerHandler }; /***/ }), /* 15 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 16 */, /* 17 */, /* 18 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(19), getRawTag = __webpack_require__(71), objectToString = __webpack_require__(72); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { var root = __webpack_require__(8); /** Built-in value references. */ var Symbol = root.Symbol; module.exports = Symbol; /***/ }), /* 20 */, /* 21 */, /* 22 */ /***/ (function(module, exports) { module.exports = function(module) { if(!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if(!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 23 */, /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ __webpack_require__(458); // Load all existing rep templates const Undefined = __webpack_require__(459); const Null = __webpack_require__(460); const StringRep = __webpack_require__(25); const Number = __webpack_require__(461); const ArrayRep = __webpack_require__(38); const Obj = __webpack_require__(462); const SymbolRep = __webpack_require__(463); const InfinityRep = __webpack_require__(464); const NaNRep = __webpack_require__(465); const Accessor = __webpack_require__(466); // DOM types (grips) const Accessible = __webpack_require__(467); const Attribute = __webpack_require__(468); const BigInt = __webpack_require__(188); const DateTime = __webpack_require__(469); const Document = __webpack_require__(470); const DocumentType = __webpack_require__(471); const Event = __webpack_require__(472); const Func = __webpack_require__(189); const PromiseRep = __webpack_require__(473); const RegExp = __webpack_require__(474); const StyleSheet = __webpack_require__(475); const CommentNode = __webpack_require__(476); const ElementNode = __webpack_require__(477); const TextNode = __webpack_require__(478); const ErrorRep = __webpack_require__(191); const Window = __webpack_require__(479); const ObjectWithText = __webpack_require__(480); const ObjectWithURL = __webpack_require__(481); const GripArray = __webpack_require__(192); const GripMap = __webpack_require__(194); const GripMapEntry = __webpack_require__(195); const Grip = __webpack_require__(113); // List of all registered template. // XXX there should be a way for extensions to register a new // or modify an existing rep. const reps = [RegExp, StyleSheet, Event, DateTime, CommentNode, Accessible, ElementNode, TextNode, Attribute, Func, PromiseRep, ArrayRep, Document, DocumentType, Window, ObjectWithText, ObjectWithURL, ErrorRep, GripArray, GripMap, GripMapEntry, Grip, Undefined, Null, StringRep, Number, BigInt, SymbolRep, InfinityRep, NaNRep, Accessor, Obj]; /** * Generic rep that is used for rendering native JS types or an object. * The right template used for rendering is picked automatically according * to the current value type. The value must be passed in as the 'object' * property. */ const Rep = function (props) { const { object, defaultRep } = props; const rep = getRep(object, defaultRep, props.noGrip); return rep(props); }; // Helpers /** * Return a rep object that is responsible for rendering given * object. * * @param object {Object} Object to be rendered in the UI. This * can be generic JS object as well as a grip (handle to a remote * debuggee object). * * @param defaultRep {React.Component} The default template * that should be used to render given object if none is found. * * @param noGrip {Boolean} If true, will only check reps not made for remote * objects. */ function getRep(object, defaultRep = Grip, noGrip = false) { for (let i = 0; i < reps.length; i++) { const rep = reps[i]; try { // supportsObject could return weight (not only true/false // but a number), which would allow to priorities templates and // support better extensibility. if (rep.supportsObject(object, noGrip)) { return rep.rep; } } catch (err) { console.error(err); } } return defaultRep.rep; } module.exports = { Rep, REPS: { Accessible, Accessor, ArrayRep, Attribute, BigInt, CommentNode, DateTime, Document, DocumentType, ElementNode, ErrorRep, Event, Func, Grip, GripArray, GripMap, GripMapEntry, InfinityRep, NaNRep, Null, Number, Obj, ObjectWithText, ObjectWithURL, PromiseRep, RegExp, Rep, StringRep, StyleSheet, SymbolRep, TextNode, Undefined, Window }, // Exporting for tests getRep }; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { containsURL, escapeString, getGripType, rawCropString, sanitizeString, wrapRender, isGrip, ELLIPSIS, uneatLastUrlCharsRegex, urlRegex } = __webpack_require__(2); const dom = __webpack_require__(1); const { a, span } = dom; /** * Renders a string. String value is enclosed within quotes. */ StringRep.propTypes = { useQuotes: PropTypes.bool, escapeWhitespace: PropTypes.bool, style: PropTypes.object, cropLimit: PropTypes.number.isRequired, member: PropTypes.object, object: PropTypes.object.isRequired, openLink: PropTypes.func, className: PropTypes.string, title: PropTypes.string, isInContentPage: PropTypes.bool }; function StringRep(props) { const { className, style, cropLimit, object, useQuotes = true, escapeWhitespace = true, member, openLink, title, isInContentPage } = props; let text = object; const isLong = isLongString(object); const isOpen = member && member.open; const shouldCrop = !isOpen && cropLimit && text.length > cropLimit; if (isLong) { text = maybeCropLongString({ shouldCrop, cropLimit }, text); const { fullText } = object; if (isOpen && fullText) { text = fullText; } } text = formatText({ useQuotes, escapeWhitespace }, text); const config = getElementConfig({ className, style, actor: object.actor, title }); if (!isLong) { if (containsURL(text)) { return span(config, ...getLinkifiedElements(text, shouldCrop && cropLimit, openLink, isInContentPage)); } // Cropping of longString has been handled before formatting. text = maybeCropString({ isLong, shouldCrop, cropLimit }, text); } return span(config, text); } function maybeCropLongString(opts, text) { const { shouldCrop, cropLimit } = opts; const { initial, length } = text; text = shouldCrop ? initial.substring(0, cropLimit) : initial; if (text.length < length) { text += ELLIPSIS; } return text; } function formatText(opts, text) { const { useQuotes, escapeWhitespace } = opts; return useQuotes ? escapeString(text, escapeWhitespace) : sanitizeString(text); } function getElementConfig(opts) { const { className, style, actor, title } = opts; const config = {}; if (actor) { config["data-link-actor-id"] = actor; } if (title) { config.title = title; } const classNames = ["objectBox", "objectBox-string"]; if (className) { classNames.push(className); } config.className = classNames.join(" "); if (style) { config.style = style; } return config; } function maybeCropString(opts, text) { const { shouldCrop, cropLimit } = opts; return shouldCrop ? rawCropString(text, cropLimit) : text; } /** * Get an array of the elements representing the string, cropped if needed, * with actual links. * * @param {String} text: The actual string to linkify. * @param {Integer | null} cropLimit * @param {Function} openLink: Function handling the link opening. * @param {Boolean} isInContentPage: pass true if the reps is rendered in * the content page (e.g. in JSONViewer). * @returns {Array} */ function getLinkifiedElements(text, cropLimit, openLink, isInContentPage) { const halfLimit = Math.ceil((cropLimit - ELLIPSIS.length) / 2); const startCropIndex = cropLimit ? halfLimit : null; const endCropIndex = cropLimit ? text.length - halfLimit : null; const items = []; let currentIndex = 0; let contentStart; while (true) { const url = urlRegex.exec(text); // Pick the regexp with the earlier content; index will always be zero. if (!url) { break; } contentStart = url.index + url[1].length; if (contentStart > 0) { const nonUrlText = text.substring(0, contentStart); items.push(getCroppedString(nonUrlText, currentIndex, startCropIndex, endCropIndex)); } // There are some final characters for a URL that are much more likely // to have been part of the enclosing text rather than the end of the // URL. let useUrl = url[2]; const uneat = uneatLastUrlCharsRegex.exec(useUrl); if (uneat) { useUrl = useUrl.substring(0, uneat.index); } currentIndex = currentIndex + contentStart; const linkText = getCroppedString(useUrl, currentIndex, startCropIndex, endCropIndex); if (linkText) { items.push(a({ className: "url", title: useUrl, draggable: false, // Because we don't want the link to be open in the current // panel's frame, we only render the href attribute if `openLink` // exists (so we can preventDefault) or if the reps will be // displayed in content page (e.g. in the JSONViewer). href: openLink || isInContentPage ? useUrl : null, target: "_blank", onClick: openLink ? e => { e.preventDefault(); openLink(useUrl, e); } : null }, linkText)); } currentIndex = currentIndex + useUrl.length; text = text.substring(url.index + url[1].length + useUrl.length); } // Clean up any non-URL text at the end of the source string, // i.e. not handled in the loop. if (text.length > 0) { if (currentIndex < endCropIndex) { text = getCroppedString(text, currentIndex, startCropIndex, endCropIndex); } items.push(text); } return items; } /** * Returns a cropped substring given an offset, start and end crop indices in a * parent string. * * @param {String} text: The substring to crop. * @param {Integer} offset: The offset corresponding to the index at which * the substring is in the parent string. * @param {Integer|null} startCropIndex: the index where the start of the crop * should happen in the parent string. * @param {Integer|null} endCropIndex: the index where the end of the crop * should happen in the parent string * @returns {String|null} The cropped substring, or null if the text is * completly cropped. */ function getCroppedString(text, offset = 0, startCropIndex, endCropIndex) { if (!startCropIndex) { return text; } const start = offset; const end = offset + text.length; const shouldBeVisible = !(start >= startCropIndex && end <= endCropIndex); if (!shouldBeVisible) { return null; } const shouldCropEnd = start < startCropIndex && end > startCropIndex; const shouldCropStart = start < endCropIndex && end > endCropIndex; if (shouldCropEnd) { const cutIndex = startCropIndex - start; return text.substring(0, cutIndex) + ELLIPSIS + (shouldCropStart ? text.substring(endCropIndex - start) : ""); } if (shouldCropStart) { // The string should be cropped at the beginning. const cutIndex = endCropIndex - start; return text.substring(cutIndex); } return text; } function isLongString(object) { return object && object.type === "longString"; } function supportsObject(object, noGrip = false) { if (noGrip === false && isGrip(object)) { return isLongString(object); } return getGripType(object, noGrip) == "string"; } // Exports from this module module.exports = { rep: wrapRender(StringRep), supportsObject, isLongString }; /***/ }), /* 26 */, /* 27 */, /* 28 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(18), isObjectLike = __webpack_require__(11); /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** * 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) && baseGetTag(value) == symbolTag); } module.exports = isSymbol; /***/ }), /* 29 */, /* 30 */, /* 31 */, /* 32 */, /* 33 */, /* 34 */, /* 35 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) 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); } process.nextTick = function (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); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 36 */ /***/ (function(module, exports) { var charenc = { // UTF-8 encoding utf8: { // Convert a string to a byte array stringToBytes: function(str) { return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); }, // Convert a byte array to a string bytesToString: function(bytes) { return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); } }, // Binary encoding bin: { // Convert a string to a byte array stringToBytes: function(str) { for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 0xFF); return bytes; }, // Convert a byte array to a string bytesToString: function(bytes) { for (var str = [], i = 0; i < bytes.length; i++) str.push(String.fromCharCode(bytes[i])); return str.join(''); } } }; module.exports = charenc; /***/ }), /* 37 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_37__; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const dom = __webpack_require__(1); const PropTypes = __webpack_require__(0); const { wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const { span } = dom; const ModePropType = PropTypes.oneOf( // @TODO Change this to Object.values when supported in Node's version of V8 Object.keys(MODE).map(key => MODE[key])); /** * Renders an array. The array is enclosed by left and right bracket * and the max number of rendered items depends on the current mode. */ ArrayRep.propTypes = { mode: ModePropType, object: PropTypes.array.isRequired }; function ArrayRep(props) { const { object, mode = MODE.SHORT } = props; let items; let brackets; const needSpace = function (space) { return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; }; if (mode === MODE.TINY) { const isEmpty = object.length === 0; if (isEmpty) { items = []; } else { items = [span({ className: "more-ellipsis", title: "more…" }, "…")]; } brackets = needSpace(false); } else { items = arrayIterator(props, object, maxLengthMap.get(mode)); brackets = needSpace(items.length > 0); } return span({ className: "objectBox objectBox-array" }, span({ className: "arrayLeftBracket" }, brackets.left), ...items, span({ className: "arrayRightBracket" }, brackets.right)); } function arrayIterator(props, array, max) { const items = []; for (let i = 0; i < array.length && i < max; i++) { const config = { mode: MODE.TINY, delim: i == array.length - 1 ? "" : ", " }; let item; try { item = ItemRep({ ...props, ...config, object: array[i] }); } catch (exc) { item = ItemRep({ ...props, ...config, object: exc }); } items.push(item); } if (array.length > max) { items.push(span({ className: "more-ellipsis", title: "more…" }, "…")); } return items; } /** * Renders array item. Individual values are separated by a comma. */ ItemRep.propTypes = { object: PropTypes.any.isRequired, delim: PropTypes.string.isRequired, mode: ModePropType }; function ItemRep(props) { const { Rep } = __webpack_require__(24); const { object, delim, mode } = props; return span({}, Rep({ ...props, object: object, mode: mode }), delim); } function getLength(object) { return object.length; } function supportsObject(object, noGrip = false) { return noGrip && (Array.isArray(object) || Object.prototype.toString.call(object) === "[object Arguments]"); } const maxLengthMap = new Map(); maxLengthMap.set(MODE.SHORT, 3); maxLengthMap.set(MODE.LONG, 10); // Exports from this module module.exports = { rep: wrapRender(ArrayRep), supportsObject, maxLengthMap, getLength, ModePropType }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { maybeEscapePropertyName, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const { span } = __webpack_require__(1); /** * Property for Obj (local JS objects), Grip (remote JS objects) * and GripMap (remote JS maps and weakmaps) reps. * It's used to render object properties. */ PropRep.propTypes = { // Property name. name: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, // Equal character rendered between property name and value. equal: PropTypes.string, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func, // Normally a PropRep will quote a property name that isn't valid // when unquoted; but this flag can be used to suppress the // quoting. suppressQuotes: PropTypes.bool }; /** * Function that given a name, a delimiter and an object returns an array * of React elements representing an object property (e.g. `name: value`) * * @param {Object} props * @return {Array} Array of React elements. */ function PropRep(props) { const Grip = __webpack_require__(113); const { Rep } = __webpack_require__(24); let { name, mode, equal, suppressQuotes } = props; let key; // The key can be a simple string, for plain objects, // or another object for maps and weakmaps. if (typeof name === "string") { if (!suppressQuotes) { name = maybeEscapePropertyName(name); } key = span({ className: "nodeName" }, name); } else { key = Rep({ ...props, className: "nodeName", object: name, mode: mode || MODE.TINY, defaultRep: Grip }); } return [key, span({ className: "objectEqual" }, equal), Rep({ ...props })]; } // Exports from this module module.exports = wrapRender(PropRep); /***/ }), /* 40 */, /* 41 */, /* 42 */, /* 43 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; module.exports = freeGlobal; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15))) /***/ }), /* 44 */, /* 45 */, /* 46 */, /* 47 */, /* 48 */, /* 49 */, /* 50 */, /* 51 */, /* 52 */, /* 53 */, /* 54 */, /* 55 */, /* 56 */, /* 57 */ /***/ (function(module, exports, __webpack_require__) { var baseToString = __webpack_require__(95); /** * 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 convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } module.exports = toString; /***/ }), /* 58 */, /* 59 */, /* 60 */, /* 61 */, /* 62 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { /** Detect free variables */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; var freeModule = typeof module == 'object' && module && !module.nodeType && module; var freeGlobal = typeof global == 'object' && global; if ( freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal ) { root = freeGlobal; } /** * The `punycode` object. * @name punycode * @type Object */ var punycode, /** Highest positive signed 32-bit float value */ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 /** Bootstring parameters */ base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, // 0x80 delimiter = '-', // '\x2D' /** Regular expressions */ regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators /** Error messages */ errors = { 'overflow': 'Overflow: input needs wider integers to process', 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', 'invalid-input': 'Invalid input' }, /** Convenience shortcuts */ baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, /** Temporary variable */ key; /*--------------------------------------------------------------------------*/ /** * A generic error utility function. * @private * @param {String} type The error type. * @returns {Error} Throws a `RangeError` with the applicable error message. */ function error(type) { throw new RangeError(errors[type]); } /** * A generic `Array#map` utility function. * @private * @param {Array} array The array to iterate over. * @param {Function} callback The function that gets called for every array * item. * @returns {Array} A new array of values returned by the callback function. */ function map(array, fn) { var length = array.length; var result = []; while (length--) { result[length] = fn(array[length]); } return result; } /** * A simple `Array#map`-like wrapper to work with domain name strings or email * addresses. * @private * @param {String} domain The domain name or email address. * @param {Function} callback The function that gets called for every * character. * @returns {Array} A new string of characters returned by the callback * function. */ function mapDomain(string, fn) { var parts = string.split('@'); var result = ''; if (parts.length > 1) { // In email addresses, only the domain name should be punycoded. Leave // the local part (i.e. everything up to `@`) intact. result = parts[0] + '@'; string = parts[1]; } // Avoid `split(regex)` for IE8 compatibility. See #17. string = string.replace(regexSeparators, '\x2E'); var labels = string.split('.'); var encoded = map(labels, fn).join('.'); return result + encoded; } /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. * @see `punycode.ucs2.encode` * @see * @memberOf punycode.ucs2 * @name decode * @param {String} string The Unicode input string (UCS-2). * @returns {Array} The new array of code points. */ function ucs2decode(string) { var output = [], counter = 0, length = string.length, value, extra; while (counter < length) { value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // high surrogate, and there is a next character extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // low surrogate output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // unmatched surrogate; only append this code unit, in case the next // code unit is the high surrogate of a surrogate pair output.push(value); counter--; } } else { output.push(value); } } return output; } /** * Creates a string based on an array of numeric code points. * @see `punycode.ucs2.decode` * @memberOf punycode.ucs2 * @name encode * @param {Array} codePoints The array of numeric code points. * @returns {String} The new Unicode string (UCS-2). */ function ucs2encode(array) { return map(array, function(value) { var output = ''; if (value > 0xFFFF) { value -= 0x10000; output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); value = 0xDC00 | value & 0x3FF; } output += stringFromCharCode(value); return output; }).join(''); } /** * Converts a basic code point into a digit/integer. * @see `digitToBasic()` * @private * @param {Number} codePoint The basic numeric code point value. * @returns {Number} The numeric value of a basic code point (for use in * representing integers) in the range `0` to `base - 1`, or `base` if * the code point does not represent a value. */ function basicToDigit(codePoint) { if (codePoint - 48 < 10) { return codePoint - 22; } if (codePoint - 65 < 26) { return codePoint - 65; } if (codePoint - 97 < 26) { return codePoint - 97; } return base; } /** * Converts a digit/integer into a basic code point. * @see `basicToDigit()` * @private * @param {Number} digit The numeric value of a basic code point. * @returns {Number} The basic code point whose value (when used for * representing integers) is `digit`, which needs to be in the range * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is * used; else, the lowercase form is used. The behavior is undefined * if `flag` is non-zero and `digit` has no uppercase form. */ function digitToBasic(digit, flag) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); } /** * Bias adaptation function as per section 3.4 of RFC 3492. * https://tools.ietf.org/html/rfc3492#section-3.4 * @private */ function adapt(delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); } /** * Converts a Punycode string of ASCII-only symbols to a string of Unicode * symbols. * @memberOf punycode * @param {String} input The Punycode string of ASCII-only symbols. * @returns {String} The resulting string of Unicode symbols. */ function decode(input) { // Don't use UCS-2 var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t, /** Cached calculation results */ baseMinusT; // Handle the basic code points: let `basic` be the number of input code // points before the last delimiter, or `0` if there is none, then copy // the first basic code points to the output. basic = input.lastIndexOf(delimiter); if (basic < 0) { basic = 0; } for (j = 0; j < basic; ++j) { // if it's not a basic code point if (input.charCodeAt(j) >= 0x80) { error('not-basic'); } output.push(input.charCodeAt(j)); } // Main decoding loop: start just after the last delimiter if any basic code // points were copied; start at the beginning otherwise. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { // `index` is the index of the next character to be consumed. // Decode a generalized variable-length integer into `delta`, // which gets added to `i`. The overflow checking is easier // if we increase `i` as we go, then subtract off its starting // value at the end to obtain `delta`. for (oldi = i, w = 1, k = base; /* no condition */; k += base) { if (index >= inputLength) { error('invalid-input'); } digit = basicToDigit(input.charCodeAt(index++)); if (digit >= base || digit > floor((maxInt - i) / w)) { error('overflow'); } i += digit * w; t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (digit < t) { break; } baseMinusT = base - t; if (w > floor(maxInt / baseMinusT)) { error('overflow'); } w *= baseMinusT; } out = output.length + 1; bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`, // incrementing `n` each time, so we'll fix that now: if (floor(i / out) > maxInt - n) { error('overflow'); } n += floor(i / out); i %= out; // Insert `n` at position `i` of the output output.splice(i++, 0, n); } return ucs2encode(output); } /** * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. * @memberOf punycode * @param {String} input The string of Unicode symbols. * @returns {String} The resulting Punycode string of ASCII-only symbols. */ function encode(input) { var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], /** `inputLength` will hold the number of code points in `input`. */ inputLength, /** Cached calculation results */ handledCPCountPlusOne, baseMinusT, qMinusT; // Convert the input in UCS-2 to Unicode input = ucs2decode(input); // Cache the length inputLength = input.length; // Initialize the state n = initialN; delta = 0; bias = initialBias; // Handle the basic code points for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < 0x80) { output.push(stringFromCharCode(currentValue)); } } handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled; // `basicLength` is the number of basic code points. // Finish the basic string - if it is not empty - with a delimiter if (basicLength) { output.push(delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next // larger one: for (m = maxInt, j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's state to , // but guard against overflow handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error('overflow'); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error('overflow'); } if (currentValue == n) { // Represent delta as a generalized variable-length integer for (q = delta, k = base; /* no condition */; k += base) { t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); } /** * Converts a Punycode string representing a domain name or an email address * to Unicode. Only the Punycoded parts of the input will be converted, i.e. * it doesn't matter if you call it on a string that has already been * converted to Unicode. * @memberOf punycode * @param {String} input The Punycoded domain name or email address to * convert to Unicode. * @returns {String} The Unicode representation of the given Punycode * string. */ function toUnicode(input) { return mapDomain(input, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } /** * Converts a Unicode string representing a domain name or an email address to * Punycode. Only the non-ASCII parts of the domain name will be converted, * i.e. it doesn't matter if you call it with a domain that's already in * ASCII. * @memberOf punycode * @param {String} input The domain name or email address to convert, as a * Unicode string. * @returns {String} The Punycode representation of the given domain name or * email address. */ function toASCII(input) { return mapDomain(input, function(string) { return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; }); } /*--------------------------------------------------------------------------*/ /** Define the public API */ punycode = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ 'version': '1.4.1', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ 'ucs2': { 'decode': ucs2decode, 'encode': ucs2encode }, 'decode': decode, 'encode': encode, 'toASCII': toASCII, 'toUnicode': toUnicode }; /** Expose `punycode` */ // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( true ) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return punycode; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (freeExports && freeModule) { if (module.exports == freeExports) { // in Node.js, io.js, or RingoJS v0.8.0+ freeModule.exports = punycode; } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(22)(module), __webpack_require__(15))) /***/ }), /* 63 */, /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const md5 = __webpack_require__(105); function originalToGeneratedId(sourceId) { if (isGeneratedId(sourceId)) { return sourceId; } const match = sourceId.match(/(.*)\/originalSource/); return match ? match[1] : ""; } const getMd5 = memoize(url => md5(url)); function generatedToOriginalId(generatedId, url) { return `${generatedId}/originalSource-${getMd5(url)}`; } function isOriginalId(id) { return (/\/originalSource/.test(id) ); } function isGeneratedId(id) { return !isOriginalId(id); } /** * Trims the query part or reference identifier of a URL string, if necessary. */ function trimUrlQuery(url) { const length = url.length; const q1 = url.indexOf("?"); const q2 = url.indexOf("&"); const q3 = url.indexOf("#"); const q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); return url.slice(0, q); } // Map suffix to content type. const contentMap = { js: "text/javascript", jsm: "text/javascript", mjs: "text/javascript", ts: "text/typescript", tsx: "text/typescript-jsx", jsx: "text/jsx", vue: "text/vue", coffee: "text/coffeescript", elm: "text/elm", cljc: "text/x-clojure", cljs: "text/x-clojurescript" }; /** * Returns the content type for the specified URL. If no specific * content type can be determined, "text/plain" is returned. * * @return String * The content type. */ function getContentType(url) { url = trimUrlQuery(url); const dot = url.lastIndexOf("."); if (dot >= 0) { const name = url.substring(dot + 1); if (name in contentMap) { return contentMap[name]; } } return "text/plain"; } function memoize(func) { const map = new Map(); return arg => { if (map.has(arg)) { return map.get(arg); } const result = func(arg); map.set(arg, result); return result; }; } module.exports = { originalToGeneratedId, generatedToOriginalId, isOriginalId, isGeneratedId, getContentType, contentMapForTesting: contentMap }; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var EventEmitter = function EventEmitter() {}; module.exports = EventEmitter; const promise = __webpack_require__(422); /** * Decorate an object with event emitter functionality. * * @param Object aObjectToDecorate * Bind all public methods of EventEmitter to * the aObjectToDecorate object. */ EventEmitter.decorate = function EventEmitter_decorate(aObjectToDecorate) { let emitter = new EventEmitter(); aObjectToDecorate.on = emitter.on.bind(emitter); aObjectToDecorate.off = emitter.off.bind(emitter); aObjectToDecorate.once = emitter.once.bind(emitter); aObjectToDecorate.emit = emitter.emit.bind(emitter); }; EventEmitter.prototype = { /** * Connect a listener. * * @param string aEvent * The event name to which we're connecting. * @param function aListener * Called when the event is fired. */ on: function EventEmitter_on(aEvent, aListener) { if (!this._eventEmitterListeners) this._eventEmitterListeners = new Map(); if (!this._eventEmitterListeners.has(aEvent)) { this._eventEmitterListeners.set(aEvent, []); } this._eventEmitterListeners.get(aEvent).push(aListener); }, /** * Listen for the next time an event is fired. * * @param string aEvent * The event name to which we're connecting. * @param function aListener * (Optional) Called when the event is fired. Will be called at most * one time. * @return promise * A promise which is resolved when the event next happens. The * resolution value of the promise is the first event argument. If * you need access to second or subsequent event arguments (it's rare * that this is needed) then use aListener */ once: function EventEmitter_once(aEvent, aListener) { let deferred = promise.defer(); let handler = (aEvent, aFirstArg, ...aRest) => { this.off(aEvent, handler); if (aListener) { aListener.apply(null, [aEvent, aFirstArg, ...aRest]); } deferred.resolve(aFirstArg); }; handler._originalListener = aListener; this.on(aEvent, handler); return deferred.promise; }, /** * Remove a previously-registered event listener. Works for events * registered with either on or once. * * @param string aEvent * The event name whose listener we're disconnecting. * @param function aListener * The listener to remove. */ off: function EventEmitter_off(aEvent, aListener) { if (!this._eventEmitterListeners) return; let listeners = this._eventEmitterListeners.get(aEvent); if (listeners) { this._eventEmitterListeners.set(aEvent, listeners.filter(l => { return l !== aListener && l._originalListener !== aListener; })); } }, /** * Emit an event. All arguments to this method will * be sent to listener functions. */ emit: function EventEmitter_emit(aEvent) { if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) { return; } let originalListeners = this._eventEmitterListeners.get(aEvent); for (let listener of this._eventEmitterListeners.get(aEvent)) { // If the object was destroyed during event emission, stop // emitting. if (!this._eventEmitterListeners) { break; } // If listeners were removed during emission, make sure the // event handler we're going to fire wasn't removed. if (originalListeners === this._eventEmitterListeners.get(aEvent) || this._eventEmitterListeners.get(aEvent).some(l => l === listener)) { try { listener.apply(null, arguments); } catch (ex) { // Prevent a bad listener from interfering with the others. let msg = ex + ": " + ex.stack; //console.error(msg); console.log(msg); } } } } }; /***/ }), /* 66 */ /***/ (function(module, exports) { (function() { var AcronymResult, computeScore, emptyAcronymResult, isAcronymFullWord, isMatch, isSeparator, isWordEnd, isWordStart, miss_coeff, pos_bonus, scoreAcronyms, scoreCharacter, scoreConsecutives, scoreExact, scoreExactMatch, scorePattern, scorePosition, scoreSize, tau_size, wm; wm = 150; pos_bonus = 20; tau_size = 150; miss_coeff = 0.75; exports.score = function(string, query, options) { var allowErrors, preparedQuery, score, string_lw; preparedQuery = options.preparedQuery, allowErrors = options.allowErrors; if (!(allowErrors || isMatch(string, preparedQuery.core_lw, preparedQuery.core_up))) { return 0; } string_lw = string.toLowerCase(); score = computeScore(string, string_lw, preparedQuery); return Math.ceil(score); }; exports.isMatch = isMatch = function(subject, query_lw, query_up) { var i, j, m, n, qj_lw, qj_up, si; m = subject.length; n = query_lw.length; if (!m || n > m) { return false; } i = -1; j = -1; while (++j < n) { qj_lw = query_lw.charCodeAt(j); qj_up = query_up.charCodeAt(j); while (++i < m) { si = subject.charCodeAt(i); if (si === qj_lw || si === qj_up) { break; } } if (i === m) { return false; } } return true; }; exports.computeScore = computeScore = function(subject, subject_lw, preparedQuery) { var acro, acro_score, align, csc_diag, csc_row, csc_score, csc_should_rebuild, i, j, m, miss_budget, miss_left, n, pos, query, query_lw, record_miss, score, score_diag, score_row, score_up, si_lw, start, sz; query = preparedQuery.query; query_lw = preparedQuery.query_lw; m = subject.length; n = query.length; acro = scoreAcronyms(subject, subject_lw, query, query_lw); acro_score = acro.score; if (acro.count === n) { return scoreExact(n, m, acro_score, acro.pos); } pos = subject_lw.indexOf(query_lw); if (pos > -1) { return scoreExactMatch(subject, subject_lw, query, query_lw, pos, n, m); } score_row = new Array(n); csc_row = new Array(n); sz = scoreSize(n, m); miss_budget = Math.ceil(miss_coeff * n) + 5; miss_left = miss_budget; csc_should_rebuild = true; j = -1; while (++j < n) { score_row[j] = 0; csc_row[j] = 0; } i = -1; while (++i < m) { si_lw = subject_lw[i]; if (!si_lw.charCodeAt(0) in preparedQuery.charCodes) { if (csc_should_rebuild) { j = -1; while (++j < n) { csc_row[j] = 0; } csc_should_rebuild = false; } continue; } score = 0; score_diag = 0; csc_diag = 0; record_miss = true; csc_should_rebuild = true; j = -1; while (++j < n) { score_up = score_row[j]; if (score_up > score) { score = score_up; } csc_score = 0; if (query_lw[j] === si_lw) { start = isWordStart(i, subject, subject_lw); csc_score = csc_diag > 0 ? csc_diag : scoreConsecutives(subject, subject_lw, query, query_lw, i, j, start); align = score_diag + scoreCharacter(i, j, start, acro_score, csc_score); if (align > score) { score = align; miss_left = miss_budget; } else { if (record_miss && --miss_left <= 0) { return Math.max(score, score_row[n - 1]) * sz; } record_miss = false; } } score_diag = score_up; csc_diag = csc_row[j]; csc_row[j] = csc_score; score_row[j] = score; } } score = score_row[n - 1]; return score * sz; }; exports.isWordStart = isWordStart = function(pos, subject, subject_lw) { var curr_s, prev_s; if (pos === 0) { return true; } curr_s = subject[pos]; prev_s = subject[pos - 1]; return isSeparator(prev_s) || (curr_s !== subject_lw[pos] && prev_s === subject_lw[pos - 1]); }; exports.isWordEnd = isWordEnd = function(pos, subject, subject_lw, len) { var curr_s, next_s; if (pos === len - 1) { return true; } curr_s = subject[pos]; next_s = subject[pos + 1]; return isSeparator(next_s) || (curr_s === subject_lw[pos] && next_s !== subject_lw[pos + 1]); }; isSeparator = function(c) { return c === ' ' || c === '.' || c === '-' || c === '_' || c === '/' || c === '\\'; }; scorePosition = function(pos) { var sc; if (pos < pos_bonus) { sc = pos_bonus - pos; return 100 + sc * sc; } else { return Math.max(100 + pos_bonus - pos, 0); } }; exports.scoreSize = scoreSize = function(n, m) { return tau_size / (tau_size + Math.abs(m - n)); }; scoreExact = function(n, m, quality, pos) { return 2 * n * (wm * quality + scorePosition(pos)) * scoreSize(n, m); }; exports.scorePattern = scorePattern = function(count, len, sameCase, start, end) { var bonus, sz; sz = count; bonus = 6; if (sameCase === count) { bonus += 2; } if (start) { bonus += 3; } if (end) { bonus += 1; } if (count === len) { if (start) { if (sameCase === len) { sz += 2; } else { sz += 1; } } if (end) { bonus += 1; } } return sameCase + sz * (sz + bonus); }; exports.scoreCharacter = scoreCharacter = function(i, j, start, acro_score, csc_score) { var posBonus; posBonus = scorePosition(i); if (start) { return posBonus + wm * ((acro_score > csc_score ? acro_score : csc_score) + 10); } return posBonus + wm * csc_score; }; exports.scoreConsecutives = scoreConsecutives = function(subject, subject_lw, query, query_lw, i, j, startOfWord) { var k, m, mi, n, nj, sameCase, sz; m = subject.length; n = query.length; mi = m - i; nj = n - j; k = mi < nj ? mi : nj; sameCase = 0; sz = 0; if (query[j] === subject[i]) { sameCase++; } while (++sz < k && query_lw[++j] === subject_lw[++i]) { if (query[j] === subject[i]) { sameCase++; } } if (sz < k) { i--; } if (sz === 1) { return 1 + 2 * sameCase; } return scorePattern(sz, n, sameCase, startOfWord, isWordEnd(i, subject, subject_lw, m)); }; exports.scoreExactMatch = scoreExactMatch = function(subject, subject_lw, query, query_lw, pos, n, m) { var end, i, pos2, sameCase, start; start = isWordStart(pos, subject, subject_lw); if (!start) { pos2 = subject_lw.indexOf(query_lw, pos + 1); if (pos2 > -1) { start = isWordStart(pos2, subject, subject_lw); if (start) { pos = pos2; } } } i = -1; sameCase = 0; while (++i < n) { if (query[pos + i] === subject[i]) { sameCase++; } } end = isWordEnd(pos + n - 1, subject, subject_lw, m); return scoreExact(n, m, scorePattern(n, n, sameCase, start, end), pos); }; AcronymResult = (function() { function AcronymResult(score, pos, count) { this.score = score; this.pos = pos; this.count = count; } return AcronymResult; })(); emptyAcronymResult = new AcronymResult(0, 0.1, 0); exports.scoreAcronyms = scoreAcronyms = function(subject, subject_lw, query, query_lw) { var count, fullWord, i, j, m, n, qj_lw, sameCase, score, sepCount, sumPos; m = subject.length; n = query.length; if (!(m > 1 && n > 1)) { return emptyAcronymResult; } count = 0; sepCount = 0; sumPos = 0; sameCase = 0; i = -1; j = -1; while (++j < n) { qj_lw = query_lw[j]; if (isSeparator(qj_lw)) { i = subject_lw.indexOf(qj_lw, i + 1); if (i > -1) { sepCount++; continue; } else { break; } } while (++i < m) { if (qj_lw === subject_lw[i] && isWordStart(i, subject, subject_lw)) { if (query[j] === subject[i]) { sameCase++; } sumPos += i; count++; break; } } if (i === m) { break; } } if (count < 2) { return emptyAcronymResult; } fullWord = count === n ? isAcronymFullWord(subject, subject_lw, query, count) : false; score = scorePattern(count, n, sameCase, true, fullWord); return new AcronymResult(score, sumPos / count, count + sepCount); }; isAcronymFullWord = function(subject, subject_lw, query, nbAcronymInQuery) { var count, i, m, n; m = subject.length; n = query.length; count = 0; if (m > 12 * n) { return false; } i = -1; while (++i < m) { if (isWordStart(i, subject, subject_lw) && ++count > nbAcronymInQuery) { return false; } } return true; }; }).call(this); /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { 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 (typeof module !== 'undefined' && 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 { window.classNames = classNames; } }()); /***/ }), /* 68 */, /* 69 */, /* 70 */, /* 71 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(19); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; /***/ }), /* 72 */ /***/ (function(module, exports) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; /***/ }), /* 73 */, /* 74 */, /* 75 */, /* 76 */, /* 77 */, /* 78 */, /* 79 */, /* 80 */, /* 81 */, /* 82 */, /* 83 */, /* 84 */, /* 85 */, /* 86 */, /* 87 */, /* 88 */, /* 89 */, /* 90 */, /* 91 */, /* 92 */, /* 93 */, /* 94 */, /* 95 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(19), arrayMap = __webpack_require__(96), isArray = __webpack_require__(9), isSymbol = __webpack_require__(28); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * 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 (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = baseToString; /***/ }), /* 96 */ /***/ (function(module, exports) { /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } module.exports = arrayMap; /***/ }), /* 97 */, /* 98 */, /* 99 */, /* 100 */, /* 101 */, /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const flag = __webpack_require__(103); function isBrowser() { return typeof window == "object"; } function isNode() { return process && process.release && process.release.name == 'node'; } function isDevelopment() { if (!isNode() && isBrowser()) { const href = window.location ? window.location.href : ""; return href.match(/^file:/) || href.match(/localhost:/); } return "production" != "production"; } function isTesting() { return flag.testing; } function isFirefoxPanel() { return !isDevelopment(); } function isFirefox() { return (/firefox/i.test(navigator.userAgent) ); } module.exports = { isDevelopment, isTesting, isFirefoxPanel, isFirefox }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35))) /***/ }), /* 103 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_103__; /***/ }), /* 104 */, /* 105 */ /***/ (function(module, exports, __webpack_require__) { (function(){ var crypt = __webpack_require__(106), utf8 = __webpack_require__(36).utf8, isBuffer = __webpack_require__(107), bin = __webpack_require__(36).bin, // The core md5 = function (message, options) { // Convert to byte array if (message.constructor == String) if (options && options.encoding === 'binary') message = bin.stringToBytes(message); else message = utf8.stringToBytes(message); else if (isBuffer(message)) message = Array.prototype.slice.call(message, 0); else if (!Array.isArray(message)) message = message.toString(); // else, assume byte array already var m = crypt.bytesToWords(message), l = message.length * 8, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878; // Swap endian for (var i = 0; i < m.length; i++) { m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; } // Padding m[l >>> 5] |= 0x80 << (l % 32); m[(((l + 64) >>> 9) << 4) + 14] = l; // Method shortcuts var FF = md5._ff, GG = md5._gg, HH = md5._hh, II = md5._ii; for (var i = 0; i < m.length; i += 16) { var aa = a, bb = b, cc = c, dd = d; a = FF(a, b, c, d, m[i+ 0], 7, -680876936); d = FF(d, a, b, c, m[i+ 1], 12, -389564586); c = FF(c, d, a, b, m[i+ 2], 17, 606105819); b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); a = FF(a, b, c, d, m[i+ 4], 7, -176418897); d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); b = FF(b, c, d, a, m[i+ 7], 22, -45705983); a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); c = FF(c, d, a, b, m[i+10], 17, -42063); b = FF(b, c, d, a, m[i+11], 22, -1990404162); a = FF(a, b, c, d, m[i+12], 7, 1804603682); d = FF(d, a, b, c, m[i+13], 12, -40341101); c = FF(c, d, a, b, m[i+14], 17, -1502002290); b = FF(b, c, d, a, m[i+15], 22, 1236535329); a = GG(a, b, c, d, m[i+ 1], 5, -165796510); d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); c = GG(c, d, a, b, m[i+11], 14, 643717713); b = GG(b, c, d, a, m[i+ 0], 20, -373897302); a = GG(a, b, c, d, m[i+ 5], 5, -701558691); d = GG(d, a, b, c, m[i+10], 9, 38016083); c = GG(c, d, a, b, m[i+15], 14, -660478335); b = GG(b, c, d, a, m[i+ 4], 20, -405537848); a = GG(a, b, c, d, m[i+ 9], 5, 568446438); d = GG(d, a, b, c, m[i+14], 9, -1019803690); c = GG(c, d, a, b, m[i+ 3], 14, -187363961); b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); a = GG(a, b, c, d, m[i+13], 5, -1444681467); d = GG(d, a, b, c, m[i+ 2], 9, -51403784); c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); b = GG(b, c, d, a, m[i+12], 20, -1926607734); a = HH(a, b, c, d, m[i+ 5], 4, -378558); d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); c = HH(c, d, a, b, m[i+11], 16, 1839030562); b = HH(b, c, d, a, m[i+14], 23, -35309556); a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); c = HH(c, d, a, b, m[i+ 7], 16, -155497632); b = HH(b, c, d, a, m[i+10], 23, -1094730640); a = HH(a, b, c, d, m[i+13], 4, 681279174); d = HH(d, a, b, c, m[i+ 0], 11, -358537222); c = HH(c, d, a, b, m[i+ 3], 16, -722521979); b = HH(b, c, d, a, m[i+ 6], 23, 76029189); a = HH(a, b, c, d, m[i+ 9], 4, -640364487); d = HH(d, a, b, c, m[i+12], 11, -421815835); c = HH(c, d, a, b, m[i+15], 16, 530742520); b = HH(b, c, d, a, m[i+ 2], 23, -995338651); a = II(a, b, c, d, m[i+ 0], 6, -198630844); d = II(d, a, b, c, m[i+ 7], 10, 1126891415); c = II(c, d, a, b, m[i+14], 15, -1416354905); b = II(b, c, d, a, m[i+ 5], 21, -57434055); a = II(a, b, c, d, m[i+12], 6, 1700485571); d = II(d, a, b, c, m[i+ 3], 10, -1894986606); c = II(c, d, a, b, m[i+10], 15, -1051523); b = II(b, c, d, a, m[i+ 1], 21, -2054922799); a = II(a, b, c, d, m[i+ 8], 6, 1873313359); d = II(d, a, b, c, m[i+15], 10, -30611744); c = II(c, d, a, b, m[i+ 6], 15, -1560198380); b = II(b, c, d, a, m[i+13], 21, 1309151649); a = II(a, b, c, d, m[i+ 4], 6, -145523070); d = II(d, a, b, c, m[i+11], 10, -1120210379); c = II(c, d, a, b, m[i+ 2], 15, 718787259); b = II(b, c, d, a, m[i+ 9], 21, -343485551); a = (a + aa) >>> 0; b = (b + bb) >>> 0; c = (c + cc) >>> 0; d = (d + dd) >>> 0; } return crypt.endian([a, b, c, d]); }; // Auxiliary functions md5._ff = function (a, b, c, d, x, s, t) { var n = a + (b & c | ~b & d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._gg = function (a, b, c, d, x, s, t) { var n = a + (b & d | c & ~d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._hh = function (a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._ii = function (a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; // Package private blocksize md5._blocksize = 16; md5._digestsize = 16; module.exports = function (message, options) { if (message === undefined || message === null) throw new Error('Illegal argument ' + message); var digestbytes = crypt.wordsToBytes(md5(message, options)); return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes); }; })(); /***/ }), /* 106 */ /***/ (function(module, exports) { (function() { var base64map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', crypt = { // Bit-wise rotation left rotl: function(n, b) { return (n << b) | (n >>> (32 - b)); }, // Bit-wise rotation right rotr: function(n, b) { return (n << (32 - b)) | (n >>> b); }, // Swap big-endian to little-endian and vice versa endian: function(n) { // If number given, swap endian if (n.constructor == Number) { return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00; } // Else, assume array and swap all items for (var i = 0; i < n.length; i++) n[i] = crypt.endian(n[i]); return n; }, // Generate an array of any length of random bytes randomBytes: function(n) { for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); return bytes; }, // Convert a byte array to big-endian 32-bit words bytesToWords: function(bytes) { for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) words[b >>> 5] |= bytes[i] << (24 - b % 32); return words; }, // Convert big-endian 32-bit words to a byte array wordsToBytes: function(words) { for (var bytes = [], b = 0; b < words.length * 32; b += 8) bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); return bytes; }, // Convert a byte array to a hex string bytesToHex: function(bytes) { for (var hex = [], i = 0; i < bytes.length; i++) { hex.push((bytes[i] >>> 4).toString(16)); hex.push((bytes[i] & 0xF).toString(16)); } return hex.join(''); }, // Convert a hex string to a byte array hexToBytes: function(hex) { for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }, // Convert a byte array to a base-64 string bytesToBase64: function(bytes) { for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]; for (var j = 0; j < 4; j++) if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F)); else base64.push('='); } return base64.join(''); }, // Convert a base-64 string to a byte array base64ToBytes: function(base64) { // Remove non-base-64 characters base64 = base64.replace(/[^A-Z0-9+\/]/ig, ''); for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { if (imod4 == 0) continue; bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2))); } return bytes; } }; module.exports = crypt; })(); /***/ }), /* 107 */ /***/ (function(module, exports) { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ // The _isBuffer check is for Safari 5-7 support, because it's missing // Object.prototype.constructor. Remove this eventually module.exports = function (obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } function isBuffer (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' && isBuffer(obj.slice(0, 0)) } /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _tree = __webpack_require__(109); var _tree2 = _interopRequireDefault(_tree); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = { Tree: _tree2.default }; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); var _reactDomFactories = __webpack_require__(1); var _reactDomFactories2 = _interopRequireDefault(_reactDomFactories); var _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const { Component, createFactory } = _react2.default; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ __webpack_require__(110); // depth const AUTO_EXPAND_DEPTH = 0; // Simplied selector targetting elements that can receive the focus, // full version at https://stackoverflow.com/questions/1599660. const FOCUSABLE_SELECTOR = ["a[href]:not([tabindex='-1'])", "button:not([disabled]):not([tabindex='-1'])", "iframe:not([tabindex='-1'])", "input:not([disabled]):not([tabindex='-1'])", "select:not([disabled]):not([tabindex='-1'])", "textarea:not([disabled]):not([tabindex='-1'])", "[tabindex]:not([tabindex='-1'])"].join(", "); /** * An arrow that displays whether its node is expanded (▼) or collapsed * (▶). When its node has no children, it is hidden. */ class ArrowExpander extends Component { static get propTypes() { return { expanded: _propTypes2.default.bool }; } shouldComponentUpdate(nextProps, nextState) { return this.props.expanded !== nextProps.expanded; } render() { const { expanded } = this.props; const classNames = ["arrow"]; if (expanded) { classNames.push("expanded"); } return _reactDomFactories2.default.button({ className: classNames.join(" ") }); } } const treeIndent = _reactDomFactories2.default.span({ className: "tree-indent" }, "\u200B"); class TreeNode extends Component { static get propTypes() { return { id: _propTypes2.default.any.isRequired, index: _propTypes2.default.number.isRequired, depth: _propTypes2.default.number.isRequired, focused: _propTypes2.default.bool.isRequired, active: _propTypes2.default.bool.isRequired, expanded: _propTypes2.default.bool.isRequired, item: _propTypes2.default.any.isRequired, isExpandable: _propTypes2.default.bool.isRequired, onClick: _propTypes2.default.func, shouldItemUpdate: _propTypes2.default.func, renderItem: _propTypes2.default.func.isRequired }; } constructor(props) { super(props); this.treeNodeRef = _react2.default.createRef(); this._onKeyDown = this._onKeyDown.bind(this); } componentDidMount() { // Make sure that none of the focusable elements inside the tree node // container are tabbable if the tree node is not active. If the tree node // is active and focus is outside its container, focus on the first // focusable element inside. const elms = this.getFocusableElements(); if (this.props.active) { if (elms.length > 0 && !elms.includes(document.activeElement)) { elms[0].focus(); } } else { elms.forEach(elm => elm.setAttribute("tabindex", "-1")); } } shouldComponentUpdate(nextProps) { return this.props.item !== nextProps.item || this.props.shouldItemUpdate && this.props.shouldItemUpdate(this.props.item, nextProps.item) || this.props.focused !== nextProps.focused || this.props.expanded !== nextProps.expanded; } /** * Get a list of all elements that are focusable with a keyboard inside the * tree node. */ getFocusableElements() { return this.treeNodeRef.current ? Array.from(this.treeNodeRef.current.querySelectorAll(FOCUSABLE_SELECTOR)) : []; } /** * Wrap and move keyboard focus to first/last focusable element inside the * tree node to prevent the focus from escaping the tree node boundaries. * element). * * @param {DOMNode} current currently focused element * @param {Boolean} back direction * @return {Boolean} true there is a newly focused element. */ _wrapMoveFocus(current, back) { const elms = this.getFocusableElements(); let next; if (elms.length === 0) { return false; } if (back) { if (elms.indexOf(current) === 0) { next = elms[elms.length - 1]; next.focus(); } } else if (elms.indexOf(current) === elms.length - 1) { next = elms[0]; next.focus(); } return !!next; } _onKeyDown(e) { const { target, key, shiftKey } = e; if (key !== "Tab") { return; } const focusMoved = this._wrapMoveFocus(target, shiftKey); if (focusMoved) { // Focus was moved to the begining/end of the list, so we need to prevent // the default focus change that would happen here. e.preventDefault(); } e.stopPropagation(); } render() { const { depth, id, item, focused, active, expanded, renderItem, isExpandable } = this.props; const arrow = isExpandable ? ArrowExpanderFactory({ item, expanded }) : null; let ariaExpanded; if (this.props.isExpandable) { ariaExpanded = false; } if (this.props.expanded) { ariaExpanded = true; } const indents = Array.from({ length: depth }).fill(treeIndent); const items = indents.concat(renderItem(item, depth, focused, arrow, expanded)); return _reactDomFactories2.default.div({ id, className: `tree-node${focused ? " focused" : ""}${active ? " active" : ""}`, onClick: this.props.onClick, onKeyDownCapture: active ? this._onKeyDown : null, role: "treeitem", ref: this.treeNodeRef, "aria-level": depth + 1, "aria-expanded": ariaExpanded, "data-expandable": this.props.isExpandable }, ...items); } } const ArrowExpanderFactory = createFactory(ArrowExpander); const TreeNodeFactory = createFactory(TreeNode); /** * Create a function that calls the given function `fn` only once per animation * frame. * * @param {Function} fn * @returns {Function} */ function oncePerAnimationFrame(fn) { let animationId = null; let argsToPass = null; return function (...args) { argsToPass = args; if (animationId !== null) { return; } animationId = requestAnimationFrame(() => { fn.call(this, ...argsToPass); animationId = null; argsToPass = null; }); }; } /** * A generic tree component. See propTypes for the public API. * * This tree component doesn't make any assumptions about the structure of your * tree data. Whether children are computed on demand, or stored in an array in * the parent's `_children` property, it doesn't matter. We only require the * implementation of `getChildren`, `getRoots`, `getParent`, and `isExpanded` * functions. * * This tree component is well tested and reliable. See the tests in ./tests * and its usage in the performance and memory panels in mozilla-central. * * This tree component doesn't make any assumptions about how to render items in * the tree. You provide a `renderItem` function, and this component will ensure * that only those items whose parents are expanded and which are visible in the * viewport are rendered. The `renderItem` function could render the items as a * "traditional" tree or as rows in a table or anything else. It doesn't * restrict you to only one certain kind of tree. * * The tree comes with basic styling for the indent, the arrow, as well as * hovered and focused styles which can be override in CSS. * * ### Example Usage * * Suppose we have some tree data where each item has this form: * * { * id: Number, * label: String, * parent: Item or null, * children: Array of child items, * expanded: bool, * } * * Here is how we could render that data with this component: * * class MyTree extends Component { * static get propTypes() { * // The root item of the tree, with the form described above. * return { * root: PropTypes.object.isRequired * }; * }, * * render() { * return Tree({ * itemHeight: 20, // px * * getRoots: () => [this.props.root], * * getParent: item => item.parent, * getChildren: item => item.children, * getKey: item => item.id, * isExpanded: item => item.expanded, * * renderItem: (item, depth, isFocused, arrow, isExpanded) => { * let className = "my-tree-item"; * if (isFocused) { * className += " focused"; * } * return dom.div({ * className, * }, * arrow, * // And here is the label for this item. * dom.span({ className: "my-tree-item-label" }, item.label) * ); * }, * * onExpand: item => dispatchExpandActionToRedux(item), * onCollapse: item => dispatchCollapseActionToRedux(item), * }); * } * } */ class Tree extends Component { static get propTypes() { return { // Required props // A function to get an item's parent, or null if it is a root. // // Type: getParent(item: Item) -> Maybe // // Example: // // // The parent of this item is stored in its `parent` property. // getParent: item => item.parent getParent: _propTypes2.default.func.isRequired, // A function to get an item's children. // // Type: getChildren(item: Item) -> [Item] // // Example: // // // This item's children are stored in its `children` property. // getChildren: item => item.children getChildren: _propTypes2.default.func.isRequired, // A function to check if the tree node for the item should be updated. // // Type: shouldItemUpdate(prevItem: Item, nextItem: Item) -> Boolean // // Example: // // // This item should be updated if it's type is a long string // shouldItemUpdate: (prevItem, nextItem) => // nextItem.type === "longstring" shouldItemUpdate: _propTypes2.default.func, // A function which takes an item and ArrowExpander component instance and // returns a component, or text, or anything else that React considers // renderable. // // Type: renderItem(item: Item, // depth: Number, // isFocused: Boolean, // arrow: ReactComponent, // isExpanded: Boolean) -> ReactRenderable // // Example: // // renderItem: (item, depth, isFocused, arrow, isExpanded) => { // let className = "my-tree-item"; // if (isFocused) { // className += " focused"; // } // return dom.div( // { // className, // style: { marginLeft: depth * 10 + "px" } // }, // arrow, // dom.span({ className: "my-tree-item-label" }, item.label) // ); // }, renderItem: _propTypes2.default.func.isRequired, // A function which returns the roots of the tree (forest). // // Type: getRoots() -> [Item] // // Example: // // // In this case, we only have one top level, root item. You could // // return multiple items if you have many top level items in your // // tree. // getRoots: () => [this.props.rootOfMyTree] getRoots: _propTypes2.default.func.isRequired, // A function to get a unique key for the given item. This helps speed up // React's rendering a *TON*. // // Type: getKey(item: Item) -> String // // Example: // // getKey: item => `my-tree-item-${item.uniqueId}` getKey: _propTypes2.default.func.isRequired, // A function to get whether an item is expanded or not. If an item is not // expanded, then it must be collapsed. // // Type: isExpanded(item: Item) -> Boolean // // Example: // // isExpanded: item => item.expanded, isExpanded: _propTypes2.default.func.isRequired, // Optional props // The currently focused item, if any such item exists. focused: _propTypes2.default.any, // Handle when a new item is focused. onFocus: _propTypes2.default.func, // The depth to which we should automatically expand new items. autoExpandDepth: _propTypes2.default.number, // Should auto expand all new items or just the new items under the first // root item. autoExpandAll: _propTypes2.default.bool, // Auto expand a node only if number of its children // are less than autoExpandNodeChildrenLimit autoExpandNodeChildrenLimit: _propTypes2.default.number, // Note: the two properties below are mutually exclusive. Only one of the // label properties is necessary. // ID of an element whose textual content serves as an accessible label // for a tree. labelledby: _propTypes2.default.string, // Accessibility label for a tree widget. label: _propTypes2.default.string, // Optional event handlers for when items are expanded or collapsed. // Useful for dispatching redux events and updating application state, // maybe lazily loading subtrees from a worker, etc. // // Type: // onExpand(item: Item) // onCollapse(item: Item) // // Example: // // onExpand: item => dispatchExpandActionToRedux(item) onExpand: _propTypes2.default.func, onCollapse: _propTypes2.default.func, // The currently active (keyboard) item, if any such item exists. active: _propTypes2.default.any, // Optional event handler called with the current focused node when the // Enter key is pressed. Can be useful to allow further keyboard actions // within the tree node. onActivate: _propTypes2.default.func, isExpandable: _propTypes2.default.func, // Additional classes to add to the root element. className: _propTypes2.default.string, // style object to be applied to the root element. style: _propTypes2.default.object, // Prevents blur when Tree loses focus preventBlur: _propTypes2.default.bool }; } static get defaultProps() { return { autoExpandDepth: AUTO_EXPAND_DEPTH, autoExpandAll: true }; } constructor(props) { super(props); this.state = { seen: new Set() }; this.treeRef = _react2.default.createRef(); this._onExpand = oncePerAnimationFrame(this._onExpand).bind(this); this._onCollapse = oncePerAnimationFrame(this._onCollapse).bind(this); this._focusPrevNode = oncePerAnimationFrame(this._focusPrevNode).bind(this); this._focusNextNode = oncePerAnimationFrame(this._focusNextNode).bind(this); this._focusParentNode = oncePerAnimationFrame(this._focusParentNode).bind(this); this._focusFirstNode = oncePerAnimationFrame(this._focusFirstNode).bind(this); this._focusLastNode = oncePerAnimationFrame(this._focusLastNode).bind(this); this._autoExpand = this._autoExpand.bind(this); this._preventArrowKeyScrolling = this._preventArrowKeyScrolling.bind(this); this._preventEvent = this._preventEvent.bind(this); this._dfs = this._dfs.bind(this); this._dfsFromRoots = this._dfsFromRoots.bind(this); this._focus = this._focus.bind(this); this._activate = this._activate.bind(this); this._scrollNodeIntoView = this._scrollNodeIntoView.bind(this); this._onBlur = this._onBlur.bind(this); this._onKeyDown = this._onKeyDown.bind(this); this._nodeIsExpandable = this._nodeIsExpandable.bind(this); } componentDidMount() { this._autoExpand(); if (this.props.focused) { this._scrollNodeIntoView(this.props.focused); } } componentWillReceiveProps(nextProps) { this._autoExpand(); } componentDidUpdate(prevProps, prevState) { if (this.props.focused && prevProps.focused !== this.props.focused) { this._scrollNodeIntoView(this.props.focused); } } _autoExpand() { const { autoExpandDepth, autoExpandNodeChildrenLimit } = this.props; if (!autoExpandDepth) { return; } // Automatically expand the first autoExpandDepth levels for new items. Do // not use the usual DFS infrastructure because we don't want to ignore // collapsed nodes. const autoExpand = (item, currentDepth) => { if (currentDepth >= autoExpandDepth || this.state.seen.has(item)) { return; } const children = this.props.getChildren(item); if (autoExpandNodeChildrenLimit && children.length > autoExpandNodeChildrenLimit) { return; } this.props.onExpand(item); this.state.seen.add(item); const length = children.length; for (let i = 0; i < length; i++) { autoExpand(children[i], currentDepth + 1); } }; const roots = this.props.getRoots(); const length = roots.length; if (this.props.autoExpandAll) { for (let i = 0; i < length; i++) { autoExpand(roots[i], 0); } } else if (length != 0) { autoExpand(roots[0], 0); } } _preventArrowKeyScrolling(e) { switch (e.key) { case "ArrowUp": case "ArrowDown": case "ArrowLeft": case "ArrowRight": this._preventEvent(e); break; } } _preventEvent(e) { e.preventDefault(); e.stopPropagation(); if (e.nativeEvent) { if (e.nativeEvent.preventDefault) { e.nativeEvent.preventDefault(); } if (e.nativeEvent.stopPropagation) { e.nativeEvent.stopPropagation(); } } } /** * Perform a pre-order depth-first search from item. */ _dfs(item, maxDepth = Infinity, traversal = [], _depth = 0) { traversal.push({ item, depth: _depth }); if (!this.props.isExpanded(item)) { return traversal; } const nextDepth = _depth + 1; if (nextDepth > maxDepth) { return traversal; } const children = this.props.getChildren(item); const length = children.length; for (let i = 0; i < length; i++) { this._dfs(children[i], maxDepth, traversal, nextDepth); } return traversal; } /** * Perform a pre-order depth-first search over the whole forest. */ _dfsFromRoots(maxDepth = Infinity) { const traversal = []; const roots = this.props.getRoots(); const length = roots.length; for (let i = 0; i < length; i++) { this._dfs(roots[i], maxDepth, traversal); } return traversal; } /** * Expands current row. * * @param {Object} item * @param {Boolean} expandAllChildren */ _onExpand(item, expandAllChildren) { if (this.props.onExpand) { this.props.onExpand(item); if (expandAllChildren) { const children = this._dfs(item); const length = children.length; for (let i = 0; i < length; i++) { this.props.onExpand(children[i].item); } } } } /** * Collapses current row. * * @param {Object} item */ _onCollapse(item) { if (this.props.onCollapse) { this.props.onCollapse(item); } } /** * Sets the passed in item to be the focused item. * * @param {Object|undefined} item * The item to be focused, or undefined to focus no item. * * @param {Object|undefined} options * An options object which can contain: * - dir: "up" or "down" to indicate if we should scroll the element * to the top or the bottom of the scrollable container when * the element is off canvas. */ _focus(item, options = {}) { const { preventAutoScroll } = options; if (item && !preventAutoScroll) { this._scrollNodeIntoView(item, options); } if (this.props.active != undefined) { this._activate(undefined); if (this.treeRef.current !== document.activeElement) { this.treeRef.current.focus(); } } if (this.props.onFocus) { this.props.onFocus(item); } } /** * Sets the passed in item to be the active item. * * @param {Object|undefined} item * The item to be activated, or undefined to activate no item. */ _activate(item) { if (this.props.onActivate) { this.props.onActivate(item); } } /** * Sets the passed in item to be the focused item. * * @param {Object|undefined} item * The item to be scrolled to. * * @param {Object|undefined} options * An options object which can contain: * - dir: "up" or "down" to indicate if we should scroll the element * to the top or the bottom of the scrollable container when * the element is off canvas. */ _scrollNodeIntoView(item, options = {}) { if (item !== undefined) { const treeElement = this.treeRef.current; const element = document.getElementById(this.props.getKey(item)); if (element) { const { top, bottom } = element.getBoundingClientRect(); const closestScrolledParent = node => { if (node == null) { return null; } if (node.scrollHeight > node.clientHeight) { return node; } return closestScrolledParent(node.parentNode); }; const scrolledParent = closestScrolledParent(treeElement); const scrolledParentRect = scrolledParent ? scrolledParent.getBoundingClientRect() : null; const isVisible = !scrolledParent || top >= scrolledParentRect.top && bottom <= scrolledParentRect.bottom; if (!isVisible) { const { alignTo } = options; const scrollToTop = alignTo ? alignTo === "top" : !scrolledParentRect || top < scrolledParentRect.top; element.scrollIntoView(scrollToTop); } } } } /** * Sets the state to have no focused item. */ _onBlur(e) { if (this.props.active != undefined) { const { relatedTarget } = e; if (!this.treeRef.current.contains(relatedTarget)) { this._activate(undefined); } } else if (!this.props.preventBlur) { this._focus(undefined); } } /** * Handles key down events in the tree's container. * * @param {Event} e */ // eslint-disable-next-line complexity _onKeyDown(e) { if (this.props.focused == null) { return; } // Allow parent nodes to use navigation arrows with modifiers. if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) { return; } this._preventArrowKeyScrolling(e); switch (e.key) { case "ArrowUp": this._focusPrevNode(); return; case "ArrowDown": this._focusNextNode(); return; case "ArrowLeft": if (this.props.isExpanded(this.props.focused) && this._nodeIsExpandable(this.props.focused)) { this._onCollapse(this.props.focused); } else { this._focusParentNode(); } return; case "ArrowRight": if (this._nodeIsExpandable(this.props.focused) && !this.props.isExpanded(this.props.focused)) { this._onExpand(this.props.focused); } else { this._focusNextNode(); } return; case "Home": this._focusFirstNode(); return; case "End": this._focusLastNode(); return; case "Enter": case " ": if (this.treeRef.current === document.activeElement) { this._preventEvent(e); if (this.props.active !== this.props.focused) { this._activate(this.props.focused); } } return; case "Escape": this._preventEvent(e); if (this.props.active != undefined) { this._activate(undefined); } if (this.treeRef.current !== document.activeElement) { this.treeRef.current.focus(); } } } /** * Sets the previous node relative to the currently focused item, to focused. */ _focusPrevNode() { // Start a depth first search and keep going until we reach the currently // focused node. Focus the previous node in the DFS, if it exists. If it // doesn't exist, we're at the first node already. let prev; const traversal = this._dfsFromRoots(); const length = traversal.length; for (let i = 0; i < length; i++) { const item = traversal[i].item; if (item === this.props.focused) { break; } prev = item; } if (prev === undefined) { return; } this._focus(prev, { alignTo: "top" }); } /** * Handles the down arrow key which will focus either the next child * or sibling row. */ _focusNextNode() { // Start a depth first search and keep going until we reach the currently // focused node. Focus the next node in the DFS, if it exists. If it // doesn't exist, we're at the last node already. const traversal = this._dfsFromRoots(); const length = traversal.length; let i = 0; while (i < length) { if (traversal[i].item === this.props.focused) { break; } i++; } if (i + 1 < traversal.length) { this._focus(traversal[i + 1].item, { alignTo: "bottom" }); } } /** * Handles the left arrow key, going back up to the current rows' * parent row. */ _focusParentNode() { const parent = this.props.getParent(this.props.focused); if (!parent) { this._focusPrevNode(this.props.focused); return; } this._focus(parent, { alignTo: "top" }); } _focusFirstNode() { const traversal = this._dfsFromRoots(); this._focus(traversal[0].item, { alignTo: "top" }); } _focusLastNode() { const traversal = this._dfsFromRoots(); const lastIndex = traversal.length - 1; this._focus(traversal[lastIndex].item, { alignTo: "bottom" }); } _nodeIsExpandable(item) { return this.props.isExpandable ? this.props.isExpandable(item) : !!this.props.getChildren(item).length; } render() { const traversal = this._dfsFromRoots(); const { active, focused } = this.props; const nodes = traversal.map((v, i) => { const { item, depth } = traversal[i]; const key = this.props.getKey(item, i); return TreeNodeFactory({ // We make a key unique depending on whether the tree node is in active // or inactive state to make sure that it is actually replaced and the // tabbable state is reset. key: `${key}-${active === item ? "active" : "inactive"}`, id: key, index: i, item, depth, shouldItemUpdate: this.props.shouldItemUpdate, renderItem: this.props.renderItem, focused: focused === item, active: active === item, expanded: this.props.isExpanded(item), isExpandable: this._nodeIsExpandable(item), onExpand: this._onExpand, onCollapse: this._onCollapse, onClick: e => { // We can stop the propagation since click handler on the node can be // created in `renderItem`. e.stopPropagation(); // Since the user just clicked the node, there's no need to check if // it should be scrolled into view. this._focus(item, { preventAutoScroll: true }); if (this.props.isExpanded(item)) { this.props.onCollapse(item, e.altKey); } else { this.props.onExpand(item, e.altKey); } // Focus should always remain on the tree container itself. this.treeRef.current.focus(); } }); }); const style = Object.assign({}, this.props.style || {}); return _reactDomFactories2.default.div({ className: `tree ${this.props.className ? this.props.className : ""}`, ref: this.treeRef, role: "tree", tabIndex: "0", onKeyDown: this._onKeyDown, onKeyPress: this._preventArrowKeyScrolling, onKeyUp: this._preventArrowKeyScrolling, onFocus: ({ nativeEvent }) => { if (focused || !nativeEvent || !this.treeRef.current) { return; } const { explicitOriginalTarget } = nativeEvent; // Only set default focus to the first tree node if the focus came // from outside the tree (e.g. by tabbing to the tree from other // external elements). if (explicitOriginalTarget !== this.treeRef.current && !this.treeRef.current.contains(explicitOriginalTarget)) { this._focus(traversal[0].item); } }, onBlur: this._onBlur, "aria-label": this.props.label, "aria-labelledby": this.props.labelledby, "aria-activedescendant": focused && this.props.getKey(focused), style }, nodes); } } exports.default = Tree; /***/ }), /* 110 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { (function() { var computeScore, countDir, file_coeff, getExtension, getExtensionScore, isMatch, scorePath, scoreSize, tau_depth, _ref; _ref = __webpack_require__(66), isMatch = _ref.isMatch, computeScore = _ref.computeScore, scoreSize = _ref.scoreSize; tau_depth = 20; file_coeff = 2.5; exports.score = function(string, query, options) { var allowErrors, preparedQuery, score, string_lw; preparedQuery = options.preparedQuery, allowErrors = options.allowErrors; if (!(allowErrors || isMatch(string, preparedQuery.core_lw, preparedQuery.core_up))) { return 0; } string_lw = string.toLowerCase(); score = computeScore(string, string_lw, preparedQuery); score = scorePath(string, string_lw, score, options); return Math.ceil(score); }; scorePath = function(subject, subject_lw, fullPathScore, options) { var alpha, basePathScore, basePos, depth, end, extAdjust, fileLength, pathSeparator, preparedQuery, useExtensionBonus; if (fullPathScore === 0) { return 0; } preparedQuery = options.preparedQuery, useExtensionBonus = options.useExtensionBonus, pathSeparator = options.pathSeparator; end = subject.length - 1; while (subject[end] === pathSeparator) { end--; } basePos = subject.lastIndexOf(pathSeparator, end); fileLength = end - basePos; extAdjust = 1.0; if (useExtensionBonus) { extAdjust += getExtensionScore(subject_lw, preparedQuery.ext, basePos, end, 2); fullPathScore *= extAdjust; } if (basePos === -1) { return fullPathScore; } depth = preparedQuery.depth; while (basePos > -1 && depth-- > 0) { basePos = subject.lastIndexOf(pathSeparator, basePos - 1); } basePathScore = basePos === -1 ? fullPathScore : extAdjust * computeScore(subject.slice(basePos + 1, end + 1), subject_lw.slice(basePos + 1, end + 1), preparedQuery); alpha = 0.5 * tau_depth / (tau_depth + countDir(subject, end + 1, pathSeparator)); return alpha * basePathScore + (1 - alpha) * fullPathScore * scoreSize(0, file_coeff * fileLength); }; exports.countDir = countDir = function(path, end, pathSeparator) { var count, i; if (end < 1) { return 0; } count = 0; i = -1; while (++i < end && path[i] === pathSeparator) { continue; } while (++i < end) { if (path[i] === pathSeparator) { count++; while (++i < end && path[i] === pathSeparator) { continue; } } } return count; }; exports.getExtension = getExtension = function(str) { var pos; pos = str.lastIndexOf("."); if (pos < 0) { return ""; } else { return str.substr(pos + 1); } }; getExtensionScore = function(candidate, ext, startPos, endPos, maxDepth) { var m, matched, n, pos; if (!ext.length) { return 0; } pos = candidate.lastIndexOf(".", endPos); if (!(pos > startPos)) { return 0; } n = ext.length; m = endPos - pos; if (m < n) { n = m; m = ext.length; } pos++; matched = -1; while (++matched < n) { if (candidate[pos + matched] !== ext[matched]) { break; } } if (matched === 0 && maxDepth > 0) { return 0.9 * getExtensionScore(candidate, ext, startPos, pos - 2, maxDepth - 1); } return matched / m; }; }).call(this); /***/ }), /* 112 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_112__; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Dependencies const { interleave, isGrip, wrapRender } = __webpack_require__(2); const PropRep = __webpack_require__(39); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; /** * Renders generic grip. Grip is client representation * of remote JS object and is used as an input object * for this rep component. */ GripRep.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), isInterestingProp: PropTypes.func, title: PropTypes.string, onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func, noGrip: PropTypes.bool }; const DEFAULT_TITLE = "Object"; function GripRep(props) { const { mode = MODE.SHORT, object } = props; const config = { "data-link-actor-id": object.actor, className: "objectBox objectBox-object" }; if (mode === MODE.TINY) { const propertiesLength = getPropertiesLength(object); const tinyModeItems = []; if (getTitle(props, object) !== DEFAULT_TITLE) { tinyModeItems.push(getTitleElement(props, object)); } else { tinyModeItems.push(span({ className: "objectLeftBrace" }, "{"), propertiesLength > 0 ? span({ key: "more", className: "more-ellipsis", title: "more…" }, "…") : null, span({ className: "objectRightBrace" }, "}")); } return span(config, ...tinyModeItems); } const propsArray = safePropIterator(props, object, maxLengthMap.get(mode)); return span(config, getTitleElement(props, object), span({ className: "objectLeftBrace" }, " { "), ...interleave(propsArray, ", "), span({ className: "objectRightBrace" }, " }")); } function getTitleElement(props, object) { return span({ className: "objectTitle" }, getTitle(props, object)); } function getTitle(props, object) { return props.title || object.class || DEFAULT_TITLE; } function getPropertiesLength(object) { let propertiesLength = object.preview && object.preview.ownPropertiesLength ? object.preview.ownPropertiesLength : object.ownPropertyLength; if (object.preview && object.preview.safeGetterValues) { propertiesLength += Object.keys(object.preview.safeGetterValues).length; } if (object.preview && object.preview.ownSymbols) { propertiesLength += object.preview.ownSymbolsLength; } return propertiesLength; } function safePropIterator(props, object, max) { max = typeof max === "undefined" ? maxLengthMap.get(MODE.SHORT) : max; try { return propIterator(props, object, max); } catch (err) { console.error(err); } return []; } function propIterator(props, object, max) { if (object.preview && Object.keys(object.preview).includes("wrappedValue")) { const { Rep } = __webpack_require__(24); return [Rep({ object: object.preview.wrappedValue, mode: props.mode || MODE.TINY, defaultRep: Grip })]; } // Property filter. Show only interesting properties to the user. const isInterestingProp = props.isInterestingProp || ((type, value) => { return type == "boolean" || type == "number" || type == "string" && value.length != 0; }); let properties = object.preview ? object.preview.ownProperties || {} : {}; const propertiesLength = getPropertiesLength(object); if (object.preview && object.preview.safeGetterValues) { properties = { ...properties, ...object.preview.safeGetterValues }; } let indexes = getPropIndexes(properties, max, isInterestingProp); if (indexes.length < max && indexes.length < propertiesLength) { // There are not enough props yet. // Then add uninteresting props to display them. indexes = indexes.concat(getPropIndexes(properties, max - indexes.length, (t, value, name) => { return !isInterestingProp(t, value, name); })); } // The server synthesizes some property names for a Proxy, like // and ; we don't want to quote these because, // as synthetic properties, they appear more natural when // unquoted. const suppressQuotes = object.class === "Proxy"; const propsArray = getProps(props, properties, indexes, suppressQuotes); // Show symbols. if (object.preview && object.preview.ownSymbols) { const { ownSymbols } = object.preview; const length = max - indexes.length; const symbolsProps = ownSymbols.slice(0, length).map(symbolItem => { return PropRep({ ...props, mode: MODE.TINY, name: symbolItem, object: symbolItem.descriptor.value, equal: ": ", defaultRep: Grip, title: null, suppressQuotes }); }); propsArray.push(...symbolsProps); } if (Object.keys(properties).length > max || propertiesLength > max || // When the object has non-enumerable properties, we don't have them in the // packet, but we might want to show there's something in the object. propertiesLength > propsArray.length) { // There are some undisplayed props. Then display "more...". propsArray.push(span({ key: "more", className: "more-ellipsis", title: "more…" }, "…")); } return propsArray; } /** * Get props ordered by index. * * @param {Object} componentProps Grip Component props. * @param {Object} properties Properties of the object the Grip describes. * @param {Array} indexes Indexes of properties. * @param {Boolean} suppressQuotes true if we should suppress quotes * on property names. * @return {Array} Props. */ function getProps(componentProps, properties, indexes, suppressQuotes) { // Make indexes ordered by ascending. indexes.sort(function (a, b) { return a - b; }); const propertiesKeys = Object.keys(properties); return indexes.map(i => { const name = propertiesKeys[i]; const value = getPropValue(properties[name]); return PropRep({ ...componentProps, mode: MODE.TINY, name, object: value, equal: ": ", defaultRep: Grip, title: null, suppressQuotes }); }); } /** * Get the indexes of props in the object. * * @param {Object} properties Props object. * @param {Number} max The maximum length of indexes array. * @param {Function} filter Filter the props you want. * @return {Array} Indexes of interesting props in the object. */ function getPropIndexes(properties, max, filter) { const indexes = []; try { let i = 0; for (const name in properties) { if (indexes.length >= max) { return indexes; } // Type is specified in grip's "class" field and for primitive // values use typeof. const value = getPropValue(properties[name]); let type = value.class || typeof value; type = type.toLowerCase(); if (filter(type, value, name)) { indexes.push(i); } i++; } } catch (err) { console.error(err); } return indexes; } /** * Get the actual value of a property. * * @param {Object} property * @return {Object} Value of the property. */ function getPropValue(property) { let value = property; if (typeof property === "object") { const keys = Object.keys(property); if (keys.includes("value")) { value = property.value; } else if (keys.includes("getterValue")) { value = property.getterValue; } } return value; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } if (object.class === "DeadObject") { return true; } return object.preview ? typeof object.preview.ownProperties !== "undefined" : typeof object.ownPropertyLength !== "undefined"; } const maxLengthMap = new Map(); maxLengthMap.set(MODE.SHORT, 3); maxLengthMap.set(MODE.LONG, 10); // Grip is used in propIterator and has to be defined here. const Grip = { rep: wrapRender(GripRep), supportsObject, maxLengthMap }; // Exports from this module module.exports = Grip; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { maybeEscapePropertyName } = __webpack_require__(2); const ArrayRep = __webpack_require__(38); const GripArrayRep = __webpack_require__(192); const GripMap = __webpack_require__(194); const GripMapEntryRep = __webpack_require__(195); const ErrorRep = __webpack_require__(191); const BigIntRep = __webpack_require__(188); const { isLongString } = __webpack_require__(25); const MAX_NUMERICAL_PROPERTIES = 100; const NODE_TYPES = { BUCKET: Symbol("[n…m]"), DEFAULT_PROPERTIES: Symbol(""), ENTRIES: Symbol(""), GET: Symbol(""), GRIP: Symbol("GRIP"), MAP_ENTRY_KEY: Symbol(""), MAP_ENTRY_VALUE: Symbol(""), PROMISE_REASON: Symbol(""), PROMISE_STATE: Symbol(""), PROMISE_VALUE: Symbol(""), PROXY_HANDLER: Symbol(""), PROXY_TARGET: Symbol(""), SET: Symbol(""), PROTOTYPE: Symbol(""), BLOCK: Symbol("☲") }; let WINDOW_PROPERTIES = {}; if (typeof window === "object") { WINDOW_PROPERTIES = Object.getOwnPropertyNames(window); } function getType(item) { return item.type; } function getValue(item) { if (nodeHasValue(item)) { return item.contents.value; } if (nodeHasGetterValue(item)) { return item.contents.getterValue; } if (nodeHasAccessors(item)) { return item.contents; } return undefined; } function getActor(item, roots) { const isRoot = isNodeRoot(item, roots); const value = getValue(item); return isRoot || !value ? null : value.actor; } function isNodeRoot(item, roots) { const gripItem = getClosestGripNode(item); const value = getValue(gripItem); return value && roots.some(root => { const rootValue = getValue(root); return rootValue && rootValue.actor === value.actor; }); } function nodeIsBucket(item) { return getType(item) === NODE_TYPES.BUCKET; } function nodeIsEntries(item) { return getType(item) === NODE_TYPES.ENTRIES; } function nodeIsMapEntry(item) { return GripMapEntryRep.supportsObject(getValue(item)); } function nodeHasChildren(item) { return Array.isArray(item.contents); } function nodeHasValue(item) { return item && item.contents && item.contents.hasOwnProperty("value"); } function nodeHasGetterValue(item) { return item && item.contents && item.contents.hasOwnProperty("getterValue"); } function nodeIsObject(item) { const value = getValue(item); return value && value.type === "object"; } function nodeIsArrayLike(item) { const value = getValue(item); return GripArrayRep.supportsObject(value) || ArrayRep.supportsObject(value); } function nodeIsFunction(item) { const value = getValue(item); return value && value.class === "Function"; } function nodeIsOptimizedOut(item) { const value = getValue(item); return !nodeHasChildren(item) && value && value.optimizedOut; } function nodeIsUninitializedBinding(item) { const value = getValue(item); return value && value.uninitialized; } // Used to check if an item represents a binding that exists in a sourcemap's // original file content, but does not match up with a binding found in the // generated code. function nodeIsUnmappedBinding(item) { const value = getValue(item); return value && value.unmapped; } // Used to check if an item represents a binding that exists in the debugger's // parser result, but does not match up with a binding returned by the // debugger server. function nodeIsUnscopedBinding(item) { const value = getValue(item); return value && value.unscoped; } function nodeIsMissingArguments(item) { const value = getValue(item); return !nodeHasChildren(item) && value && value.missingArguments; } function nodeHasProperties(item) { return !nodeHasChildren(item) && nodeIsObject(item); } function nodeIsPrimitive(item) { return nodeIsBigInt(item) || !nodeHasChildren(item) && !nodeHasProperties(item) && !nodeIsEntries(item) && !nodeIsMapEntry(item) && !nodeHasAccessors(item) && !nodeIsBucket(item) && !nodeIsLongString(item); } function nodeIsDefaultProperties(item) { return getType(item) === NODE_TYPES.DEFAULT_PROPERTIES; } function isDefaultWindowProperty(name) { return WINDOW_PROPERTIES.includes(name); } function nodeIsPromise(item) { const value = getValue(item); if (!value) { return false; } return value.class == "Promise"; } function nodeIsProxy(item) { const value = getValue(item); if (!value) { return false; } return value.class == "Proxy"; } function nodeIsPrototype(item) { return getType(item) === NODE_TYPES.PROTOTYPE; } function nodeIsWindow(item) { const value = getValue(item); if (!value) { return false; } return value.class == "Window"; } function nodeIsGetter(item) { return getType(item) === NODE_TYPES.GET; } function nodeIsSetter(item) { return getType(item) === NODE_TYPES.SET; } function nodeIsBlock(item) { return getType(item) === NODE_TYPES.BLOCK; } function nodeIsError(item) { return ErrorRep.supportsObject(getValue(item)); } function nodeIsLongString(item) { return isLongString(getValue(item)); } function nodeIsBigInt(item) { return BigIntRep.supportsObject(getValue(item)); } function nodeHasFullText(item) { const value = getValue(item); return nodeIsLongString(item) && value.hasOwnProperty("fullText"); } function nodeHasGetter(item) { const getter = getNodeGetter(item); return getter && getter.type !== "undefined"; } function nodeHasSetter(item) { const setter = getNodeSetter(item); return setter && setter.type !== "undefined"; } function nodeHasAccessors(item) { return nodeHasGetter(item) || nodeHasSetter(item); } function nodeSupportsNumericalBucketing(item) { // We exclude elements with entries since it's the node // itself that can have buckets. return nodeIsArrayLike(item) && !nodeHasEntries(item) || nodeIsEntries(item) || nodeIsBucket(item); } function nodeHasEntries(item) { const value = getValue(item); if (!value) { return false; } return value.class === "Map" || value.class === "Set" || value.class === "WeakMap" || value.class === "WeakSet" || value.class === "Storage"; } function nodeHasAllEntriesInPreview(item) { const { preview } = getValue(item) || {}; if (!preview) { return false; } const { entries, items, length, size } = preview; if (!entries && !items) { return false; } return entries ? entries.length === size : items.length === length; } function nodeNeedsNumericalBuckets(item) { return nodeSupportsNumericalBucketing(item) && getNumericalPropertiesCount(item) > MAX_NUMERICAL_PROPERTIES; } function makeNodesForPromiseProperties(item) { const { promiseState: { reason, value, state } } = getValue(item); const properties = []; if (state) { properties.push(createNode({ parent: item, name: "", contents: { value: state }, type: NODE_TYPES.PROMISE_STATE })); } if (reason) { properties.push(createNode({ parent: item, name: "", contents: { value: reason }, type: NODE_TYPES.PROMISE_REASON })); } if (value) { properties.push(createNode({ parent: item, name: "", contents: { value: value }, type: NODE_TYPES.PROMISE_VALUE })); } return properties; } function makeNodesForProxyProperties(item) { const { proxyHandler, proxyTarget } = getValue(item); return [createNode({ parent: item, name: "", contents: { value: proxyTarget }, type: NODE_TYPES.PROXY_TARGET }), createNode({ parent: item, name: "", contents: { value: proxyHandler }, type: NODE_TYPES.PROXY_HANDLER })]; } function makeNodesForEntries(item) { const nodeName = ""; const entriesPath = ""; if (nodeHasAllEntriesInPreview(item)) { let entriesNodes = []; const { preview } = getValue(item); if (preview.entries) { entriesNodes = preview.entries.map(([key, value], index) => { return createNode({ parent: item, name: index, path: `${entriesPath}/${index}`, contents: { value: GripMapEntryRep.createGripMapEntry(key, value) } }); }); } else if (preview.items) { entriesNodes = preview.items.map((value, index) => { return createNode({ parent: item, name: index, path: `${entriesPath}/${index}`, contents: { value } }); }); } return createNode({ parent: item, name: nodeName, contents: entriesNodes, type: NODE_TYPES.ENTRIES }); } return createNode({ parent: item, name: nodeName, contents: null, type: NODE_TYPES.ENTRIES }); } function makeNodesForMapEntry(item) { const nodeValue = getValue(item); if (!nodeValue || !nodeValue.preview) { return []; } const { key, value } = nodeValue.preview; return [createNode({ parent: item, name: "", contents: { value: key }, type: NODE_TYPES.MAP_ENTRY_KEY }), createNode({ parent: item, name: "", contents: { value }, type: NODE_TYPES.MAP_ENTRY_VALUE })]; } function getNodeGetter(item) { return item && item.contents ? item.contents.get : undefined; } function getNodeSetter(item) { return item && item.contents ? item.contents.set : undefined; } function sortProperties(properties) { return properties.sort((a, b) => { // Sort numbers in ascending order and sort strings lexicographically const aInt = parseInt(a, 10); const bInt = parseInt(b, 10); if (isNaN(aInt) || isNaN(bInt)) { return a > b ? 1 : -1; } return aInt - bInt; }); } function makeNumericalBuckets(parent) { const numProperties = getNumericalPropertiesCount(parent); // We want to have at most a hundred slices. const bucketSize = 10 ** Math.max(2, Math.ceil(Math.log10(numProperties)) - 2); const numBuckets = Math.ceil(numProperties / bucketSize); const buckets = []; for (let i = 1; i <= numBuckets; i++) { const minKey = (i - 1) * bucketSize; const maxKey = Math.min(i * bucketSize - 1, numProperties - 1); const startIndex = nodeIsBucket(parent) ? parent.meta.startIndex : 0; const minIndex = startIndex + minKey; const maxIndex = startIndex + maxKey; const bucketName = `[${minIndex}…${maxIndex}]`; buckets.push(createNode({ parent, name: bucketName, contents: null, type: NODE_TYPES.BUCKET, meta: { startIndex: minIndex, endIndex: maxIndex } })); } return buckets; } function makeDefaultPropsBucket(propertiesNames, parent, ownProperties) { const userPropertiesNames = []; const defaultProperties = []; propertiesNames.forEach(name => { if (isDefaultWindowProperty(name)) { defaultProperties.push(name); } else { userPropertiesNames.push(name); } }); const nodes = makeNodesForOwnProps(userPropertiesNames, parent, ownProperties); if (defaultProperties.length > 0) { const defaultPropertiesNode = createNode({ parent, name: "", contents: null, type: NODE_TYPES.DEFAULT_PROPERTIES }); const defaultNodes = defaultProperties.map((name, index) => createNode({ parent: defaultPropertiesNode, name: maybeEscapePropertyName(name), path: `${index}/${name}`, contents: ownProperties[name] })); nodes.push(setNodeChildren(defaultPropertiesNode, defaultNodes)); } return nodes; } function makeNodesForOwnProps(propertiesNames, parent, ownProperties) { return propertiesNames.map(name => createNode({ parent, name: maybeEscapePropertyName(name), contents: ownProperties[name] })); } function makeNodesForProperties(objProps, parent) { const { ownProperties = {}, ownSymbols, prototype, safeGetterValues } = objProps; const parentValue = getValue(parent); const allProperties = { ...ownProperties, ...safeGetterValues }; // Ignore properties that are neither non-concrete nor getters/setters. const propertiesNames = sortProperties(Object.keys(allProperties)).filter(name => { if (!allProperties[name]) { return false; } const properties = Object.getOwnPropertyNames(allProperties[name]); return properties.some(property => ["value", "getterValue", "get", "set"].includes(property)); }); let nodes = []; if (parentValue && parentValue.class == "Window") { nodes = makeDefaultPropsBucket(propertiesNames, parent, allProperties); } else { nodes = makeNodesForOwnProps(propertiesNames, parent, allProperties); } if (Array.isArray(ownSymbols)) { ownSymbols.forEach((ownSymbol, index) => { nodes.push(createNode({ parent, name: ownSymbol.name, path: `symbol-${index}`, contents: ownSymbol.descriptor || null })); }, this); } if (nodeIsPromise(parent)) { nodes.push(...makeNodesForPromiseProperties(parent)); } if (nodeHasEntries(parent)) { nodes.push(makeNodesForEntries(parent)); } // Add accessor nodes if needed for (const name of propertiesNames) { const property = allProperties[name]; if (property.get && property.get.type !== "undefined") { nodes.push(createGetterNode({ parent, property, name })); } if (property.set && property.set.type !== "undefined") { nodes.push(createSetterNode({ parent, property, name })); } } // Add the prototype if it exists and is not null if (prototype && prototype.type !== "null") { nodes.push(makeNodeForPrototype(objProps, parent)); } return nodes; } function setNodeFullText(loadedProps, node) { if (nodeHasFullText(node) || !nodeIsLongString(node)) { return node; } const { fullText } = loadedProps; if (nodeHasValue(node)) { node.contents.value.fullText = fullText; } else if (nodeHasGetterValue(node)) { node.contents.getterValue.fullText = fullText; } return node; } function makeNodeForPrototype(objProps, parent) { const { prototype } = objProps || {}; // Add the prototype if it exists and is not null if (prototype && prototype.type !== "null") { return createNode({ parent, name: "", contents: { value: prototype }, type: NODE_TYPES.PROTOTYPE }); } return null; } function createNode(options) { const { parent, name, path, contents, type = NODE_TYPES.GRIP, meta } = options; if (contents === undefined) { return null; } // The path is important to uniquely identify the item in the entire // tree. This helps debugging & optimizes React's rendering of large // lists. The path will be separated by property name, wrapped in a Symbol // to avoid name clashing, // i.e. `{ foo: { bar: { baz: 5 }}}` will have a path of Symbol(`foo/bar/baz`) // for the inner object. return { parent, name, path: parent ? Symbol(`${getSymbolDescriptor(parent.path)}/${path || name}`) : Symbol(path || name), contents, type, meta }; } function createGetterNode({ parent, property, name }) { return createNode({ parent, name: ``, contents: { value: property.get }, type: NODE_TYPES.GET }); } function createSetterNode({ parent, property, name }) { return createNode({ parent, name: ``, contents: { value: property.set }, type: NODE_TYPES.SET }); } function getSymbolDescriptor(symbol) { return symbol.toString().replace(/^(Symbol\()(.*)(\))$/, "$2"); } function setNodeChildren(node, children) { node.contents = children; return node; } function getEvaluatedItem(item, evaluations) { if (!evaluations.has(item.path)) { return item; } return { ...item, contents: evaluations.get(item.path) }; } function getChildrenWithEvaluations(options) { const { item, loadedProperties, cachedNodes, evaluations } = options; const children = getChildren({ loadedProperties, cachedNodes, item }); if (Array.isArray(children)) { return children.map(i => getEvaluatedItem(i, evaluations)); } if (children) { return getEvaluatedItem(children, evaluations); } return []; } function getChildren(options) { const { cachedNodes, item, loadedProperties = new Map() } = options; const key = item.path; if (cachedNodes && cachedNodes.has(key)) { return cachedNodes.get(key); } const loadedProps = loadedProperties.get(key); const hasLoadedProps = loadedProperties.has(key); // Because we are dynamically creating the tree as the user // expands it (not precalculated tree structure), we cache child // arrays. This not only helps performance, but is necessary // because the expanded state depends on instances of nodes // being the same across renders. If we didn't do this, each // node would be a new instance every render. // If the node needs properties, we only add children to // the cache if the properties are loaded. const addToCache = children => { if (cachedNodes) { cachedNodes.set(item.path, children); } return children; }; // Nodes can either have children already, or be an object with // properties that we need to go and fetch. if (nodeHasChildren(item)) { return addToCache(item.contents); } if (nodeIsMapEntry(item)) { return addToCache(makeNodesForMapEntry(item)); } if (nodeIsProxy(item)) { return addToCache(makeNodesForProxyProperties(item)); } if (nodeIsLongString(item) && hasLoadedProps) { // Set longString object's fullText to fetched one. return addToCache(setNodeFullText(loadedProps, item)); } if (nodeNeedsNumericalBuckets(item) && hasLoadedProps) { // Even if we have numerical buckets, we should have loaded non indexed // properties. const bucketNodes = makeNumericalBuckets(item); return addToCache(bucketNodes.concat(makeNodesForProperties(loadedProps, item))); } if (!nodeIsEntries(item) && !nodeIsBucket(item) && !nodeHasProperties(item)) { return []; } if (!hasLoadedProps) { return []; } return addToCache(makeNodesForProperties(loadedProps, item)); } function getParent(item) { return item.parent; } function getNumericalPropertiesCount(item) { if (nodeIsBucket(item)) { return item.meta.endIndex - item.meta.startIndex + 1; } const value = getValue(getClosestGripNode(item)); if (!value) { return 0; } if (GripArrayRep.supportsObject(value)) { return GripArrayRep.getLength(value); } if (GripMap.supportsObject(value)) { return GripMap.getLength(value); } // TODO: We can also have numerical properties on Objects, but at the // moment we don't have a way to distinguish them from non-indexed properties, // as they are all computed in a ownPropertiesLength property. return 0; } function getClosestGripNode(item) { const type = getType(item); if (type !== NODE_TYPES.BUCKET && type !== NODE_TYPES.DEFAULT_PROPERTIES && type !== NODE_TYPES.ENTRIES) { return item; } const parent = getParent(item); if (!parent) { return null; } return getClosestGripNode(parent); } function getClosestNonBucketNode(item) { const type = getType(item); if (type !== NODE_TYPES.BUCKET) { return item; } const parent = getParent(item); if (!parent) { return null; } return getClosestNonBucketNode(parent); } function getParentGripNode(item) { const parentNode = getParent(item); if (!parentNode) { return null; } return getClosestGripNode(parentNode); } function getParentGripValue(item) { const parentGripNode = getParentGripNode(item); if (!parentGripNode) { return null; } return getValue(parentGripNode); } function getNonPrototypeParentGripValue(item) { const parentGripNode = getParentGripNode(item); if (!parentGripNode) { return null; } if (getType(parentGripNode) === NODE_TYPES.PROTOTYPE) { return getNonPrototypeParentGripValue(parentGripNode); } return getValue(parentGripNode); } module.exports = { createNode, createGetterNode, createSetterNode, getActor, getChildren, getChildrenWithEvaluations, getClosestGripNode, getClosestNonBucketNode, getParent, getParentGripValue, getNonPrototypeParentGripValue, getNumericalPropertiesCount, getValue, makeNodesForEntries, makeNodesForPromiseProperties, makeNodesForProperties, makeNumericalBuckets, nodeHasAccessors, nodeHasAllEntriesInPreview, nodeHasChildren, nodeHasEntries, nodeHasProperties, nodeHasGetter, nodeHasSetter, nodeIsBlock, nodeIsBucket, nodeIsDefaultProperties, nodeIsEntries, nodeIsError, nodeIsLongString, nodeHasFullText, nodeIsFunction, nodeIsGetter, nodeIsMapEntry, nodeIsMissingArguments, nodeIsObject, nodeIsOptimizedOut, nodeIsPrimitive, nodeIsPromise, nodeIsPrototype, nodeIsProxy, nodeIsSetter, nodeIsUninitializedBinding, nodeIsUnmappedBinding, nodeIsUnscopedBinding, nodeIsWindow, nodeNeedsNumericalBuckets, nodeSupportsNumericalBucketing, setNodeChildren, sortProperties, NODE_TYPES }; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function initialState() { return { expandedPaths: new Set(), loadedProperties: new Map(), evaluations: new Map(), actors: new Set() }; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function reducer(state = initialState(), action = {}) { const { type, data } = action; const cloneState = overrides => ({ ...state, ...overrides }); if (type === "NODE_EXPAND") { return cloneState({ expandedPaths: new Set(state.expandedPaths).add(data.node.path) }); } if (type === "NODE_COLLAPSE") { const expandedPaths = new Set(state.expandedPaths); expandedPaths.delete(data.node.path); return cloneState({ expandedPaths }); } if (type === "NODE_PROPERTIES_LOADED") { return cloneState({ actors: data.actor ? new Set(state.actors || []).add(data.actor) : state.actors, loadedProperties: new Map(state.loadedProperties).set(data.node.path, action.data.properties) }); } if (type === "ROOTS_CHANGED") { return cloneState(); } if (type === "GETTER_INVOKED") { return cloneState({ actors: data.actor ? new Set(state.actors || []).add(data.result.from) : state.actors, evaluations: new Map(state.evaluations).set(data.node.path, { getterValue: data.result && data.result.value && (data.result.value.return || data.result.value.throw) }) }); } // NOTE: we clear the state on resume because otherwise the scopes pane // would be out of date. Bug 1514760 if (type === "RESUME" || type == "NAVIGATE") { return initialState(); } return state; } function getObjectInspectorState(state) { return state.objectInspector; } function getExpandedPaths(state) { return getObjectInspectorState(state).expandedPaths; } function getExpandedPathKeys(state) { return [...getExpandedPaths(state).keys()]; } function getActors(state) { return getObjectInspectorState(state).actors; } function getLoadedProperties(state) { return getObjectInspectorState(state).loadedProperties; } function getLoadedPropertyKeys(state) { return [...getLoadedProperties(state).keys()]; } function getEvaluations(state) { return getObjectInspectorState(state).evaluations; } const selectors = { getActors, getEvaluations, getExpandedPathKeys, getExpandedPaths, getLoadedProperties, getLoadedPropertyKeys }; Object.defineProperty(module.exports, "__esModule", { value: true }); module.exports = selectors; module.exports.default = reducer; /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const client = __webpack_require__(197); const loadProperties = __webpack_require__(196); const node = __webpack_require__(114); const { nodeIsError, nodeIsPrimitive } = node; const selection = __webpack_require__(488); const { MODE } = __webpack_require__(4); const { REPS: { Rep, Grip } } = __webpack_require__(24); function shouldRenderRootsInReps(roots) { if (roots.length > 1) { return false; } const root = roots[0]; const name = root && root.name; return (name === null || typeof name === "undefined") && (nodeIsPrimitive(root) || nodeIsError(root)); } function renderRep(item, props) { return Rep({ ...props, object: node.getValue(item), mode: props.mode || MODE.TINY, defaultRep: Grip }); } module.exports = { client, loadProperties, node, renderRep, selection, shouldRenderRootsInReps }; /***/ }), /* 117 */, /* 118 */, /* 119 */, /* 120 */, /* 121 */, /* 122 */, /* 123 */, /* 124 */, /* 125 */, /* 126 */, /* 127 */, /* 128 */, /* 129 */, /* 130 */, /* 131 */, /* 132 */, /* 133 */, /* 134 */, /* 135 */, /* 136 */, /* 137 */, /* 138 */, /* 139 */, /* 140 */, /* 141 */, /* 142 */, /* 143 */, /* 144 */, /* 145 */, /* 146 */, /* 147 */, /* 148 */, /* 149 */, /* 150 */, /* 151 */, /* 152 */, /* 153 */, /* 154 */, /* 155 */, /* 156 */, /* 157 */, /* 158 */, /* 159 */, /* 160 */, /* 161 */, /* 162 */, /* 163 */, /* 164 */, /* 165 */, /* 166 */, /* 167 */, /* 168 */, /* 169 */, /* 170 */, /* 171 */, /* 172 */, /* 173 */, /* 174 */, /* 175 */, /* 176 */, /* 177 */, /* 178 */, /* 179 */, /* 180 */, /* 181 */, /* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stopSourceMapWorker = exports.startSourceMapWorker = exports.isOriginalId = exports.isGeneratedId = exports.generatedToOriginalId = exports.originalToGeneratedId = exports.getOriginalStackFrames = exports.hasMappedSource = exports.clearSourceMaps = exports.applySourceMap = exports.getOriginalSourceText = exports.getLocationScopes = exports.getFileGeneratedRange = exports.getGeneratedRangesForOriginal = exports.getOriginalLocations = exports.getOriginalLocation = exports.getAllGeneratedLocations = exports.getGeneratedLocation = exports.getGeneratedRanges = exports.getOriginalRanges = exports.hasOriginalURL = exports.getOriginalURLs = exports.setAssetRootURL = exports.dispatcher = undefined; var _utils = __webpack_require__(64); Object.defineProperty(exports, "originalToGeneratedId", { enumerable: true, get: function () { return _utils.originalToGeneratedId; } }); Object.defineProperty(exports, "generatedToOriginalId", { enumerable: true, get: function () { return _utils.generatedToOriginalId; } }); Object.defineProperty(exports, "isGeneratedId", { enumerable: true, get: function () { return _utils.isGeneratedId; } }); Object.defineProperty(exports, "isOriginalId", { enumerable: true, get: function () { return _utils.isOriginalId; } }); var _devtoolsSourceMap = __webpack_require__(182); var self = _interopRequireWildcard(_devtoolsSourceMap); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { workerUtils: { WorkerDispatcher } } = __webpack_require__(7); const dispatcher = exports.dispatcher = new WorkerDispatcher(); const _getGeneratedRanges = dispatcher.task("getGeneratedRanges", { queue: true }); const _getGeneratedLocation = dispatcher.task("getGeneratedLocation", { queue: true }); const _getAllGeneratedLocations = dispatcher.task("getAllGeneratedLocations", { queue: true }); const _getOriginalLocation = dispatcher.task("getOriginalLocation", { queue: true }); const setAssetRootURL = exports.setAssetRootURL = async assetRoot => dispatcher.invoke("setAssetRootURL", assetRoot); const getOriginalURLs = exports.getOriginalURLs = async generatedSource => dispatcher.invoke("getOriginalURLs", generatedSource); const hasOriginalURL = exports.hasOriginalURL = async url => dispatcher.invoke("hasOriginalURL", url); const getOriginalRanges = exports.getOriginalRanges = async (sourceId, url) => dispatcher.invoke("getOriginalRanges", sourceId, url); const getGeneratedRanges = exports.getGeneratedRanges = async (location, originalSource) => _getGeneratedRanges(location, originalSource); const getGeneratedLocation = exports.getGeneratedLocation = async (location, originalSource) => _getGeneratedLocation(location, originalSource); const getAllGeneratedLocations = exports.getAllGeneratedLocations = async (location, originalSource) => _getAllGeneratedLocations(location, originalSource); const getOriginalLocation = exports.getOriginalLocation = async (location, options = {}) => _getOriginalLocation(location, options); const getOriginalLocations = exports.getOriginalLocations = async (sourceId, locations, options = {}) => dispatcher.invoke("getOriginalLocations", locations, options); const getGeneratedRangesForOriginal = exports.getGeneratedRangesForOriginal = async (sourceId, url, mergeUnmappedRegions) => dispatcher.invoke("getGeneratedRangesForOriginal", sourceId, url, mergeUnmappedRegions); const getFileGeneratedRange = exports.getFileGeneratedRange = async originalSource => dispatcher.invoke("getFileGeneratedRange", originalSource); const getLocationScopes = exports.getLocationScopes = dispatcher.task("getLocationScopes"); const getOriginalSourceText = exports.getOriginalSourceText = async originalSource => dispatcher.invoke("getOriginalSourceText", originalSource); const applySourceMap = exports.applySourceMap = async (generatedId, url, code, mappings) => dispatcher.invoke("applySourceMap", generatedId, url, code, mappings); const clearSourceMaps = exports.clearSourceMaps = async () => dispatcher.invoke("clearSourceMaps"); const hasMappedSource = exports.hasMappedSource = async location => dispatcher.invoke("hasMappedSource", location); const getOriginalStackFrames = exports.getOriginalStackFrames = async generatedLocation => dispatcher.invoke("getOriginalStackFrames", generatedLocation); const startSourceMapWorker = exports.startSourceMapWorker = (url, assetRoot) => { dispatcher.start(url); setAssetRootURL(assetRoot); }; const stopSourceMapWorker = exports.stopSourceMapWorker = dispatcher.stop.bind(dispatcher); exports.default = self; /***/ }), /* 183 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const Menu = __webpack_require__(421); const MenuItem = __webpack_require__(423); const { PrefsHelper } = __webpack_require__(424); const KeyShortcuts = __webpack_require__(425); const { ZoomKeys } = __webpack_require__(426); const EventEmitter = __webpack_require__(65); const asyncStorage = __webpack_require__(427); const SourceUtils = __webpack_require__(428); const Telemetry = __webpack_require__(429); const { getUnicodeHostname, getUnicodeUrlPath, getUnicodeUrl } = __webpack_require__(430); module.exports = { KeyShortcuts, Menu, MenuItem, PrefsHelper, ZoomKeys, asyncStorage, EventEmitter, SourceUtils, Telemetry, getUnicodeHostname, getUnicodeUrlPath, getUnicodeUrl }; /***/ }), /* 184 */ /***/ (function(module, exports, __webpack_require__) { (function() { var Query, coreChars, countDir, getCharCodes, getExtension, opt_char_re, truncatedUpperCase, _ref; _ref = __webpack_require__(111), countDir = _ref.countDir, getExtension = _ref.getExtension; module.exports = Query = (function() { function Query(query, _arg) { var optCharRegEx, pathSeparator, _ref1; _ref1 = _arg != null ? _arg : {}, optCharRegEx = _ref1.optCharRegEx, pathSeparator = _ref1.pathSeparator; if (!(query && query.length)) { return null; } this.query = query; this.query_lw = query.toLowerCase(); this.core = coreChars(query, optCharRegEx); this.core_lw = this.core.toLowerCase(); this.core_up = truncatedUpperCase(this.core); this.depth = countDir(query, query.length, pathSeparator); this.ext = getExtension(this.query_lw); this.charCodes = getCharCodes(this.query_lw); } return Query; })(); opt_char_re = /[ _\-:\/\\]/g; coreChars = function(query, optCharRegEx) { if (optCharRegEx == null) { optCharRegEx = opt_char_re; } return query.replace(optCharRegEx, ''); }; truncatedUpperCase = function(str) { var char, upper, _i, _len; upper = ""; for (_i = 0, _len = str.length; _i < _len; _i++) { char = str[_i]; upper += char.toUpperCase()[0]; } return upper; }; getCharCodes = function(str) { var charCodes, i, len; len = str.length; i = -1; charCodes = []; while (++i < len) { charCodes[str.charCodeAt(i)] = true; } return charCodes; }; }).call(this); /***/ }), /* 185 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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 _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); var _tab = __webpack_require__(186); var _tab2 = _interopRequireDefault(_tab); var _tabList = __webpack_require__(441); var _tabList2 = _interopRequireDefault(_tabList); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var TabList = function (_React$Component) { _inherits(TabList, _React$Component); function TabList(props) { _classCallCheck(this, TabList); var _this = _possibleConstructorReturn(this, (TabList.__proto__ || Object.getPrototypeOf(TabList)).call(this, props)); var childrenCount = _react2.default.Children.count(props.children); _this.handleKeyPress = _this.handleKeyPress.bind(_this); _this.tabRefs = new Array(childrenCount).fill(0).map(function () { return _react2.default.createRef(); }); _this.handlers = _this.getHandlers(props.vertical); return _this; } _createClass(TabList, [{ key: 'componentDidUpdate', value: function componentDidUpdate(prevProps) { if (prevProps.activeIndex !== this.props.activeIndex) { this.tabRefs[this.props.activeIndex].current.focus(); } } }, { key: 'getHandlers', value: function getHandlers(vertical) { if (vertical) { return { ArrowDown: this.next.bind(this), ArrowUp: this.previous.bind(this) }; } return { ArrowLeft: this.previous.bind(this), ArrowRight: this.next.bind(this) }; } }, { key: 'wrapIndex', value: function wrapIndex(index) { var count = _react2.default.Children.count(this.props.children); return (index + count) % count; } }, { key: 'handleKeyPress', value: function handleKeyPress(event) { var handler = this.handlers[event.key]; if (handler) { handler(); } } }, { key: 'previous', value: function previous() { var newIndex = this.wrapIndex(this.props.activeIndex - 1); this.props.onActivateTab(newIndex); } }, { key: 'next', value: function next() { var newIndex = this.wrapIndex(this.props.activeIndex + 1); this.props.onActivateTab(newIndex); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, accessibleId = _props.accessibleId, activeIndex = _props.activeIndex, children = _props.children, className = _props.className, onActivateTab = _props.onActivateTab; return _react2.default.createElement( 'ul', { className: className, onKeyUp: this.handleKeyPress, role: 'tablist' }, _react2.default.Children.map(children, function (child, index) { if (child.type !== _tab2.default) { throw new Error('Direct children of a must be a '); } var active = index === activeIndex; var tabRef = _this2.tabRefs[index]; return _react2.default.cloneElement(child, { accessibleId: active ? accessibleId : undefined, active: active, tabRef: tabRef, onActivate: function onActivate() { return onActivateTab(index); } }); }) ); } }]); return TabList; }(_react2.default.Component); exports.default = TabList; TabList.propTypes = { accessibleId: _propTypes2.default.string, activeIndex: _propTypes2.default.number, children: _propTypes2.default.node, className: _propTypes2.default.string, onActivateTab: _propTypes2.default.func, vertical: _propTypes2.default.bool }; TabList.defaultProps = { accessibleId: undefined, activeIndex: 0, children: null, className: _tabList2.default.container, onActivateTab: function onActivateTab() {}, vertical: false }; /***/ }), /* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Tab; var _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); var _ref2 = __webpack_require__(439); var _ref3 = _interopRequireDefault(_ref2); var _tab = __webpack_require__(440); var _tab2 = _interopRequireDefault(_tab); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function Tab(_ref) { var accessibleId = _ref.accessibleId, active = _ref.active, children = _ref.children, className = _ref.className, onActivate = _ref.onActivate, tabRef = _ref.tabRef; return _react2.default.createElement( 'li', { 'aria-selected': active, className: className, id: accessibleId, onClick: onActivate, onKeyDown: function onKeyDown() {}, ref: tabRef, role: 'tab', tabIndex: active ? 0 : undefined }, children ); } Tab.propTypes = { accessibleId: _propTypes2.default.string, active: _propTypes2.default.bool, children: _propTypes2.default.node.isRequired, className: _propTypes2.default.string, onActivate: _propTypes2.default.func, tabRef: _ref3.default }; Tab.defaultProps = { accessibleId: undefined, active: false, className: _tab2.default.container, onActivate: undefined, tabRef: undefined }; /***/ }), /* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = TabPanels; var _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function TabPanels(_ref) { var accessibleId = _ref.accessibleId, activeIndex = _ref.activeIndex, children = _ref.children, className = _ref.className, hasFocusableContent = _ref.hasFocusableContent; return _react2.default.createElement( 'div', { 'aria-labelledby': accessibleId, role: 'tabpanel', className: className, tabIndex: hasFocusableContent ? undefined : 0 }, _react2.default.Children.toArray(children)[activeIndex] ); } TabPanels.propTypes = { accessibleId: _propTypes2.default.string, activeIndex: _propTypes2.default.number, children: _propTypes2.default.node.isRequired, className: _propTypes2.default.string, hasFocusableContent: _propTypes2.default.bool.isRequired }; TabPanels.defaultProps = { accessibleId: undefined, activeIndex: 0, className: null }; /***/ }), /* 188 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a number */ BigInt.propTypes = { object: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.bool]).isRequired }; function BigInt(props) { const { text } = props.object; return span({ className: "objectBox objectBox-number" }, `${text}n`); } function supportsObject(object, noGrip = false) { return getGripType(object, noGrip) === "BigInt"; } // Exports from this module module.exports = { rep: wrapRender(BigInt), supportsObject }; /***/ }), /* 189 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, cropString, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; const IGNORED_SOURCE_URLS = ["debugger eval code"]; /** * This component represents a template for Function objects. */ FunctionRep.propTypes = { object: PropTypes.object.isRequired, parameterNames: PropTypes.array, onViewSourceInDebugger: PropTypes.func }; function FunctionRep(props) { const { object: grip, onViewSourceInDebugger, recordTelemetryEvent } = props; let jumpToDefinitionButton; if (onViewSourceInDebugger && grip.location && grip.location.url && !IGNORED_SOURCE_URLS.includes(grip.location.url)) { jumpToDefinitionButton = dom.button({ className: "jump-definition", draggable: false, title: "Jump to definition", onClick: e => { // Stop the event propagation so we don't trigger ObjectInspector // expand/collapse. e.stopPropagation(); if (recordTelemetryEvent) { recordTelemetryEvent("jump_to_definition"); } onViewSourceInDebugger(grip.location); } }); } return span({ "data-link-actor-id": grip.actor, className: "objectBox objectBox-function", // Set dir="ltr" to prevent function parentheses from // appearing in the wrong direction dir: "ltr" }, getTitle(grip, props), getFunctionName(grip, props), "(", ...renderParams(props), ")", jumpToDefinitionButton); } function getTitle(grip, props) { const { mode } = props; if (mode === MODE.TINY && !grip.isGenerator && !grip.isAsync) { return null; } let title = mode === MODE.TINY ? "" : "function "; if (grip.isGenerator) { title = mode === MODE.TINY ? "* " : "function* "; } if (grip.isAsync) { title = `${"async" + " "}${title}`; } return span({ className: "objectTitle" }, title); } /** * Returns a ReactElement representing the function name. * * @param {Object} grip : Function grip * @param {Object} props: Function rep props */ function getFunctionName(grip, props = {}) { let { functionName } = props; let name; if (functionName) { const end = functionName.length - 1; functionName = functionName.startsWith('"') && functionName.endsWith('"') ? functionName.substring(1, end) : functionName; } if (grip.displayName != undefined && functionName != undefined && grip.displayName != functionName) { name = `${functionName}:${grip.displayName}`; } else { name = cleanFunctionName(grip.userDisplayName || grip.displayName || grip.name || props.functionName || ""); } return cropString(name, 100); } const objectProperty = /([\w\d\$]+)$/; const arrayProperty = /\[(.*?)\]$/; const functionProperty = /([\w\d]+)[\/\.<]*?$/; const annonymousProperty = /([\w\d]+)\(\^\)$/; /** * Decodes an anonymous naming scheme that * spider monkey implements based on "Naming Anonymous JavaScript Functions" * http://johnjbarton.github.io/nonymous/index.html * * @param {String} name : Function name to clean up * @returns String */ function cleanFunctionName(name) { for (const reg of [objectProperty, arrayProperty, functionProperty, annonymousProperty]) { const match = reg.exec(name); if (match) { return match[1]; } } return name; } function renderParams(props) { const { parameterNames = [] } = props; return parameterNames.filter(param => param).reduce((res, param, index, arr) => { res.push(span({ className: "param" }, param)); if (index < arr.length - 1) { res.push(span({ className: "delimiter" }, ", ")); } return res; }, []); } // Registration function supportsObject(grip, noGrip = false) { const type = getGripType(grip, noGrip); if (noGrip === true || !isGrip(grip)) { return type == "function"; } return type == "Function"; } // Exports from this module module.exports = { rep: wrapRender(FunctionRep), supportsObject, cleanFunctionName, // exported for testing purpose. getFunctionName }; /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ module.exports = { ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12, // DocumentPosition DOCUMENT_POSITION_DISCONNECTED: 0x01, DOCUMENT_POSITION_PRECEDING: 0x02, DOCUMENT_POSITION_FOLLOWING: 0x04, DOCUMENT_POSITION_CONTAINS: 0x08, DOCUMENT_POSITION_CONTAINED_BY: 0x10, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 0x20 }; /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Utils const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const { cleanFunctionName } = __webpack_require__(189); const { isLongString } = __webpack_require__(25); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; const IGNORED_SOURCE_URLS = ["debugger eval code"]; /** * Renders Error objects. */ ErrorRep.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), // An optional function that will be used to render the Error stacktrace. renderStacktrace: PropTypes.func }; function ErrorRep(props) { const object = props.object; const preview = object.preview; let name; if (preview && preview.name && preview.kind) { switch (preview.kind) { case "Error": name = preview.name; break; case "DOMException": name = preview.kind; break; default: throw new Error("Unknown preview kind for the Error rep."); } } else { name = "Error"; } const content = []; if (props.mode === MODE.TINY) { content.push(name); } else { content.push(`${name}: "${preview.message}"`); } if (preview.stack && props.mode !== MODE.TINY) { const stacktrace = props.renderStacktrace ? props.renderStacktrace(parseStackString(preview.stack)) : getStacktraceElements(props, preview); content.push(stacktrace); } return span({ "data-link-actor-id": object.actor, className: "objectBox-stackTrace" }, content); } /** * Returns a React element reprensenting the Error stacktrace, i.e. * transform error.stack from: * * semicolon@debugger eval code:1:109 * jkl@debugger eval code:1:63 * asdf@debugger eval code:1:28 * @debugger eval code:1:227 * * Into a column layout: * * semicolon (:8:10) * jkl (:5:10) * asdf (:2:10) * (:11:1) */ function getStacktraceElements(props, preview) { const stack = []; if (!preview.stack) { return stack; } parseStackString(preview.stack).forEach((frame, index, frames) => { let onLocationClick; const { filename, lineNumber, columnNumber, functionName, location } = frame; if (props.onViewSourceInDebugger && !IGNORED_SOURCE_URLS.includes(filename)) { onLocationClick = e => { // Don't trigger ObjectInspector expand/collapse. e.stopPropagation(); props.onViewSourceInDebugger({ url: filename, line: lineNumber, column: columnNumber }); }; } stack.push("\t", span({ key: `fn${index}`, className: "objectBox-stackTrace-fn" }, cleanFunctionName(functionName)), " ", span({ key: `location${index}`, className: "objectBox-stackTrace-location", onClick: onLocationClick, title: onLocationClick ? `View source in debugger → ${location}` : undefined }, location), "\n"); }); return span({ key: "stack", className: "objectBox-stackTrace-grid" }, stack); } /** * Parse a string that should represent a stack trace and returns an array of * the frames. The shape of the frames are extremely important as they can then * be processed here or in the toolbox by other components. * @param {String} stack * @returns {Array} Array of frames, which are object with the following shape: * - {String} filename * - {String} functionName * - {String} location * - {Number} columnNumber * - {Number} lineNumber */ function parseStackString(stack) { const res = []; if (!stack) { return res; } const isStacktraceALongString = isLongString(stack); const stackString = isStacktraceALongString ? stack.initial : stack; stackString.split("\n").forEach((frame, index, frames) => { if (!frame) { // Skip any blank lines return; } // If the stacktrace is a longString, don't include the last frame in the // array, since it is certainly incomplete. // Can be removed when https://bugzilla.mozilla.org/show_bug.cgi?id=1448833 // is fixed. if (isStacktraceALongString && index === frames.length - 1) { return; } let functionName; let location; // Given the input: "functionName@scriptLocation:2:100" // Result: [ // "functionName@scriptLocation:2:100", // "functionName", // "scriptLocation:2:100" // ] const result = frame.match(/^(.*)@(.*)$/); if (result && result.length === 3) { functionName = result[1]; // If the resource was loaded by base-loader.js, the location looks like: // resource://devtools/shared/base-loader.js -> resource://path/to/file.js . // What's needed is only the last part after " -> ". location = result[2].split(" -> ").pop(); } if (!functionName) { functionName = ""; } // Given the input: "scriptLocation:2:100" // Result: // ["scriptLocation:2:100", "scriptLocation", "2", "100"] const locationParts = location ? location.match(/^(.*):(\d+):(\d+)$/) : null; if (location && locationParts) { const [, filename, line, column] = locationParts; res.push({ filename, functionName, location, columnNumber: Number(column), lineNumber: Number(line) }); } }); return res; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return object.preview && getGripType(object, noGrip) === "Error" || object.class === "DOMException"; } // Exports from this module module.exports = { rep: wrapRender(ErrorRep), supportsObject }; /***/ }), /* 192 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { lengthBubble } = __webpack_require__(193); const { interleave, getGripType, isGrip, wrapRender, ellipsisElement } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; const { ModePropType } = __webpack_require__(38); const DEFAULT_TITLE = "Array"; /** * Renders an array. The array is enclosed by left and right bracket * and the max number of rendered items depends on the current mode. */ GripArray.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: ModePropType, provider: PropTypes.object, onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function GripArray(props) { const { object, mode = MODE.SHORT } = props; let brackets; const needSpace = function (space) { return space ? { left: "[ ", right: " ]" } : { left: "[", right: "]" }; }; const config = { "data-link-actor-id": object.actor, className: "objectBox objectBox-array" }; const title = getTitle(props, object); if (mode === MODE.TINY) { const isEmpty = getLength(object) === 0; // Omit bracketed ellipsis for non-empty non-Array arraylikes (f.e: Sets). if (!isEmpty && object.class !== "Array") { return span(config, title); } brackets = needSpace(false); return span(config, title, span({ className: "arrayLeftBracket" }, brackets.left), isEmpty ? null : ellipsisElement, span({ className: "arrayRightBracket" }, brackets.right)); } const max = maxLengthMap.get(mode); const items = arrayIterator(props, object, max); brackets = needSpace(items.length > 0); return span({ "data-link-actor-id": object.actor, className: "objectBox objectBox-array" }, title, span({ className: "arrayLeftBracket" }, brackets.left), ...interleave(items, ", "), span({ className: "arrayRightBracket" }, brackets.right), span({ className: "arrayProperties", role: "group" })); } function getLength(grip) { if (!grip.preview) { return 0; } return grip.preview.length || grip.preview.childNodesLength || 0; } function getTitle(props, object) { const objectLength = getLength(object); const isEmpty = objectLength === 0; let title = props.title || object.class || DEFAULT_TITLE; const length = lengthBubble({ object, mode: props.mode, maxLengthMap, getLength }); if (props.mode === MODE.TINY) { if (isEmpty) { if (object.class === DEFAULT_TITLE) { return null; } return span({ className: "objectTitle" }, `${title} `); } let trailingSpace; if (object.class === DEFAULT_TITLE) { title = null; trailingSpace = " "; } return span({ className: "objectTitle" }, title, length, trailingSpace); } return span({ className: "objectTitle" }, title, length, " "); } function getPreviewItems(grip) { if (!grip.preview) { return null; } return grip.preview.items || grip.preview.childNodes || []; } function arrayIterator(props, grip, max) { const { Rep } = __webpack_require__(24); let items = []; const gripLength = getLength(grip); if (!gripLength) { return items; } const previewItems = getPreviewItems(grip); const provider = props.provider; let emptySlots = 0; let foldedEmptySlots = 0; items = previewItems.reduce((res, itemGrip) => { if (res.length >= max) { return res; } let object; try { if (!provider && itemGrip === null) { emptySlots++; return res; } object = provider ? provider.getValue(itemGrip) : itemGrip; } catch (exc) { object = exc; } if (emptySlots > 0) { res.push(getEmptySlotsElement(emptySlots)); foldedEmptySlots = foldedEmptySlots + emptySlots - 1; emptySlots = 0; } if (res.length < max) { res.push(Rep({ ...props, object, mode: MODE.TINY, // Do not propagate title to array items reps title: undefined })); } return res; }, []); // Handle trailing empty slots if there are some. if (items.length < max && emptySlots > 0) { items.push(getEmptySlotsElement(emptySlots)); foldedEmptySlots = foldedEmptySlots + emptySlots - 1; } const itemsShown = items.length + foldedEmptySlots; if (gripLength > itemsShown) { items.push(ellipsisElement); } return items; } function getEmptySlotsElement(number) { // TODO: Use l10N - See https://github.com/firefox-devtools/reps/issues/141 return `<${number} empty slot${number > 1 ? "s" : ""}>`; } function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && (grip.preview.kind == "ArrayLike" || getGripType(grip, noGrip) === "DocumentFragment"); } const maxLengthMap = new Map(); maxLengthMap.set(MODE.SHORT, 3); maxLengthMap.set(MODE.LONG, 10); // Exports from this module module.exports = { rep: wrapRender(GripArray), supportsObject, maxLengthMap, getLength }; /***/ }), /* 193 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const PropTypes = __webpack_require__(0); const { wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const { ModePropType } = __webpack_require__(38); const dom = __webpack_require__(1); const { span } = dom; GripLengthBubble.propTypes = { object: PropTypes.object.isRequired, maxLengthMap: PropTypes.instanceOf(Map).isRequired, getLength: PropTypes.func.isRequired, mode: ModePropType, visibilityThreshold: PropTypes.number }; function GripLengthBubble(props) { const { object, mode = MODE.SHORT, visibilityThreshold = 2, maxLengthMap, getLength, showZeroLength = false } = props; const length = getLength(object); const isEmpty = length === 0; const isObvious = [MODE.SHORT, MODE.LONG].includes(mode) && length > 0 && length <= maxLengthMap.get(mode) && length <= visibilityThreshold; if (isEmpty && !showZeroLength || isObvious) { return ""; } return span({ className: "objectLengthBubble" }, `(${length})`); } module.exports = { lengthBubble: wrapRender(GripLengthBubble) }; /***/ }), /* 194 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const { lengthBubble } = __webpack_require__(193); const PropTypes = __webpack_require__(0); const { interleave, isGrip, wrapRender, ellipsisElement } = __webpack_require__(2); const PropRep = __webpack_require__(39); const { MODE } = __webpack_require__(4); const { ModePropType } = __webpack_require__(38); const { span } = __webpack_require__(1); /** * Renders an map. A map is represented by a list of its * entries enclosed in curly brackets. */ GripMap.propTypes = { object: PropTypes.object, // @TODO Change this to Object.values when supported in Node's version of V8 mode: ModePropType, isInterestingEntry: PropTypes.func, onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func, title: PropTypes.string }; function GripMap(props) { const { mode, object } = props; const config = { "data-link-actor-id": object.actor, className: "objectBox objectBox-object" }; const title = getTitle(props, object); const isEmpty = getLength(object) === 0; if (isEmpty || mode === MODE.TINY) { return span(config, title); } const propsArray = safeEntriesIterator(props, object, maxLengthMap.get(mode)); return span(config, title, span({ className: "objectLeftBrace" }, " { "), ...interleave(propsArray, ", "), span({ className: "objectRightBrace" }, " }")); } function getTitle(props, object) { const title = props.title || (object && object.class ? object.class : "Map"); return span({ className: "objectTitle" }, title, lengthBubble({ object, mode: props.mode, maxLengthMap, getLength, showZeroLength: true })); } function safeEntriesIterator(props, object, max) { max = typeof max === "undefined" ? 3 : max; try { return entriesIterator(props, object, max); } catch (err) { console.error(err); } return []; } function entriesIterator(props, object, max) { // Entry filter. Show only interesting entries to the user. const isInterestingEntry = props.isInterestingEntry || ((type, value) => { return type == "boolean" || type == "number" || type == "string" && value.length != 0; }); const mapEntries = object.preview && object.preview.entries ? object.preview.entries : []; let indexes = getEntriesIndexes(mapEntries, max, isInterestingEntry); if (indexes.length < max && indexes.length < mapEntries.length) { // There are not enough entries yet, so we add uninteresting entries. indexes = indexes.concat(getEntriesIndexes(mapEntries, max - indexes.length, (t, value, name) => { return !isInterestingEntry(t, value, name); })); } const entries = getEntries(props, mapEntries, indexes); if (entries.length < getLength(object)) { // There are some undisplayed entries. Then display "…". entries.push(ellipsisElement); } return entries; } /** * Get entries ordered by index. * * @param {Object} props Component props. * @param {Array} entries Entries array. * @param {Array} indexes Indexes of entries. * @return {Array} Array of PropRep. */ function getEntries(props, entries, indexes) { const { onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick } = props; // Make indexes ordered by ascending. indexes.sort(function (a, b) { return a - b; }); return indexes.map((index, i) => { const [key, entryValue] = entries[index]; const value = entryValue.value !== undefined ? entryValue.value : entryValue; return PropRep({ name: key, equal: " \u2192 ", object: value, mode: MODE.TINY, onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick }); }); } /** * Get the indexes of entries in the map. * * @param {Array} entries Entries array. * @param {Number} max The maximum length of indexes array. * @param {Function} filter Filter the entry you want. * @return {Array} Indexes of filtered entries in the map. */ function getEntriesIndexes(entries, max, filter) { return entries.reduce((indexes, [key, entry], i) => { if (indexes.length < max) { const value = entry && entry.value !== undefined ? entry.value : entry; // Type is specified in grip's "class" field and for primitive // values use typeof. const type = (value && value.class ? value.class : typeof value).toLowerCase(); if (filter(type, value, key)) { indexes.push(i); } } return indexes; }, []); } function getLength(grip) { return grip.preview.size || 0; } function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && grip.preview.kind == "MapLike"; } const maxLengthMap = new Map(); maxLengthMap.set(MODE.SHORT, 3); maxLengthMap.set(MODE.LONG, 10); // Exports from this module module.exports = { rep: wrapRender(GripMap), supportsObject, maxLengthMap, getLength }; /***/ }), /* 195 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); // Shortcuts const dom = __webpack_require__(1); const { span } = dom; const { wrapRender } = __webpack_require__(2); const PropRep = __webpack_require__(39); const { MODE } = __webpack_require__(4); /** * Renders an map entry. A map entry is represented by its key, * a column and its value. */ GripMapEntry.propTypes = { object: PropTypes.object, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function GripMapEntry(props) { const { object } = props; const { key, value } = object.preview; return span({ className: "objectBox objectBox-map-entry" }, PropRep({ ...props, name: key, object: value, equal: " \u2192 ", title: null, suppressQuotes: false })); } function supportsObject(grip, noGrip = false) { if (noGrip === true) { return false; } return grip && (grip.type === "mapEntry" || grip.type === "storageEntry") && grip.preview; } function createGripMapEntry(key, value) { return { type: "mapEntry", preview: { key, value } }; } // Exports from this module module.exports = { rep: wrapRender(GripMapEntry), createGripMapEntry, supportsObject }; /***/ }), /* 196 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { enumEntries, enumIndexedProperties, enumNonIndexedProperties, getPrototype, enumSymbols, getFullText } = __webpack_require__(197); const { getClosestGripNode, getClosestNonBucketNode, getValue, nodeHasAccessors, nodeHasAllEntriesInPreview, nodeHasProperties, nodeIsBucket, nodeIsDefaultProperties, nodeIsEntries, nodeIsMapEntry, nodeIsPrimitive, nodeIsProxy, nodeNeedsNumericalBuckets, nodeIsLongString } = __webpack_require__(114); function loadItemProperties(item, createObjectClient, createLongStringClient, loadedProperties) { const gripItem = getClosestGripNode(item); const value = getValue(gripItem); const [start, end] = item.meta ? [item.meta.startIndex, item.meta.endIndex] : []; const promises = []; let objectClient; const getObjectClient = () => objectClient || createObjectClient(value); if (shouldLoadItemIndexedProperties(item, loadedProperties)) { promises.push(enumIndexedProperties(getObjectClient(), start, end)); } if (shouldLoadItemNonIndexedProperties(item, loadedProperties)) { promises.push(enumNonIndexedProperties(getObjectClient(), start, end)); } if (shouldLoadItemEntries(item, loadedProperties)) { promises.push(enumEntries(getObjectClient(), start, end)); } if (shouldLoadItemPrototype(item, loadedProperties)) { promises.push(getPrototype(getObjectClient())); } if (shouldLoadItemSymbols(item, loadedProperties)) { promises.push(enumSymbols(getObjectClient(), start, end)); } if (shouldLoadItemFullText(item, loadedProperties)) { promises.push(getFullText(createLongStringClient(value), item)); } return Promise.all(promises).then(mergeResponses); } function mergeResponses(responses) { const data = {}; for (const response of responses) { if (response.hasOwnProperty("ownProperties")) { data.ownProperties = { ...data.ownProperties, ...response.ownProperties }; } if (response.ownSymbols && response.ownSymbols.length > 0) { data.ownSymbols = response.ownSymbols; } if (response.prototype) { data.prototype = response.prototype; } if (response.fullText) { data.fullText = response.fullText; } } return data; } function shouldLoadItemIndexedProperties(item, loadedProperties = new Map()) { const gripItem = getClosestGripNode(item); const value = getValue(gripItem); return value && nodeHasProperties(gripItem) && !loadedProperties.has(item.path) && !nodeIsProxy(item) && !nodeNeedsNumericalBuckets(item) && !nodeIsEntries(getClosestNonBucketNode(item)) && // The data is loaded when expanding the window node. !nodeIsDefaultProperties(item); } function shouldLoadItemNonIndexedProperties(item, loadedProperties = new Map()) { const gripItem = getClosestGripNode(item); const value = getValue(gripItem); return value && nodeHasProperties(gripItem) && !loadedProperties.has(item.path) && !nodeIsProxy(item) && !nodeIsEntries(getClosestNonBucketNode(item)) && !nodeIsBucket(item) && // The data is loaded when expanding the window node. !nodeIsDefaultProperties(item); } function shouldLoadItemEntries(item, loadedProperties = new Map()) { const gripItem = getClosestGripNode(item); const value = getValue(gripItem); return value && nodeIsEntries(getClosestNonBucketNode(item)) && !nodeHasAllEntriesInPreview(gripItem) && !loadedProperties.has(item.path) && !nodeNeedsNumericalBuckets(item); } function shouldLoadItemPrototype(item, loadedProperties = new Map()) { const value = getValue(item); return value && !loadedProperties.has(item.path) && !nodeIsBucket(item) && !nodeIsMapEntry(item) && !nodeIsEntries(item) && !nodeIsDefaultProperties(item) && !nodeHasAccessors(item) && !nodeIsPrimitive(item) && !nodeIsLongString(item); } function shouldLoadItemSymbols(item, loadedProperties = new Map()) { const value = getValue(item); return value && !loadedProperties.has(item.path) && !nodeIsBucket(item) && !nodeIsMapEntry(item) && !nodeIsEntries(item) && !nodeIsDefaultProperties(item) && !nodeHasAccessors(item) && !nodeIsPrimitive(item) && !nodeIsLongString(item) && !nodeIsProxy(item); } function shouldLoadItemFullText(item, loadedProperties = new Map()) { return !loadedProperties.has(item.path) && nodeIsLongString(item); } module.exports = { loadItemProperties, mergeResponses, shouldLoadItemEntries, shouldLoadItemIndexedProperties, shouldLoadItemNonIndexedProperties, shouldLoadItemPrototype, shouldLoadItemSymbols, shouldLoadItemFullText }; /***/ }), /* 197 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const { getValue, nodeHasFullText } = __webpack_require__(114); /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ async function enumIndexedProperties(objectClient, start, end) { try { const { iterator } = await objectClient.enumProperties({ ignoreNonIndexedProperties: true }); const response = await iteratorSlice(iterator, start, end); return response; } catch (e) { console.error("Error in enumIndexedProperties", e); return {}; } } async function enumNonIndexedProperties(objectClient, start, end) { try { const { iterator } = await objectClient.enumProperties({ ignoreIndexedProperties: true }); const response = await iteratorSlice(iterator, start, end); return response; } catch (e) { console.error("Error in enumNonIndexedProperties", e); return {}; } } async function enumEntries(objectClient, start, end) { try { const { iterator } = await objectClient.enumEntries(); const response = await iteratorSlice(iterator, start, end); return response; } catch (e) { console.error("Error in enumEntries", e); return {}; } } async function enumSymbols(objectClient, start, end) { try { const { iterator } = await objectClient.enumSymbols(); const response = await iteratorSlice(iterator, start, end); return response; } catch (e) { console.error("Error in enumSymbols", e); return {}; } } async function getPrototype(objectClient) { if (typeof objectClient.getPrototype !== "function") { console.error("objectClient.getPrototype is not a function"); return Promise.resolve({}); } return objectClient.getPrototype(); } async function getFullText(longStringClient, item) { const { initial, fullText, length } = getValue(item); // Return fullText property if it exists so that it can be added to the // loadedProperties map. if (nodeHasFullText(item)) { return Promise.resolve({ fullText }); } return new Promise((resolve, reject) => { longStringClient.substring(initial.length, length, response => { if (response.error) { console.error("LongStringClient.substring", `${response.error}: ${response.message}`); reject({}); return; } resolve({ fullText: initial + response.substring }); }); }); } function iteratorSlice(iterator, start, end) { start = start || 0; const count = end ? end - start + 1 : iterator.count; if (count === 0) { return Promise.resolve({}); } return iterator.slice(start, count); } module.exports = { enumEntries, enumIndexedProperties, enumNonIndexedProperties, enumSymbols, getPrototype, getFullText }; /***/ }), /* 198 */, /* 199 */, /* 200 */, /* 201 */, /* 202 */, /* 203 */, /* 204 */, /* 205 */, /* 206 */, /* 207 */, /* 208 */, /* 209 */, /* 210 */, /* 211 */, /* 212 */, /* 213 */, /* 214 */, /* 215 */, /* 216 */, /* 217 */, /* 218 */, /* 219 */, /* 220 */, /* 221 */, /* 222 */, /* 223 */, /* 224 */, /* 225 */, /* 226 */, /* 227 */, /* 228 */, /* 229 */, /* 230 */, /* 231 */, /* 232 */, /* 233 */, /* 234 */, /* 235 */, /* 236 */, /* 237 */, /* 238 */, /* 239 */, /* 240 */, /* 241 */, /* 242 */, /* 243 */, /* 244 */, /* 245 */, /* 246 */, /* 247 */, /* 248 */, /* 249 */, /* 250 */, /* 251 */, /* 252 */, /* 253 */, /* 254 */, /* 255 */, /* 256 */, /* 257 */, /* 258 */, /* 259 */, /* 260 */, /* 261 */, /* 262 */, /* 263 */, /* 264 */, /* 265 */, /* 266 */, /* 267 */, /* 268 */, /* 269 */, /* 270 */, /* 271 */, /* 272 */, /* 273 */, /* 274 */, /* 275 */, /* 276 */, /* 277 */, /* 278 */, /* 279 */, /* 280 */, /* 281 */, /* 282 */, /* 283 */, /* 284 */, /* 285 */, /* 286 */, /* 287 */, /* 288 */, /* 289 */, /* 290 */, /* 291 */, /* 292 */, /* 293 */, /* 294 */, /* 295 */, /* 296 */, /* 297 */, /* 298 */, /* 299 */, /* 300 */, /* 301 */, /* 302 */, /* 303 */, /* 304 */, /* 305 */, /* 306 */, /* 307 */, /* 308 */, /* 309 */, /* 310 */, /* 311 */, /* 312 */, /* 313 */, /* 314 */, /* 315 */, /* 316 */, /* 317 */, /* 318 */, /* 319 */, /* 320 */, /* 321 */, /* 322 */, /* 323 */, /* 324 */, /* 325 */, /* 326 */, /* 327 */, /* 328 */, /* 329 */, /* 330 */, /* 331 */, /* 332 */, /* 333 */, /* 334 */, /* 335 */, /* 336 */, /* 337 */, /* 338 */, /* 339 */, /* 340 */, /* 341 */, /* 342 */, /* 343 */, /* 344 */, /* 345 */, /* 346 */, /* 347 */, /* 348 */, /* 349 */, /* 350 */, /* 351 */, /* 352 */, /* 353 */, /* 354 */, /* 355 */, /* 356 */, /* 357 */, /* 358 */, /* 359 */, /* 360 */, /* 361 */, /* 362 */, /* 363 */, /* 364 */, /* 365 */, /* 366 */, /* 367 */, /* 368 */, /* 369 */, /* 370 */, /* 371 */, /* 372 */, /* 373 */, /* 374 */, /* 375 */, /* 376 */, /* 377 */, /* 378 */, /* 379 */, /* 380 */, /* 381 */, /* 382 */, /* 383 */, /* 384 */, /* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = assert; var _devtoolsEnvironment = __webpack_require__(102); function assert(condition, message) { if ((0, _devtoolsEnvironment.isDevelopment)() && !condition) { throw new Error(`Assertion failure: ${message}`); } } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ /***/ }), /* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = buildQuery; var _escapeRegExp = __webpack_require__(387); var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Ignore doing outline matches for less than 3 whitespaces * * @memberof utils/source-search * @static */ function ignoreWhiteSpace(str) { return (/^\s{0,2}$/.test(str) ? "(?!\\s*.*)" : str ); } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function wholeMatch(query, wholeWord) { if (query === "" || !wholeWord) { return query; } return `\\b${query}\\b`; } function buildFlags(caseSensitive, isGlobal) { if (caseSensitive && isGlobal) { return "g"; } if (!caseSensitive && isGlobal) { return "gi"; } if (!caseSensitive && !isGlobal) { return "i"; } } function buildQuery(originalQuery, modifiers, { isGlobal = false, ignoreSpaces = false }) { const { caseSensitive, regexMatch, wholeWord } = modifiers; if (originalQuery === "") { return new RegExp(originalQuery); } let query = originalQuery; if (ignoreSpaces) { query = ignoreWhiteSpace(query); } if (!regexMatch) { query = (0, _escapeRegExp2.default)(query); } query = wholeMatch(query, wholeWord); const flags = buildFlags(caseSensitive, isGlobal); if (flags) { return new RegExp(query, flags); } return new RegExp(query); } /***/ }), /* 387 */ /***/ (function(module, exports, __webpack_require__) { var toString = __webpack_require__(57); /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } module.exports = escapeRegExp; /***/ }), /* 388 */, /* 389 */, /* 390 */, /* 391 */, /* 392 */, /* 393 */, /* 394 */, /* 395 */, /* 396 */, /* 397 */, /* 398 */, /* 399 */, /* 400 */, /* 401 */, /* 402 */, /* 403 */, /* 404 */, /* 405 */, /* 406 */, /* 407 */, /* 408 */, /* 409 */, /* 410 */, /* 411 */, /* 412 */, /* 413 */, /* 414 */, /* 415 */, /* 416 */, /* 417 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_417__; /***/ }), /* 418 */, /* 419 */, /* 420 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const { Menu, MenuItem } = __webpack_require__(183); function inToolbox() { try { return window.parent.document.documentURI == "about:devtools-toolbox"; } catch (e) { // If `window` is not available, it's very likely that we are in the toolbox. return true; } } if (!inToolbox()) { __webpack_require__(431); } function createPopup(doc) { let popup = doc.createElement("menupopup"); popup.className = "landing-popup"; if (popup.openPopupAtScreen) { return popup; } function preventDefault(e) { e.preventDefault(); e.returnValue = false; } let mask = document.querySelector("#contextmenu-mask"); if (!mask) { mask = doc.createElement("div"); mask.id = "contextmenu-mask"; document.body.appendChild(mask); } mask.onclick = () => popup.hidePopup(); popup.openPopupAtScreen = function (clientX, clientY) { this.style.setProperty("left", `${clientX}px`); this.style.setProperty("top", `${clientY}px`); mask = document.querySelector("#contextmenu-mask"); window.onwheel = preventDefault; mask.classList.add("show"); this.dispatchEvent(new Event("popupshown")); this.popupshown; }; popup.hidePopup = function () { this.remove(); mask = document.querySelector("#contextmenu-mask"); mask.classList.remove("show"); window.onwheel = null; }; return popup; } if (!inToolbox()) { Menu.prototype.createPopup = createPopup; } function onShown(menu, popup) { popup.childNodes.forEach((menuItemNode, i) => { let item = menu.items[i]; if (!item.disabled && item.visible) { menuItemNode.onclick = () => { item.click(); popup.hidePopup(); }; showSubMenu(item.submenu, menuItemNode, popup); } }); } function showMenu(evt, items) { if (items.length === 0) { return; } let menu = new Menu(); items.filter(item => item.visible === undefined || item.visible === true).forEach(item => { let menuItem = new MenuItem(item); menuItem.submenu = createSubMenu(item.submenu); menu.append(menuItem); }); if (inToolbox()) { menu.popup(evt.screenX, evt.screenY, { doc: window.parent.document }); return; } menu.on("open", (_, popup) => onShown(menu, popup)); menu.popup(evt.clientX, evt.clientY, { doc: document }); } function createSubMenu(subItems) { if (subItems) { let subMenu = new Menu(); subItems.forEach(subItem => { subMenu.append(new MenuItem(subItem)); }); return subMenu; } return null; } function showSubMenu(subMenu, menuItemNode, popup) { if (subMenu) { let subMenuNode = menuItemNode.querySelector("menupopup"); let { top } = menuItemNode.getBoundingClientRect(); let { left, width } = popup.getBoundingClientRect(); subMenuNode.style.setProperty("left", `${left + width - 1}px`); subMenuNode.style.setProperty("top", `${top}px`); let subMenuItemNodes = menuItemNode.querySelector("menupopup:not(.landing-popup)").childNodes; subMenuItemNodes.forEach((subMenuItemNode, j) => { let subMenuItem = subMenu.items.filter(item => item.visible === undefined || item.visible === true)[j]; if (!subMenuItem.disabled && subMenuItem.visible) { subMenuItemNode.onclick = () => { subMenuItem.click(); popup.hidePopup(); }; } }); } } function buildMenu(items) { return items.map(itm => { const hide = typeof itm.hidden === "function" ? itm.hidden() : itm.hidden; return hide ? null : itm.item; }).filter(itm => itm !== null); } module.exports = { showMenu, buildMenu }; /***/ }), /* 421 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _devtoolsServices = __webpack_require__(37); var _devtoolsServices2 = _interopRequireDefault(_devtoolsServices); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const { appinfo } = _devtoolsServices2.default; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const isMacOS = appinfo.OS === "Darwin"; const EventEmitter = __webpack_require__(65); /** * Formats key for use in tooltips * For macOS we use the following unicode * * cmd ⌘ = \u2318 * shift ⇧ – \u21E7 * option (alt) ⌥ \u2325 * * For Win/Lin this replaces CommandOrControl or CmdOrCtrl with Ctrl * * @static */ function formatKeyShortcut(shortcut) { if (isMacOS) { return shortcut.replace(/Shift\+/g, "\u21E7").replace(/Command\+|Cmd\+/g, "\u2318").replace(/CommandOrControl\+|CmdOrCtrl\+/g, "\u2318").replace(/Alt\+/g, "\u2325"); } return shortcut.replace(/CommandOrControl\+|CmdOrCtrl\+/g, `${L10N.getStr("ctrl")}+`).replace(/Shift\+/g, "Shift+"); } function inToolbox() { try { return window.parent.document.documentURI == "about:devtools-toolbox"; } catch (e) { // If `window` is not available, it's very likely that we are in the toolbox. return true; } } /** * A partial implementation of the Menu API provided by electron: * https://github.com/electron/electron/blob/master/docs/api/menu.md. * * Extra features: * - Emits an 'open' and 'close' event when the menu is opened/closed * @param String id (non standard) * Needed so tests can confirm the XUL implementation is working */ function Menu({ id = null } = {}) { this.menuitems = []; this.id = id; Object.defineProperty(this, "items", { get() { return this.menuitems; } }); EventEmitter.decorate(this); } /** * Add an item to the end of the Menu * * @param {MenuItem} menuItem */ Menu.prototype.append = function (menuItem) { this.menuitems.push(menuItem); }; /** * Add an item to a specified position in the menu * * @param {int} pos * @param {MenuItem} menuItem */ Menu.prototype.insert = function (pos, menuItem) { throw Error("Not implemented"); }; /** * Show the Menu at a specified location on the screen * * Missing features: * - browserWindow - BrowserWindow (optional) - Default is null. * - positioningItem Number - (optional) OS X * * @param {int} screenX * @param {int} screenY * @param Toolbox toolbox (non standard) * Needed so we in which window to inject XUL */ Menu.prototype.popup = function (screenX, screenY, toolbox) { let doc = toolbox.doc; let popupset = doc.querySelector("popupset"); if (!popupset) { popupset = doc.createXULElement("popupset"); doc.documentElement.appendChild(popupset); } // See bug 1285229, on Windows, opening the same popup multiple times in a // row ends up duplicating the popup. The newly inserted popup doesn't // dismiss the old one. So remove any previously displayed popup before // opening a new one. let popup = popupset.querySelector("menupopup[menu-api=\"true\"]"); if (popup) { popup.hidePopup(); } popup = this.createPopup(doc); popup.setAttribute("menu-api", "true"); if (this.id) { popup.id = this.id; } this._createMenuItems(popup); // Remove the menu from the DOM once it's hidden. popup.addEventListener("popuphidden", e => { if (e.target === popup) { popup.remove(); this.emit("close", popup); } }); popup.addEventListener("popupshown", e => { if (e.target === popup) { this.emit("open", popup); } }); popupset.appendChild(popup); popup.openPopupAtScreen(screenX, screenY, true); }; Menu.prototype.createPopup = function (doc) { return doc.createElement("menupopup"); }; Menu.prototype._createMenuItems = function (parent) { let doc = parent.ownerDocument; this.menuitems.forEach(item => { if (!item.visible) { return; } if (item.submenu) { let menupopup = doc.createElement("menupopup"); item.submenu._createMenuItems(menupopup); let menuitem = doc.createElement("menuitem"); menuitem.setAttribute("label", item.label); if (!inToolbox()) { menuitem.textContent = item.label; } let menu = doc.createElement("menu"); menu.appendChild(menuitem); menu.appendChild(menupopup); if (item.disabled) { menu.setAttribute("disabled", "true"); } if (item.accesskey) { menu.setAttribute("accesskey", item.accesskey); } if (item.id) { menu.id = item.id; } if (item.accelerator) { menuitem.setAttribute("acceltext", formatKeyShortcut(item.accelerator)); } parent.appendChild(menu); } else if (item.type === "separator") { let menusep = doc.createElement("menuseparator"); parent.appendChild(menusep); } else { let menuitem = doc.createElement("menuitem"); menuitem.setAttribute("label", item.label); if (!inToolbox()) { menuitem.textContent = item.label; } menuitem.addEventListener("command", () => item.click()); if (item.type === "checkbox") { menuitem.setAttribute("type", "checkbox"); } if (item.type === "radio") { menuitem.setAttribute("type", "radio"); } if (item.disabled) { menuitem.setAttribute("disabled", "true"); } if (item.checked) { menuitem.setAttribute("checked", "true"); } if (item.accesskey) { menuitem.setAttribute("accesskey", item.accesskey); } if (item.id) { menuitem.id = item.id; } if (item.accelerator) { menuitem.setAttribute("acceltext", formatKeyShortcut(item.accelerator)); } parent.appendChild(menuitem); } }); }; Menu.setApplicationMenu = () => { throw Error("Not implemented"); }; Menu.sendActionToFirstResponder = () => { throw Error("Not implemented"); }; Menu.buildFromTemplate = () => { throw Error("Not implemented"); }; module.exports = Menu; /***/ }), /* 422 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm */ /** * Promise.jsm is mostly the Promise web API with a `defer` method. Just drop this in here, * and use the native web API (although building with webpack/babel, it may replace this * with it's own version if we want to target environments that do not have `Promise`. */ let p = typeof window != "undefined" ? window.Promise : Promise; p.defer = function defer() { var resolve, reject; var promise = new Promise(function () { resolve = arguments[0]; reject = arguments[1]; }); return { resolve: resolve, reject: reject, promise: promise }; }; module.exports = p; /***/ }), /* 423 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * A partial implementation of the MenuItem API provided by electron: * https://github.com/electron/electron/blob/master/docs/api/menu-item.md. * * Missing features: * - id String - Unique within a single menu. If defined then it can be used * as a reference to this item by the position attribute. * - role String - Define the action of the menu item; when specified the * click property will be ignored * - sublabel String * - icon NativeImage * - position String - This field allows fine-grained definition of the * specific location within a given menu. * * Implemented features: * @param Object options * Function click * Will be called with click(menuItem, browserWindow) when the menu item * is clicked * String type * Can be normal, separator, submenu, checkbox or radio * String label * Boolean enabled * If false, the menu item will be greyed out and unclickable. * Boolean checked * Should only be specified for checkbox or radio type menu items. * Menu submenu * Should be specified for submenu type menu items. If submenu is specified, * the type: 'submenu' can be omitted. If the value is not a Menu then it * will be automatically converted to one using Menu.buildFromTemplate. * Boolean visible * If false, the menu item will be entirely hidden. * String accelerator * If specified, will be used as accelerator text for MenuItem */ function MenuItem({ accesskey = null, checked = false, click = () => {}, disabled = false, label = "", id = null, submenu = null, type = "normal", visible = true, accelerator = "" } = {}) { this.accesskey = accesskey; this.checked = checked; this.click = click; this.disabled = disabled; this.id = id; this.label = label; this.submenu = submenu; this.type = type; this.visible = visible; this.accelerator = accelerator; } module.exports = MenuItem; /***/ }), /* 424 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const Services = __webpack_require__(37); const EventEmitter = __webpack_require__(65); /** * Shortcuts for lazily accessing and setting various preferences. * Usage: * let prefs = new Prefs("root.path.to.branch", { * myIntPref: ["Int", "leaf.path.to.my-int-pref"], * myCharPref: ["Char", "leaf.path.to.my-char-pref"], * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] * ... * }); * * Get/set: * prefs.myCharPref = "foo"; * let aux = prefs.myCharPref; * * Observe: * prefs.registerObserver(); * prefs.on("pref-changed", (prefName, prefValue) => { * ... * }); * * @param string prefsRoot * The root path to the required preferences branch. * @param object prefsBlueprint * An object containing { accessorName: [prefType, prefName, prefDefault] } keys. */ function PrefsHelper(prefsRoot = "", prefsBlueprint = {}) { EventEmitter.decorate(this); let cache = new Map(); for (let accessorName in prefsBlueprint) { let [prefType, prefName, prefDefault] = prefsBlueprint[accessorName]; map(this, cache, accessorName, prefType, prefsRoot, prefName, prefDefault); } let observer = makeObserver(this, cache, prefsRoot, prefsBlueprint); this.registerObserver = () => observer.register(); this.unregisterObserver = () => observer.unregister(); } /** * Helper method for getting a pref value. * * @param Map cache * @param string prefType * @param string prefsRoot * @param string prefName * @return any */ function get(cache, prefType, prefsRoot, prefName) { let cachedPref = cache.get(prefName); if (cachedPref !== undefined) { return cachedPref; } let value = Services.prefs["get" + prefType + "Pref"]([prefsRoot, prefName].join(".")); cache.set(prefName, value); return value; } /** * Helper method for setting a pref value. * * @param Map cache * @param string prefType * @param string prefsRoot * @param string prefName * @param any value */ function set(cache, prefType, prefsRoot, prefName, value) { Services.prefs["set" + prefType + "Pref"]([prefsRoot, prefName].join("."), value); cache.set(prefName, value); } /** * Maps a property name to a pref, defining lazy getters and setters. * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" * type and casting), and "Json" (which is basically just sugar for "Char" * using the standard JSON serializer). * * @param PrefsHelper self * @param Map cache * @param string accessorName * @param string prefType * @param string prefsRoot * @param string prefName * @param string prefDefault * @param array serializer [optional] */ function map(self, cache, accessorName, prefType, prefsRoot, prefName, prefDefault, serializer = { in: e => e, out: e => e }) { if (prefName in self) { throw new Error(`Can't use ${prefName} because it overrides a property` + "on the instance."); } if (prefType == "Json") { map(self, cache, accessorName, "String", prefsRoot, prefName, prefDefault, { in: JSON.parse, out: JSON.stringify }); return; } if (prefType == "Float") { map(self, cache, accessorName, "Char", prefsRoot, prefName, prefDefault, { in: Number.parseFloat, out: n => n + "" }); return; } Object.defineProperty(self, accessorName, { get: () => { try { return serializer.in(get(cache, prefType, prefsRoot, prefName)); } catch (e) { if (typeof prefDefault !== 'undefined') { return prefDefault; } throw e; } }, set: e => set(cache, prefType, prefsRoot, prefName, serializer.out(e)) }); } /** * Finds the accessor for the provided pref, based on the blueprint object * used in the constructor. * * @param PrefsHelper self * @param object prefsBlueprint * @return string */ function accessorNameForPref(somePrefName, prefsBlueprint) { for (let accessorName in prefsBlueprint) { let [, prefName] = prefsBlueprint[accessorName]; if (somePrefName == prefName) { return accessorName; } } return ""; } /** * Creates a pref observer for `self`. * * @param PrefsHelper self * @param Map cache * @param string prefsRoot * @param object prefsBlueprint * @return object */ function makeObserver(self, cache, prefsRoot, prefsBlueprint) { return { register: function () { this._branch = Services.prefs.getBranch(prefsRoot + "."); this._branch.addObserver("", this); }, unregister: function () { this._branch.removeObserver("", this); }, observe: function (subject, topic, prefName) { // If this particular pref isn't handled by the blueprint object, // even though it's in the specified branch, ignore it. let accessorName = accessorNameForPref(prefName, prefsBlueprint); if (!(accessorName in self)) { return; } cache.delete(prefName); self.emit("pref-changed", accessorName, self[accessorName]); } }; } exports.PrefsHelper = PrefsHelper; /***/ }), /* 425 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const { appinfo } = __webpack_require__(37); const EventEmitter = __webpack_require__(65); const isOSX = appinfo.OS === "Darwin"; // List of electron keys mapped to DOM API (DOM_VK_*) key code const ElectronKeysMapping = { "F1": "DOM_VK_F1", "F2": "DOM_VK_F2", "F3": "DOM_VK_F3", "F4": "DOM_VK_F4", "F5": "DOM_VK_F5", "F6": "DOM_VK_F6", "F7": "DOM_VK_F7", "F8": "DOM_VK_F8", "F9": "DOM_VK_F9", "F10": "DOM_VK_F10", "F11": "DOM_VK_F11", "F12": "DOM_VK_F12", "F13": "DOM_VK_F13", "F14": "DOM_VK_F14", "F15": "DOM_VK_F15", "F16": "DOM_VK_F16", "F17": "DOM_VK_F17", "F18": "DOM_VK_F18", "F19": "DOM_VK_F19", "F20": "DOM_VK_F20", "F21": "DOM_VK_F21", "F22": "DOM_VK_F22", "F23": "DOM_VK_F23", "F24": "DOM_VK_F24", "Space": "DOM_VK_SPACE", "Backspace": "DOM_VK_BACK_SPACE", "Delete": "DOM_VK_DELETE", "Insert": "DOM_VK_INSERT", "Return": "DOM_VK_RETURN", "Enter": "DOM_VK_RETURN", "Up": "DOM_VK_UP", "Down": "DOM_VK_DOWN", "Left": "DOM_VK_LEFT", "Right": "DOM_VK_RIGHT", "Home": "DOM_VK_HOME", "End": "DOM_VK_END", "PageUp": "DOM_VK_PAGE_UP", "PageDown": "DOM_VK_PAGE_DOWN", "Escape": "DOM_VK_ESCAPE", "Esc": "DOM_VK_ESCAPE", "Tab": "DOM_VK_TAB", "VolumeUp": "DOM_VK_VOLUME_UP", "VolumeDown": "DOM_VK_VOLUME_DOWN", "VolumeMute": "DOM_VK_VOLUME_MUTE", "PrintScreen": "DOM_VK_PRINTSCREEN" }; /** * Helper to listen for keyboard events decribed in .properties file. * * let shortcuts = new KeyShortcuts({ * window * }); * shortcuts.on("Ctrl+F", event => { * // `event` is the KeyboardEvent which relates to the key shortcuts * }); * * @param DOMWindow window * The window object of the document to listen events from. * @param DOMElement target * Optional DOM Element on which we should listen events from. * If omitted, we listen for all events fired on `window`. */ function KeyShortcuts({ window, target }) { this.window = window; this.target = target || window; this.keys = new Map(); this.eventEmitter = new EventEmitter(); this.target.addEventListener("keydown", this); } /* * Parse an electron-like key string and return a normalized object which * allow efficient match on DOM key event. The normalized object matches DOM * API. * * @param DOMWindow window * Any DOM Window object, just to fetch its `KeyboardEvent` object * @param String str * The shortcut string to parse, following this document: * https://github.com/electron/electron/blob/master/docs/api/accelerator.md */ KeyShortcuts.parseElectronKey = function (window, str) { let modifiers = str.split("+"); let key = modifiers.pop(); let shortcut = { ctrl: false, meta: false, alt: false, shift: false, // Set for character keys key: undefined, // Set for non-character keys keyCode: undefined }; for (let mod of modifiers) { if (mod === "Alt") { shortcut.alt = true; } else if (["Command", "Cmd"].includes(mod)) { shortcut.meta = true; } else if (["CommandOrControl", "CmdOrCtrl"].includes(mod)) { if (isOSX) { shortcut.meta = true; } else { shortcut.ctrl = true; } } else if (["Control", "Ctrl"].includes(mod)) { shortcut.ctrl = true; } else if (mod === "Shift") { shortcut.shift = true; } else { console.error("Unsupported modifier:", mod, "from key:", str); return null; } } // Plus is a special case. It's a character key and shouldn't be matched // against a keycode as it is only accessible via Shift/Capslock if (key === "Plus") { key = "+"; } if (typeof key === "string" && key.length === 1) { // Match any single character shortcut.key = key.toLowerCase(); } else if (key in ElectronKeysMapping) { // Maps the others manually to DOM API DOM_VK_* key = ElectronKeysMapping[key]; shortcut.keyCode = window.KeyboardEvent[key]; // Used only to stringify the shortcut shortcut.keyCodeString = key; shortcut.key = key; } else { console.error("Unsupported key:", key); return null; } return shortcut; }; KeyShortcuts.stringify = function (shortcut) { let list = []; if (shortcut.alt) { list.push("Alt"); } if (shortcut.ctrl) { list.push("Ctrl"); } if (shortcut.meta) { list.push("Cmd"); } if (shortcut.shift) { list.push("Shift"); } let key; if (shortcut.key) { key = shortcut.key.toUpperCase(); } else { key = shortcut.keyCodeString; } list.push(key); return list.join("+"); }; KeyShortcuts.prototype = { destroy() { this.target.removeEventListener("keydown", this); this.keys.clear(); }, doesEventMatchShortcut(event, shortcut) { if (shortcut.meta != event.metaKey) { return false; } if (shortcut.ctrl != event.ctrlKey) { return false; } if (shortcut.alt != event.altKey) { return false; } // Shift is a special modifier, it may implicitely be required if the // expected key is a special character accessible via shift. if (shortcut.shift != event.shiftKey && event.key && event.key.match(/[a-zA-Z]/)) { return false; } if (shortcut.keyCode) { return event.keyCode == shortcut.keyCode; } else if (event.key in ElectronKeysMapping) { return ElectronKeysMapping[event.key] === shortcut.key; } // get the key from the keyCode if key is not provided. let key = event.key || String.fromCharCode(event.keyCode); // For character keys, we match if the final character is the expected one. // But for digits we also accept indirect match to please azerty keyboard, // which requires Shift to be pressed to get digits. return key.toLowerCase() == shortcut.key || shortcut.key.match(/^[0-9]$/) && event.keyCode == shortcut.key.charCodeAt(0); }, handleEvent(event) { for (let [key, shortcut] of this.keys) { if (this.doesEventMatchShortcut(event, shortcut)) { this.eventEmitter.emit(key, event); } } }, on(key, listener) { if (typeof listener !== "function") { throw new Error("KeyShortcuts.on() expects a function as " + "second argument"); } if (!this.keys.has(key)) { let shortcut = KeyShortcuts.parseElectronKey(this.window, key); // The key string is wrong and we were unable to compute the key shortcut if (!shortcut) { return; } this.keys.set(key, shortcut); } this.eventEmitter.on(key, listener); }, off(key, listener) { this.eventEmitter.off(key, listener); } }; module.exports = KeyShortcuts; /***/ }), /* 426 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Empty shim for "devtools/client/shared/zoom-keys" module * * Based on nsIMarkupDocumentViewer.fullZoom API * https://developer.mozilla.org/en-US/Firefox/Releases/3/Full_page_zoom */ exports.register = function (window) {}; /***/ }), /* 427 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * * Adapted from https://github.com/mozilla-b2g/gaia/blob/f09993563fb5fec4393eb71816ce76cb00463190/shared/js/async_storage.js * (converted to use Promises instead of callbacks). * * This file defines an asynchronous version of the localStorage API, backed by * an IndexedDB database. It creates a global asyncStorage object that has * methods like the localStorage object. * * To store a value use setItem: * * asyncStorage.setItem("key", "value"); * * This returns a promise in case you want confirmation that the value has been stored. * * asyncStorage.setItem("key", "newvalue").then(function() { * console.log("new value stored"); * }); * * To read a value, call getItem(), but note that you must wait for a promise * resolution for the value to be retrieved. * * asyncStorage.getItem("key").then(function(value) { * console.log("The value of key is:", value); * }); * * Note that unlike localStorage, asyncStorage does not allow you to store and * retrieve values by setting and querying properties directly. You cannot just * write asyncStorage.key; you have to explicitly call setItem() or getItem(). * * removeItem(), clear(), length(), and key() are like the same-named methods of * localStorage, and all return a promise. * * The asynchronous nature of getItem() makes it tricky to retrieve multiple * values. But unlike localStorage, asyncStorage does not require the values you * store to be strings. So if you need to save multiple values and want to * retrieve them together, in a single asynchronous operation, just group the * values into a single object. The properties of this object may not include * DOM elements, but they may include things like Blobs and typed arrays. * */ const DBNAME = "devtools-async-storage"; const DBVERSION = 1; const STORENAME = "keyvaluepairs"; var db = null; function withStore(type, onsuccess, onerror) { if (db) { const transaction = db.transaction(STORENAME, type); const store = transaction.objectStore(STORENAME); onsuccess(store); } else { const openreq = indexedDB.open(DBNAME, DBVERSION); openreq.onerror = function withStoreOnError() { onerror(); }; openreq.onupgradeneeded = function withStoreOnUpgradeNeeded() { // First time setup: create an empty object store openreq.result.createObjectStore(STORENAME); }; openreq.onsuccess = function withStoreOnSuccess() { db = openreq.result; const transaction = db.transaction(STORENAME, type); const store = transaction.objectStore(STORENAME); onsuccess(store); }; } } function getItem(itemKey) { return new Promise((resolve, reject) => { let req; withStore("readonly", store => { store.transaction.oncomplete = function onComplete() { let value = req.result; if (value === undefined) { value = null; } resolve(value); }; req = store.get(itemKey); req.onerror = function getItemOnError() { reject("Error in asyncStorage.getItem(): ", req.error.name); }; }, reject); }); } function setItem(itemKey, value) { return new Promise((resolve, reject) => { withStore("readwrite", store => { store.transaction.oncomplete = resolve; const req = store.put(value, itemKey); req.onerror = function setItemOnError() { reject("Error in asyncStorage.setItem(): ", req.error.name); }; }, reject); }); } function removeItem(itemKey) { return new Promise((resolve, reject) => { withStore("readwrite", store => { store.transaction.oncomplete = resolve; const req = store.delete(itemKey); req.onerror = function removeItemOnError() { reject("Error in asyncStorage.removeItem(): ", req.error.name); }; }, reject); }); } function clear() { return new Promise((resolve, reject) => { withStore("readwrite", store => { store.transaction.oncomplete = resolve; const req = store.clear(); req.onerror = function clearOnError() { reject("Error in asyncStorage.clear(): ", req.error.name); }; }, reject); }); } function length() { return new Promise((resolve, reject) => { let req; withStore("readonly", store => { store.transaction.oncomplete = function onComplete() { resolve(req.result); }; req = store.count(); req.onerror = function lengthOnError() { reject("Error in asyncStorage.length(): ", req.error.name); }; }, reject); }); } function key(n) { return new Promise((resolve, reject) => { if (n < 0) { resolve(null); return; } let req; withStore("readonly", store => { store.transaction.oncomplete = function onComplete() { const cursor = req.result; resolve(cursor ? cursor.key : null); }; let advanced = false; req = store.openCursor(); req.onsuccess = function keyOnSuccess() { const cursor = req.result; if (!cursor) { // this means there weren"t enough keys return; } if (n === 0 || advanced) { // Either 1) we have the first key, return it if that's what they // wanted, or 2) we"ve got the nth key. return; } // Otherwise, ask the cursor to skip ahead n records advanced = true; cursor.advance(n); }; req.onerror = function keyOnError() { reject("Error in asyncStorage.key(): ", req.error.name); }; }, reject); }); } exports.getItem = getItem; exports.setItem = setItem; exports.removeItem = removeItem; exports.clear = clear; exports.length = length; exports.key = key; /***/ }), /* 428 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // TODO : Localize this (was l10n.getStr("frame.unknownSource")) const UNKNOWN_SOURCE_STRING = "(unknown)"; // Character codes used in various parsing helper functions. const CHAR_CODE_A = "a".charCodeAt(0); const CHAR_CODE_B = "b".charCodeAt(0); const CHAR_CODE_C = "c".charCodeAt(0); const CHAR_CODE_D = "d".charCodeAt(0); const CHAR_CODE_E = "e".charCodeAt(0); const CHAR_CODE_F = "f".charCodeAt(0); const CHAR_CODE_H = "h".charCodeAt(0); const CHAR_CODE_I = "i".charCodeAt(0); const CHAR_CODE_J = "j".charCodeAt(0); const CHAR_CODE_L = "l".charCodeAt(0); const CHAR_CODE_M = "m".charCodeAt(0); const CHAR_CODE_N = "n".charCodeAt(0); const CHAR_CODE_O = "o".charCodeAt(0); const CHAR_CODE_P = "p".charCodeAt(0); const CHAR_CODE_R = "r".charCodeAt(0); const CHAR_CODE_S = "s".charCodeAt(0); const CHAR_CODE_T = "t".charCodeAt(0); const CHAR_CODE_U = "u".charCodeAt(0); const CHAR_CODE_W = "w".charCodeAt(0); const CHAR_CODE_COLON = ":".charCodeAt(0); const CHAR_CODE_DASH = "-".charCodeAt(0); const CHAR_CODE_L_SQUARE_BRACKET = "[".charCodeAt(0); const CHAR_CODE_SLASH = "/".charCodeAt(0); const CHAR_CODE_CAP_S = "S".charCodeAt(0); // The cache used in the `parseURL` function. const gURLStore = new Map(); // The cache used in the `getSourceNames` function. const gSourceNamesStore = new Map(); /** * Takes a string and returns an object containing all the properties * available on an URL instance, with additional properties (fileName), * Leverages caching. * * @param {String} location * @return {Object?} An object containing most properties available * in https://developer.mozilla.org/en-US/docs/Web/API/URL */ function parseURL(location) { let url = gURLStore.get(location); if (url !== void 0) { return url; } try { url = new URL(location); // The callers were generally written to expect a URL from // sdk/url, which is subtly different. So, work around some // important differences here. url = { href: url.href, protocol: url.protocol, host: url.host, hostname: url.hostname, port: url.port || null, pathname: url.pathname, search: url.search, hash: url.hash, username: url.username, password: url.password, origin: url.origin }; // Definitions: // Example: https://foo.com:8888/file.js // `hostname`: "foo.com" // `host`: "foo.com:8888" let isChrome = isChromeScheme(location); url.fileName = url.pathname ? url.pathname.slice(url.pathname.lastIndexOf("/") + 1) || "/" : "/"; if (isChrome) { url.hostname = null; url.host = null; } gURLStore.set(location, url); return url; } catch (e) { gURLStore.set(location, null); return null; } } /** * Parse a source into a short and long name as well as a host name. * * @param {String} source * The source to parse. Can be a URI or names like "(eval)" or * "self-hosted". * @return {Object} * An object with the following properties: * - {String} short: A short name for the source. * - "http://page.com/test.js#go?q=query" -> "test.js" * - {String} long: The full, long name for the source, with hash/query stripped. * - "http://page.com/test.js#go?q=query" -> "http://page.com/test.js" * - {String?} host: If available, the host name for the source. * - "http://page.com/test.js#go?q=query" -> "page.com" */ function getSourceNames(source) { let data = gSourceNamesStore.get(source); if (data) { return data; } let short, long, host; const sourceStr = source ? String(source) : ""; // If `data:...` uri if (isDataScheme(sourceStr)) { let commaIndex = sourceStr.indexOf(","); if (commaIndex > -1) { // The `short` name for a data URI becomes `data:` followed by the actual // encoded content, omitting the MIME type, and charset. short = `data:${sourceStr.substring(commaIndex + 1)}`.slice(0, 100); let result = { short, long: sourceStr }; gSourceNamesStore.set(source, result); return result; } } // If Scratchpad URI, like "Scratchpad/1"; no modifications, // and short/long are the same. if (isScratchpadScheme(sourceStr)) { let result = { short: sourceStr, long: sourceStr }; gSourceNamesStore.set(source, result); return result; } const parsedUrl = parseURL(sourceStr); if (!parsedUrl) { // Malformed URI. long = sourceStr; short = sourceStr.slice(0, 100); } else { host = parsedUrl.host; long = parsedUrl.href; if (parsedUrl.hash) { long = long.replace(parsedUrl.hash, ""); } if (parsedUrl.search) { long = long.replace(parsedUrl.search, ""); } short = parsedUrl.fileName; // If `short` is just a slash, and we actually have a path, // strip the slash and parse again to get a more useful short name. // e.g. "http://foo.com/bar/" -> "bar", rather than "/" if (short === "/" && parsedUrl.pathname !== "/") { short = parseURL(long.replace(/\/$/, "")).fileName; } } if (!short) { if (!long) { long = UNKNOWN_SOURCE_STRING; } short = long.slice(0, 100); } let result = { short, long, host }; gSourceNamesStore.set(source, result); return result; } // For the functions below, we assume that we will never access the location // argument out of bounds, which is indeed the vast majority of cases. // // They are written this way because they are hot. Each frame is checked for // being content or chrome when processing the profile. function isColonSlashSlash(location, i = 0) { return location.charCodeAt(++i) === CHAR_CODE_COLON && location.charCodeAt(++i) === CHAR_CODE_SLASH && location.charCodeAt(++i) === CHAR_CODE_SLASH; } /** * Checks for a Scratchpad URI, like "Scratchpad/1" */ function isScratchpadScheme(location, i = 0) { return location.charCodeAt(i) === CHAR_CODE_CAP_S && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_H && location.charCodeAt(++i) === CHAR_CODE_P && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_D && location.charCodeAt(++i) === CHAR_CODE_SLASH; } function isDataScheme(location, i = 0) { return location.charCodeAt(i) === CHAR_CODE_D && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_COLON; } function isContentScheme(location, i = 0) { let firstChar = location.charCodeAt(i); switch (firstChar) { // "http://" or "https://" case CHAR_CODE_H: if (location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_P) { if (location.charCodeAt(i + 1) === CHAR_CODE_S) { ++i; } return isColonSlashSlash(location, i); } return false; // "file://" case CHAR_CODE_F: if (location.charCodeAt(++i) === CHAR_CODE_I && location.charCodeAt(++i) === CHAR_CODE_L && location.charCodeAt(++i) === CHAR_CODE_E) { return isColonSlashSlash(location, i); } return false; // "app://" case CHAR_CODE_A: if (location.charCodeAt(++i) == CHAR_CODE_P && location.charCodeAt(++i) == CHAR_CODE_P) { return isColonSlashSlash(location, i); } return false; // "blob:" case CHAR_CODE_B: if (location.charCodeAt(++i) == CHAR_CODE_L && location.charCodeAt(++i) == CHAR_CODE_O && location.charCodeAt(++i) == CHAR_CODE_B && location.charCodeAt(++i) == CHAR_CODE_COLON) { return isContentScheme(location, i + 1); } return false; default: return false; } } function isChromeScheme(location, i = 0) { let firstChar = location.charCodeAt(i); switch (firstChar) { // "chrome://" case CHAR_CODE_C: if (location.charCodeAt(++i) === CHAR_CODE_H && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_O && location.charCodeAt(++i) === CHAR_CODE_M && location.charCodeAt(++i) === CHAR_CODE_E) { return isColonSlashSlash(location, i); } return false; // "resource://" case CHAR_CODE_R: if (location.charCodeAt(++i) === CHAR_CODE_E && location.charCodeAt(++i) === CHAR_CODE_S && location.charCodeAt(++i) === CHAR_CODE_O && location.charCodeAt(++i) === CHAR_CODE_U && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_E) { return isColonSlashSlash(location, i); } return false; // "jar:file://" case CHAR_CODE_J: if (location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_R && location.charCodeAt(++i) === CHAR_CODE_COLON && location.charCodeAt(++i) === CHAR_CODE_F && location.charCodeAt(++i) === CHAR_CODE_I && location.charCodeAt(++i) === CHAR_CODE_L && location.charCodeAt(++i) === CHAR_CODE_E) { return isColonSlashSlash(location, i); } return false; default: return false; } } function isWASM(location, i = 0) { return ( // "wasm-function[" location.charCodeAt(i) === CHAR_CODE_W && location.charCodeAt(++i) === CHAR_CODE_A && location.charCodeAt(++i) === CHAR_CODE_S && location.charCodeAt(++i) === CHAR_CODE_M && location.charCodeAt(++i) === CHAR_CODE_DASH && location.charCodeAt(++i) === CHAR_CODE_F && location.charCodeAt(++i) === CHAR_CODE_U && location.charCodeAt(++i) === CHAR_CODE_N && location.charCodeAt(++i) === CHAR_CODE_C && location.charCodeAt(++i) === CHAR_CODE_T && location.charCodeAt(++i) === CHAR_CODE_I && location.charCodeAt(++i) === CHAR_CODE_O && location.charCodeAt(++i) === CHAR_CODE_N && location.charCodeAt(++i) === CHAR_CODE_L_SQUARE_BRACKET ); } /** * A utility method to get the file name from a sourcemapped location * The sourcemap location can be in any form. This method returns a * formatted file name for different cases like Windows or OSX. * @param source * @returns String */ function getSourceMappedFile(source) { // If sourcemapped source is a OSX path, return // the characters after last "/". // If sourcemapped source is a Windowss path, return // the characters after last "\\". if (source.lastIndexOf("/") >= 0) { source = source.slice(source.lastIndexOf("/") + 1); } else if (source.lastIndexOf("\\") >= 0) { source = source.slice(source.lastIndexOf("\\") + 1); } return source; } module.exports = { parseURL, getSourceNames, isScratchpadScheme, isChromeScheme, isContentScheme, isWASM, isDataScheme, getSourceMappedFile }; /***/ }), /* 429 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ /** * This is a stub of the DevTools telemetry module and will be replaced by the * full version of the file by Webpack for running inside Firefox. */ class Telemetry { /** * Time since the system wide epoch. This is not a monotonic timer but * can be used across process boundaries. */ get msSystemNow() { return 0; } /** * Starts a timer associated with a telemetry histogram. The timer can be * directly associated with a histogram, or with a pair of a histogram and * an object. * * @param {String} histogramId * A string which must be a valid histogram name. * @param {Object} obj * Optional parameter. If specified, the timer is associated with this * object, meaning that multiple timers for the same histogram may be * run concurrently, as long as they are associated with different * objects. * * @returns {Boolean} * True if the timer was successfully started, false otherwise. If a * timer already exists, it can't be started again, and the existing * one will be cleared in order to avoid measurements errors. */ start(histogramId, obj) { return true; } /** * Starts a timer associated with a keyed telemetry histogram. The timer can * be directly associated with a histogram and its key. Similarly to * TelemetryStopwatch.start the histogram and its key can be associated * with an object. Each key may have multiple associated objects and each * object can be associated with multiple keys. * * @param {String} histogramId * A string which must be a valid histogram name. * @param {String} key * A string which must be a valid histgram key. * @param {Object} obj * Optional parameter. If specified, the timer is associated with this * object, meaning that multiple timers for the same histogram may be * run concurrently,as long as they are associated with different * objects. * * @returns {Boolean} * True if the timer was successfully started, false otherwise. If a * timer already exists, it can't be started again, and the existing * one will be cleared in order to avoid measurements errors. */ startKeyed(histogramId, key, obj) { return true; } /** * Stops the timer associated with the given histogram (and object), * calculates the time delta between start and finish, and adds the value * to the histogram. * * @param {String} histogramId * A string which must be a valid histogram name. * @param {Object} obj * Optional parameter which associates the histogram timer with the * given object. * @param {Boolean} canceledOkay * Optional parameter which will suppress any warnings that normally * fire when a stopwatch is finished after being cancelled. * Defaults to false. * * @returns {Boolean} * True if the timer was succesfully stopped and the data was added * to the histogram, False otherwise. */ finish(histogramId, obj, canceledOkay) { return true; } /** * Stops the timer associated with the given keyed histogram (and object), * calculates the time delta between start and finish, and adds the value * to the keyed histogram. * * @param {String} histogramId * A string which must be a valid histogram name. * @param {String} key * A string which must be a valid histogram key. * @param {Object} obj * Optional parameter which associates the histogram timer with the * given object. * @param {Boolean} canceledOkay * Optional parameter which will suppress any warnings that normally * fire when a stopwatch is finished after being cancelled. * Defaults to false. * * @returns {Boolean} * True if the timer was succesfully stopped and the data was added * to the histogram, False otherwise. */ finishKeyed(histogramId, key, obj, cancelledOkay) { return true; } /** * Log a value to a histogram. * * @param {String} histogramId * Histogram in which the data is to be stored. */ getHistogramById(histogramId) { return { add: () => {} }; } /** * Get a keyed histogram. * * @param {String} histogramId * Histogram in which the data is to be stored. */ getKeyedHistogramById(histogramId) { return { add: () => {} }; } /** * Log a value to a scalar. * * @param {String} scalarId * Scalar in which the data is to be stored. * @param value * Value to store. */ scalarSet(scalarId, value) {} /** * Log a value to a count scalar. * * @param {String} scalarId * Scalar in which the data is to be stored. * @param value * Value to store. */ scalarAdd(scalarId, value) {} /** * Log a value to a keyed count scalar. * * @param {String} scalarId * Scalar in which the data is to be stored. * @param {String} key * The key within the scalar. * @param value * Value to store. */ keyedScalarAdd(scalarId, key, value) {} /** * Event telemetry is disabled by default. Use this method to enable it for * a particular category. * * @param {Boolean} enabled * Enabled: true or false. */ setEventRecordingEnabled(enabled) { return enabled; } /** * Telemetry events often need to make use of a number of properties from * completely different codepaths. To make this possible we create a * "pending event" along with an array of property names that we need to wait * for before sending the event. * * As each property is received via addEventProperty() we check if all * properties have been received. Once they have all been received we send the * telemetry event. * * @param {Object} obj * The telemetry event or ping is associated with this object, meaning * that multiple events or pings for the same histogram may be run * concurrently, as long as they are associated with different objects. * @param {String} method * The telemetry event method (describes the type of event that * occurred e.g. "open") * @param {String} object * The telemetry event object name (the name of the object the event * occurred on) e.g. "tools" or "setting" * @param {String|null} value * The telemetry event value (a user defined value, providing context * for the event) e.g. "console" * @param {Array} expected * An array of the properties needed before sending the telemetry * event e.g. * [ * "host", * "width" * ] */ preparePendingEvent(obj, method, object, value, expected = []) {} /** * Adds an expected property for either a current or future pending event. * This means that if preparePendingEvent() is called before or after sending * the event properties they will automatically added to the event. * * @param {Object} obj * The telemetry event or ping is associated with this object, meaning * that multiple events or pings for the same histogram may be run * concurrently, as long as they are associated with different objects. * @param {String} method * The telemetry event method (describes the type of event that * occurred e.g. "open") * @param {String} object * The telemetry event object name (the name of the object the event * occurred on) e.g. "tools" or "setting" * @param {String|null} value * The telemetry event value (a user defined value, providing context * for the event) e.g. "console" * @param {String} pendingPropName * The pending property name * @param {String} pendingPropValue * The pending property value */ addEventProperty(obj, method, object, value, pendingPropName, pendingPropValue) {} /** * Adds expected properties for either a current or future pending event. * This means that if preparePendingEvent() is called before or after sending * the event properties they will automatically added to the event. * * @param {Object} obj * The telemetry event or ping is associated with this object, meaning * that multiple events or pings for the same histogram may be run * concurrently, as long as they are associated with different objects. * @param {String} method * The telemetry event method (describes the type of event that * occurred e.g. "open") * @param {String} object * The telemetry event object name (the name of the object the event * occurred on) e.g. "tools" or "setting" * @param {String|null} value * The telemetry event value (a user defined value, providing context * for the event) e.g. "console" * @param {String} pendingObject * An object containing key, value pairs that should be added to the * event as properties. */ addEventProperties(obj, method, object, value, pendingObject) {} /** * A private method that is not to be used externally. This method is used to * prepare a pending telemetry event for sending and then send it via * recordEvent(). * * @param {Object} obj * The telemetry event or ping is associated with this object, meaning * that multiple events or pings for the same histogram may be run * concurrently, as long as they are associated with different objects. * @param {String} method * The telemetry event method (describes the type of event that * occurred e.g. "open") * @param {String} object * The telemetry event object name (the name of the object the event * occurred on) e.g. "tools" or "setting" * @param {String|null} value * The telemetry event value (a user defined value, providing context * for the event) e.g. "console" */ _sendPendingEvent(obj, method, object, value) {} /** * Send a telemetry event. * * @param {String} method * The telemetry event method (describes the type of event that * occurred e.g. "open") * @param {String} object * The telemetry event object name (the name of the object the event * occurred on) e.g. "tools" or "setting" * @param {String|null} value * The telemetry event value (a user defined value, providing context * for the event) e.g. "console" * @param {Object} extra * The telemetry event extra object containing the properties that will * be sent with the event e.g. * { * host: "bottom", * width: "1024" * } */ recordEvent(method, object, value, extra) {} /** * Sends telemetry pings to indicate that a tool has been opened. * * @param {String} id * The ID of the tool opened. * @param {String} sessionId * Toolbox session id used when we need to ensure a tool really has a * timer before calculating a delta. * @param {Object} obj * The telemetry event or ping is associated with this object, meaning * that multiple events or pings for the same histogram may be run * concurrently, as long as they are associated with different objects. */ toolOpened(id, sessionId, obj) {} /** * Sends telemetry pings to indicate that a tool has been closed. * * @param {String} id * The ID of the tool opened. */ toolClosed(id, sessionId, obj) {} } module.exports = Telemetry; /***/ }), /* 430 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // This file is a chrome-API-free version of the module // devtools/client/shared/unicode-url.js in the mozilla-central repository, so // that it can be used in Chrome-API-free applications, such as the Launchpad. // But because of this, it cannot take advantage of utilizing chrome APIs and // should implement the similar functionalities on its own. // // Please keep in mind that if the feature in this file has changed, don't // forget to also change that accordingly in // devtools/client/shared/unicode-url.js in the mozilla-central repository. const punycode = __webpack_require__(62); /** * Gets a readble Unicode hostname from a hostname. * * If the `hostname` is a readable ASCII hostname, such as example.org, then * this function will simply return the original `hostname`. * * If the `hostname` is a Punycode hostname representing a Unicode domain name, * such as xn--g6w.xn--8pv, then this function will return the readable Unicode * domain name by decoding the Punycode hostname. * * @param {string} hostname * the hostname from which the Unicode hostname will be * parsed, such as example.org, xn--g6w.xn--8pv. * @return {string} The Unicode hostname. It may be the same as the `hostname` * passed to this function if the `hostname` itself is * a readable ASCII hostname or a Unicode hostname. */ function getUnicodeHostname(hostname) { try { return punycode.toUnicode(hostname); } catch (err) {} return hostname; } /** * Gets a readble Unicode URL pathname from a URL pathname. * * If the `urlPath` is a readable ASCII URL pathname, such as /a/b/c.js, then * this function will simply return the original `urlPath`. * * If the `urlPath` is a URI-encoded pathname, such as %E8%A9%A6/%E6%B8%AC.js, * then this function will return the readable Unicode pathname. * * If the `urlPath` is a malformed URL pathname, then this function will simply * return the original `urlPath`. * * @param {string} urlPath * the URL path from which the Unicode URL path will be parsed, * such as /a/b/c.js, %E8%A9%A6/%E6%B8%AC.js. * @return {string} The Unicode URL Path. It may be the same as the `urlPath` * passed to this function if the `urlPath` itself is a readable * ASCII url or a Unicode url. */ function getUnicodeUrlPath(urlPath) { try { return decodeURIComponent(urlPath); } catch (err) {} return urlPath; } /** * Gets a readable Unicode URL from a URL. * * If the `url` is a readable ASCII URL, such as http://example.org/a/b/c.js, * then this function will simply return the original `url`. * * If the `url` includes either an unreadable Punycode domain name or an * unreadable URI-encoded pathname, such as * http://xn--g6w.xn--8pv/%E8%A9%A6/%E6%B8%AC.js, then this function will return * the readable URL by decoding all its unreadable URL components to Unicode * characters. * * If the `url` is a malformed URL, then this function will return the original * `url`. * * If the `url` is a data: URI, then this function will return the original * `url`. * * @param {string} url * the full URL, or a data: URI. from which the readable URL * will be parsed, such as, http://example.org/a/b/c.js, * http://xn--g6w.xn--8pv/%E8%A9%A6/%E6%B8%AC.js * @return {string} The readable URL. It may be the same as the `url` passed to * this function if the `url` itself is readable. */ function getUnicodeUrl(url) { try { const { protocol, hostname } = new URL(url); if (protocol === "data:") { // Never convert a data: URI. return url; } const readableHostname = getUnicodeHostname(hostname); url = decodeURIComponent(url); return url.replace(hostname, readableHostname); } catch (err) {} return url; } module.exports = { getUnicodeHostname, getUnicodeUrlPath, getUnicodeUrl }; /***/ }), /* 431 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 432 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {(function() { var Query, defaultPathSeparator, filter, matcher, parseOptions, pathScorer, preparedQueryCache, scorer; filter = __webpack_require__(433); matcher = __webpack_require__(434); scorer = __webpack_require__(66); pathScorer = __webpack_require__(111); Query = __webpack_require__(184); preparedQueryCache = null; defaultPathSeparator = (typeof process !== "undefined" && process !== null ? process.platform : void 0) === "win32" ? '\\' : '/'; module.exports = { filter: function(candidates, query, options) { if (options == null) { options = {}; } if (!((query != null ? query.length : void 0) && (candidates != null ? candidates.length : void 0))) { return []; } options = parseOptions(options, query); return filter(candidates, query, options); }, score: function(string, query, options) { if (options == null) { options = {}; } if (!((string != null ? string.length : void 0) && (query != null ? query.length : void 0))) { return 0; } options = parseOptions(options, query); if (options.usePathScoring) { return pathScorer.score(string, query, options); } else { return scorer.score(string, query, options); } }, match: function(string, query, options) { var _i, _ref, _results; if (options == null) { options = {}; } if (!string) { return []; } if (!query) { return []; } if (string === query) { return (function() { _results = []; for (var _i = 0, _ref = string.length; 0 <= _ref ? _i < _ref : _i > _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); } return _results; }).apply(this); } options = parseOptions(options, query); return matcher.match(string, query, options); }, wrap: function(string, query, options) { if (options == null) { options = {}; } if (!string) { return []; } if (!query) { return []; } options = parseOptions(options, query); return matcher.wrap(string, query, options); }, prepareQuery: function(query, options) { if (options == null) { options = {}; } options = parseOptions(options, query); return options.preparedQuery; } }; parseOptions = function(options, query) { if (options.allowErrors == null) { options.allowErrors = false; } if (options.usePathScoring == null) { options.usePathScoring = true; } if (options.useExtensionBonus == null) { options.useExtensionBonus = false; } if (options.pathSeparator == null) { options.pathSeparator = defaultPathSeparator; } if (options.optCharRegEx == null) { options.optCharRegEx = null; } if (options.wrap == null) { options.wrap = null; } if (options.preparedQuery == null) { options.preparedQuery = preparedQueryCache && preparedQueryCache.query === query ? preparedQueryCache : (preparedQueryCache = new Query(query, options)); } return options; }; }).call(this); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35))) /***/ }), /* 433 */ /***/ (function(module, exports, __webpack_require__) { (function() { var Query, pathScorer, pluckCandidates, scorer, sortCandidates; scorer = __webpack_require__(66); pathScorer = __webpack_require__(111); Query = __webpack_require__(184); pluckCandidates = function(a) { return a.candidate; }; sortCandidates = function(a, b) { return b.score - a.score; }; module.exports = function(candidates, query, options) { var bKey, candidate, key, maxInners, maxResults, score, scoreProvider, scoredCandidates, spotLeft, string, usePathScoring, _i, _len; scoredCandidates = []; key = options.key, maxResults = options.maxResults, maxInners = options.maxInners, usePathScoring = options.usePathScoring; spotLeft = (maxInners != null) && maxInners > 0 ? maxInners : candidates.length + 1; bKey = key != null; scoreProvider = usePathScoring ? pathScorer : scorer; for (_i = 0, _len = candidates.length; _i < _len; _i++) { candidate = candidates[_i]; string = bKey ? candidate[key] : candidate; if (!string) { continue; } score = scoreProvider.score(string, query, options); if (score > 0) { scoredCandidates.push({ candidate: candidate, score: score }); if (!--spotLeft) { break; } } } scoredCandidates.sort(sortCandidates); candidates = scoredCandidates.map(pluckCandidates); if (maxResults != null) { candidates = candidates.slice(0, maxResults); } return candidates; }; }).call(this); /***/ }), /* 434 */ /***/ (function(module, exports, __webpack_require__) { (function() { var basenameMatch, computeMatch, isMatch, isWordStart, match, mergeMatches, scoreAcronyms, scoreCharacter, scoreConsecutives, _ref; _ref = __webpack_require__(66), isMatch = _ref.isMatch, isWordStart = _ref.isWordStart, scoreConsecutives = _ref.scoreConsecutives, scoreCharacter = _ref.scoreCharacter, scoreAcronyms = _ref.scoreAcronyms; exports.match = match = function(string, query, options) { var allowErrors, baseMatches, matches, pathSeparator, preparedQuery, string_lw; allowErrors = options.allowErrors, preparedQuery = options.preparedQuery, pathSeparator = options.pathSeparator; if (!(allowErrors || isMatch(string, preparedQuery.core_lw, preparedQuery.core_up))) { return []; } string_lw = string.toLowerCase(); matches = computeMatch(string, string_lw, preparedQuery); if (matches.length === 0) { return matches; } if (string.indexOf(pathSeparator) > -1) { baseMatches = basenameMatch(string, string_lw, preparedQuery, pathSeparator); matches = mergeMatches(matches, baseMatches); } return matches; }; exports.wrap = function(string, query, options) { var matchIndex, matchPos, matchPositions, output, strPos, tagClass, tagClose, tagOpen, _ref1; if ((options.wrap != null)) { _ref1 = options.wrap, tagClass = _ref1.tagClass, tagOpen = _ref1.tagOpen, tagClose = _ref1.tagClose; } if (tagClass == null) { tagClass = 'highlight'; } if (tagOpen == null) { tagOpen = ''; } if (tagClose == null) { tagClose = ''; } if (string === query) { return tagOpen + string + tagClose; } matchPositions = match(string, query, options); if (matchPositions.length === 0) { return string; } output = ''; matchIndex = -1; strPos = 0; while (++matchIndex < matchPositions.length) { matchPos = matchPositions[matchIndex]; if (matchPos > strPos) { output += string.substring(strPos, matchPos); strPos = matchPos; } while (++matchIndex < matchPositions.length) { if (matchPositions[matchIndex] === matchPos + 1) { matchPos++; } else { matchIndex--; break; } } matchPos++; if (matchPos > strPos) { output += tagOpen; output += string.substring(strPos, matchPos); output += tagClose; strPos = matchPos; } } if (strPos <= string.length - 1) { output += string.substring(strPos); } return output; }; basenameMatch = function(subject, subject_lw, preparedQuery, pathSeparator) { var basePos, depth, end; end = subject.length - 1; while (subject[end] === pathSeparator) { end--; } basePos = subject.lastIndexOf(pathSeparator, end); if (basePos === -1) { return []; } depth = preparedQuery.depth; while (depth-- > 0) { basePos = subject.lastIndexOf(pathSeparator, basePos - 1); if (basePos === -1) { return []; } } basePos++; end++; return computeMatch(subject.slice(basePos, end), subject_lw.slice(basePos, end), preparedQuery, basePos); }; mergeMatches = function(a, b) { var ai, bj, i, j, m, n, out; m = a.length; n = b.length; if (n === 0) { return a.slice(); } if (m === 0) { return b.slice(); } i = -1; j = 0; bj = b[j]; out = []; while (++i < m) { ai = a[i]; while (bj <= ai && ++j < n) { if (bj < ai) { out.push(bj); } bj = b[j]; } out.push(ai); } while (j < n) { out.push(b[j++]); } return out; }; computeMatch = function(subject, subject_lw, preparedQuery, offset) { var DIAGONAL, LEFT, STOP, UP, acro_score, align, backtrack, csc_diag, csc_row, csc_score, i, j, m, matches, move, n, pos, query, query_lw, score, score_diag, score_row, score_up, si_lw, start, trace; if (offset == null) { offset = 0; } query = preparedQuery.query; query_lw = preparedQuery.query_lw; m = subject.length; n = query.length; acro_score = scoreAcronyms(subject, subject_lw, query, query_lw).score; score_row = new Array(n); csc_row = new Array(n); STOP = 0; UP = 1; LEFT = 2; DIAGONAL = 3; trace = new Array(m * n); pos = -1; j = -1; while (++j < n) { score_row[j] = 0; csc_row[j] = 0; } i = -1; while (++i < m) { score = 0; score_up = 0; csc_diag = 0; si_lw = subject_lw[i]; j = -1; while (++j < n) { csc_score = 0; align = 0; score_diag = score_up; if (query_lw[j] === si_lw) { start = isWordStart(i, subject, subject_lw); csc_score = csc_diag > 0 ? csc_diag : scoreConsecutives(subject, subject_lw, query, query_lw, i, j, start); align = score_diag + scoreCharacter(i, j, start, acro_score, csc_score); } score_up = score_row[j]; csc_diag = csc_row[j]; if (score > score_up) { move = LEFT; } else { score = score_up; move = UP; } if (align > score) { score = align; move = DIAGONAL; } else { csc_score = 0; } score_row[j] = score; csc_row[j] = csc_score; trace[++pos] = score > 0 ? move : STOP; } } i = m - 1; j = n - 1; pos = i * n + j; backtrack = true; matches = []; while (backtrack && i >= 0 && j >= 0) { switch (trace[pos]) { case UP: i--; pos -= n; break; case LEFT: j--; pos--; break; case DIAGONAL: matches.push(i + offset); j--; i--; pos -= n + 1; break; default: backtrack = false; } } matches.reverse(); return matches; }; }).call(this); /***/ }), /* 435 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined; var _propTypes = __webpack_require__(0); var PropTypes = _interopRequireWildcard(_propTypes); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(112); var _reactDom2 = _interopRequireDefault(_reactDom); var _reactLifecyclesCompat = __webpack_require__(436); var _PropTypes = __webpack_require__(437); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var UNMOUNTED = exports.UNMOUNTED = 'unmounted'; var EXITED = exports.EXITED = 'exited'; var ENTERING = exports.ENTERING = 'entering'; var ENTERED = exports.ENTERED = 'entered'; var EXITING = exports.EXITING = 'exiting'; /** * The Transition component lets you describe a transition from one component * state to another _over time_ with a simple declarative API. Most commonly * it's used to animate the mounting and unmounting of a component, but can also * be used to describe in-place transition states as well. * * By default the `Transition` component does not alter the behavior of the * component it renders, it only tracks "enter" and "exit" states for the components. * It's up to you to give meaning and effect to those states. For example we can * add styles to a component when it enters or exits: * * ```jsx * import Transition from 'react-transition-group/Transition'; * * const duration = 300; * * const defaultStyle = { * transition: `opacity ${duration}ms ease-in-out`, * opacity: 0, * } * * const transitionStyles = { * entering: { opacity: 0 }, * entered: { opacity: 1 }, * }; * * const Fade = ({ in: inProp }) => ( * * {(state) => ( *
* I'm a fade Transition! *
* )} *
* ); * ``` * * As noted the `Transition` component doesn't _do_ anything by itself to its child component. * What it does do is track transition states over time so you can update the * component (such as by adding styles or classes) when it changes states. * * There are 4 main states a Transition can be in: * - `'entering'` * - `'entered'` * - `'exiting'` * - `'exited'` * * Transition state is toggled via the `in` prop. When `true` the component begins the * "Enter" stage. During this stage, the component will shift from its current transition state, * to `'entering'` for the duration of the transition and then to the `'entered'` stage once * it's complete. Let's take the following example: * * ```jsx * state = { in: false }; * * toggleEnterState = () => { * this.setState({ in: true }); * } * * render() { * return ( *
* * *
* ); * } * ``` * * When the button is clicked the component will shift to the `'entering'` state and * stay there for 500ms (the value of `timeout`) before it finally switches to `'entered'`. * * When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`. * * ## Timing * * Timing is often the trickiest part of animation, mistakes can result in slight delays * that are hard to pin down. A common example is when you want to add an exit transition, * you should set the desired final styles when the state is `'exiting'`. That's when the * transition to those styles will start and, if you matched the `timeout` prop with the * CSS Transition duration, it will end exactly when the state changes to `'exited'`. * * > **Note**: For simpler transitions the `Transition` component might be enough, but * > take into account that it's platform-agnostic, while the `CSSTransition` component * > [forces reflows](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215) * > in order to make more complex transitions more predictable. For example, even though * > classes `example-enter` and `example-enter-active` are applied immediately one after * > another, you can still transition from one to the other because of the forced reflow * > (read [this issue](https://github.com/reactjs/react-transition-group/issues/159#issuecomment-322761171) * > for more info). Take this into account when choosing between `Transition` and * > `CSSTransition`. * * ## Example * * * */ var Transition = function (_React$Component) { _inherits(Transition, _React$Component); function Transition(props, context) { _classCallCheck(this, Transition); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; var initialStatus = void 0; _this.appearStatus = null; if (props.in) { if (appear) { initialStatus = EXITED; _this.appearStatus = ENTERING; } else { initialStatus = ENTERED; } } else { if (props.unmountOnExit || props.mountOnEnter) { initialStatus = UNMOUNTED; } else { initialStatus = EXITED; } } _this.state = { status: initialStatus }; _this.nextCallback = null; return _this; } Transition.prototype.getChildContext = function getChildContext() { return { transitionGroup: null // allows for nested Transitions }; }; Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { var nextIn = _ref.in; if (nextIn && prevState.status === UNMOUNTED) { return { status: EXITED }; } return null; }; // getSnapshotBeforeUpdate(prevProps) { // let nextStatus = null // if (prevProps !== this.props) { // const { status } = this.state // if (this.props.in) { // if (status !== ENTERING && status !== ENTERED) { // nextStatus = ENTERING // } // } else { // if (status === ENTERING || status === ENTERED) { // nextStatus = EXITING // } // } // } // return { nextStatus } // } Transition.prototype.componentDidMount = function componentDidMount() { this.updateStatus(true, this.appearStatus); }; Transition.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { var nextStatus = null; if (prevProps !== this.props) { var status = this.state.status; if (this.props.in) { if (status !== ENTERING && status !== ENTERED) { nextStatus = ENTERING; } } else { if (status === ENTERING || status === ENTERED) { nextStatus = EXITING; } } } this.updateStatus(false, nextStatus); }; Transition.prototype.componentWillUnmount = function componentWillUnmount() { this.cancelNextCallback(); }; Transition.prototype.getTimeouts = function getTimeouts() { var timeout = this.props.timeout; var exit = void 0, enter = void 0, appear = void 0; exit = enter = appear = timeout; if (timeout != null && typeof timeout !== 'number') { exit = timeout.exit; enter = timeout.enter; appear = timeout.appear; } return { exit: exit, enter: enter, appear: appear }; }; Transition.prototype.updateStatus = function updateStatus() { var mounting = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var nextStatus = arguments[1]; if (nextStatus !== null) { // nextStatus will always be ENTERING or EXITING. this.cancelNextCallback(); var node = _reactDom2.default.findDOMNode(this); if (nextStatus === ENTERING) { this.performEnter(node, mounting); } else { this.performExit(node); } } else if (this.props.unmountOnExit && this.state.status === EXITED) { this.setState({ status: UNMOUNTED }); } }; Transition.prototype.performEnter = function performEnter(node, mounting) { var _this2 = this; var enter = this.props.enter; var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting; var timeouts = this.getTimeouts(); // no enter animation skip right to ENTERED // if we are mounting and running this it means appear _must_ be set if (!mounting && !enter) { this.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node); }); return; } this.props.onEnter(node, appearing); this.safeSetState({ status: ENTERING }, function () { _this2.props.onEntering(node, appearing); // FIXME: appear timeout? _this2.onTransitionEnd(node, timeouts.enter, function () { _this2.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node, appearing); }); }); }); }; Transition.prototype.performExit = function performExit(node) { var _this3 = this; var exit = this.props.exit; var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED if (!exit) { this.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); return; } this.props.onExit(node); this.safeSetState({ status: EXITING }, function () { _this3.props.onExiting(node); _this3.onTransitionEnd(node, timeouts.exit, function () { _this3.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); }); }); }; Transition.prototype.cancelNextCallback = function cancelNextCallback() { if (this.nextCallback !== null) { this.nextCallback.cancel(); this.nextCallback = null; } }; Transition.prototype.safeSetState = function safeSetState(nextState, callback) { // This shouldn't be necessary, but there are weird race conditions with // setState callbacks and unmounting in testing, so always make sure that // we can cancel any pending setState callbacks after we unmount. callback = this.setNextCallback(callback); this.setState(nextState, callback); }; Transition.prototype.setNextCallback = function setNextCallback(callback) { var _this4 = this; var active = true; this.nextCallback = function (event) { if (active) { active = false; _this4.nextCallback = null; callback(event); } }; this.nextCallback.cancel = function () { active = false; }; return this.nextCallback; }; Transition.prototype.onTransitionEnd = function onTransitionEnd(node, timeout, handler) { this.setNextCallback(handler); if (node) { if (this.props.addEndListener) { this.props.addEndListener(node, this.nextCallback); } if (timeout != null) { setTimeout(this.nextCallback, timeout); } } else { setTimeout(this.nextCallback, 0); } }; Transition.prototype.render = function render() { var status = this.state.status; if (status === UNMOUNTED) { return null; } var _props = this.props, children = _props.children, childProps = _objectWithoutProperties(_props, ['children']); // filter props for Transtition delete childProps.in; delete childProps.mountOnEnter; delete childProps.unmountOnExit; delete childProps.appear; delete childProps.enter; delete childProps.exit; delete childProps.timeout; delete childProps.addEndListener; delete childProps.onEnter; delete childProps.onEntering; delete childProps.onEntered; delete childProps.onExit; delete childProps.onExiting; delete childProps.onExited; if (typeof children === 'function') { return children(status, childProps); } var child = _react2.default.Children.only(children); return _react2.default.cloneElement(child, childProps); }; return Transition; }(_react2.default.Component); Transition.contextTypes = { transitionGroup: PropTypes.object }; Transition.childContextTypes = { transitionGroup: function transitionGroup() {} }; Transition.propTypes = false ? { /** * A `function` child can be used instead of a React element. * This function is called with the current transition status * ('entering', 'entered', 'exiting', 'exited', 'unmounted'), which can be used * to apply context specific props to a component. * * ```jsx * * {(status) => ( * * )} * * ``` */ children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired, /** * Show the component; triggers the enter or exit states */ in: PropTypes.bool, /** * By default the child component is mounted immediately along with * the parent `Transition` component. If you want to "lazy mount" the component on the * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay * mounted, even on "exited", unless you also specify `unmountOnExit`. */ mountOnEnter: PropTypes.bool, /** * By default the child component stays mounted after it reaches the `'exited'` state. * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting. */ unmountOnExit: PropTypes.bool, /** * Normally a component is not transitioned if it is shown when the `` component mounts. * If you want to transition on the first mount set `appear` to `true`, and the * component will transition in as soon as the `` mounts. * * > Note: there are no specific "appear" states. `appear` only adds an additional `enter` transition. */ appear: PropTypes.bool, /** * Enable or disable enter transitions. */ enter: PropTypes.bool, /** * Enable or disable exit transitions. */ exit: PropTypes.bool, /** * The duration of the transition, in milliseconds. * Required unless `addEndListener` is provided * * You may specify a single timeout for all transitions like: `timeout={500}`, * or individually like: * * ```jsx * timeout={{ * enter: 300, * exit: 500, * }} * ``` * * @type {number | { enter?: number, exit?: number }} */ timeout: function timeout(props) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var pt = _PropTypes.timeoutsShape; if (!props.addEndListener) pt = pt.isRequired; return pt.apply(undefined, [props].concat(args)); }, /** * Add a custom transition end trigger. Called with the transitioning * DOM node and a `done` callback. Allows for more fine grained transition end * logic. **Note:** Timeouts are still used as a fallback if provided. * * ```jsx * addEndListener={(node, done) => { * // use the css transitionend event to mark the finish of a transition * node.addEventListener('transitionend', done, false); * }} * ``` */ addEndListener: PropTypes.func, /** * Callback fired before the "entering" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) -> void */ onEnter: PropTypes.func, /** * Callback fired after the "entering" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) */ onEntering: PropTypes.func, /** * Callback fired after the "entered" status is applied. An extra parameter * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount * * @type Function(node: HtmlElement, isAppearing: bool) -> void */ onEntered: PropTypes.func, /** * Callback fired before the "exiting" status is applied. * * @type Function(node: HtmlElement) -> void */ onExit: PropTypes.func, /** * Callback fired after the "exiting" status is applied. * * @type Function(node: HtmlElement) -> void */ onExiting: PropTypes.func, /** * Callback fired after the "exited" status is applied. * * @type Function(node: HtmlElement) -> void */ onExited: PropTypes.func // Name the function so it is clearer in the documentation } : {};function noop() {} Transition.defaultProps = { in: false, mountOnEnter: false, unmountOnExit: false, appear: false, enter: true, exit: true, onEnter: noop, onEntering: noop, onEntered: noop, onExit: noop, onExiting: noop, onExited: noop }; Transition.UNMOUNTED = 0; Transition.EXITED = 1; Transition.ENTERING = 2; Transition.ENTERED = 3; Transition.EXITING = 4; exports.default = (0, _reactLifecyclesCompat.polyfill)(Transition); /***/ }), /* 436 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyfill", function() { return polyfill; }); /** * Copyright (c) 2013-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 componentWillMount() { // Call this.constructor.gDSFP to support sub-classes. var state = this.constructor.getDerivedStateFromProps(this.props, this.state); if (state !== null && state !== undefined) { this.setState(state); } } function componentWillReceiveProps(nextProps) { // Call this.constructor.gDSFP to support sub-classes. // Use the setState() updater to ensure state isn't stale in certain edge cases. function updater(prevState) { var state = this.constructor.getDerivedStateFromProps(nextProps, prevState); return state !== null && state !== undefined ? state : null; } // Binding "this" is important for shallow renderer support. this.setState(updater.bind(this)); } function componentWillUpdate(nextProps, nextState) { try { var prevProps = this.props; var prevState = this.state; this.props = nextProps; this.state = nextState; this.__reactInternalSnapshotFlag = true; this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate( prevProps, prevState ); } finally { this.props = prevProps; this.state = prevState; } } // React may warn about cWM/cWRP/cWU methods being deprecated. // Add a flag to suppress these warnings for this special case. componentWillMount.__suppressDeprecationWarning = true; componentWillReceiveProps.__suppressDeprecationWarning = true; componentWillUpdate.__suppressDeprecationWarning = true; function polyfill(Component) { var prototype = Component.prototype; if (!prototype || !prototype.isReactComponent) { throw new Error('Can only polyfill class components'); } if ( typeof Component.getDerivedStateFromProps !== 'function' && typeof prototype.getSnapshotBeforeUpdate !== 'function' ) { return Component; } // If new component APIs are defined, "unsafe" lifecycles won't be called. // Error if any of these lifecycles are present, // Because they would work differently between older and newer (16.3+) versions of React. var foundWillMountName = null; var foundWillReceivePropsName = null; var foundWillUpdateName = null; if (typeof prototype.componentWillMount === 'function') { foundWillMountName = 'componentWillMount'; } else if (typeof prototype.UNSAFE_componentWillMount === 'function') { foundWillMountName = 'UNSAFE_componentWillMount'; } if (typeof prototype.componentWillReceiveProps === 'function') { foundWillReceivePropsName = 'componentWillReceiveProps'; } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') { foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; } if (typeof prototype.componentWillUpdate === 'function') { foundWillUpdateName = 'componentWillUpdate'; } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') { foundWillUpdateName = 'UNSAFE_componentWillUpdate'; } if ( foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null ) { var componentName = Component.displayName || Component.name; var newApiName = typeof Component.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; throw Error( 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + componentName + ' uses ' + newApiName + ' but also contains the following legacy lifecycles:' + (foundWillMountName !== null ? '\n ' + foundWillMountName : '') + (foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '') + (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') + '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks' ); } // React <= 16.2 does not support static getDerivedStateFromProps. // As a workaround, use cWM and cWRP to invoke the new static lifecycle. // Newer versions of React will ignore these lifecycles if gDSFP exists. if (typeof Component.getDerivedStateFromProps === 'function') { prototype.componentWillMount = componentWillMount; prototype.componentWillReceiveProps = componentWillReceiveProps; } // React <= 16.2 does not support getSnapshotBeforeUpdate. // As a workaround, use cWU to invoke the new lifecycle. // Newer versions of React will ignore that lifecycle if gSBU exists. if (typeof prototype.getSnapshotBeforeUpdate === 'function') { if (typeof prototype.componentDidUpdate !== 'function') { throw new Error( 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype' ); } prototype.componentWillUpdate = componentWillUpdate; var componentDidUpdate = prototype.componentDidUpdate; prototype.componentDidUpdate = function componentDidUpdatePolyfill( prevProps, prevState, maybeSnapshot ) { // 16.3+ will not execute our will-update method; // It will pass a snapshot value to did-update though. // Older versions will require our polyfilled will-update value. // We need to handle both cases, but can't just check for the presence of "maybeSnapshot", // Because for <= 15.x versions this might be a "prevContext" object. // We also can't just check "__reactInternalSnapshot", // Because get-snapshot might return a falsy value. // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior. var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot; componentDidUpdate.call(this, prevProps, prevState, snapshot); }; } return Component; } /***/ }), /* 437 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.classNamesShape = exports.timeoutsShape = undefined; exports.transitionTimeout = transitionTimeout; var _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function transitionTimeout(transitionType) { var timeoutPropName = 'transition' + transitionType + 'Timeout'; var enabledPropName = 'transition' + transitionType; return function (props) { // If the transition is enabled if (props[enabledPropName]) { // If no timeout duration is provided if (props[timeoutPropName] == null) { return new Error(timeoutPropName + ' wasn\'t supplied to CSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); // If the duration isn't a number } else if (typeof props[timeoutPropName] !== 'number') { return new Error(timeoutPropName + ' must be a number (in milliseconds)'); } } return null; }; } var timeoutsShape = exports.timeoutsShape = _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }).isRequired]); var classNamesShape = exports.classNamesShape = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({ enter: _propTypes2.default.string, exit: _propTypes2.default.string, active: _propTypes2.default.string }), _propTypes2.default.shape({ enter: _propTypes2.default.string, enterDone: _propTypes2.default.string, enterActive: _propTypes2.default.string, exit: _propTypes2.default.string, exitDone: _propTypes2.default.string, exitActive: _propTypes2.default.string })]); /***/ }), /* 438 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _tabList = __webpack_require__(185); Object.defineProperty(exports, 'TabList', { enumerable: true, get: function get() { return _interopRequireDefault(_tabList).default; } }); var _tabPanels = __webpack_require__(187); Object.defineProperty(exports, 'TabPanels', { enumerable: true, get: function get() { return _interopRequireDefault(_tabPanels).default; } }); var _tab = __webpack_require__(186); Object.defineProperty(exports, 'Tab', { enumerable: true, get: function get() { return _interopRequireDefault(_tab).default; } }); var _tabs = __webpack_require__(442); Object.defineProperty(exports, 'Tabs', { enumerable: true, get: function get() { return _interopRequireDefault(_tabs).default; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), /* 439 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _propTypes2.default.object; /***/ }), /* 440 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 441 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 442 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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 _propTypes = __webpack_require__(0); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(6); var _react2 = _interopRequireDefault(_react); var _uniqueId = __webpack_require__(443); var _uniqueId2 = _interopRequireDefault(_uniqueId); var _tabList = __webpack_require__(185); var _tabList2 = _interopRequireDefault(_tabList); var _tabPanels = __webpack_require__(187); var _tabPanels2 = _interopRequireDefault(_tabPanels); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Tabs = function (_React$Component) { _inherits(Tabs, _React$Component); function Tabs() { _classCallCheck(this, Tabs); var _this = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this)); _this.accessibleId = (0, _uniqueId2.default)(); return _this; } _createClass(Tabs, [{ key: 'render', value: function render() { var _props = this.props, activeIndex = _props.activeIndex, children = _props.children, className = _props.className, onActivateTab = _props.onActivateTab; var accessibleId = this.accessibleId; return _react2.default.createElement( 'div', { className: className }, _react2.default.Children.map(children, function (child) { if (!child) { return child; } switch (child.type) { case _tabList2.default: return _react2.default.cloneElement(child, { accessibleId: accessibleId, activeIndex: activeIndex, onActivateTab: onActivateTab }); case _tabPanels2.default: return _react2.default.cloneElement(child, { accessibleId: accessibleId, activeIndex: activeIndex }); default: return child; } }) ); } }]); return Tabs; }(_react2.default.Component); exports.default = Tabs; Tabs.propTypes = { activeIndex: _propTypes2.default.number.isRequired, children: _propTypes2.default.node, className: _propTypes2.default.string, onActivateTab: _propTypes2.default.func }; Tabs.defaultProps = { children: null, className: undefined, onActivateTab: function onActivateTab() {} }; /***/ }), /* 443 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = uniqueId; var counter = 0; function uniqueId() { counter += 1; return "$rac$" + counter; } /***/ }), /* 444 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["defaultMemoize"] = defaultMemoize; /* harmony export (immutable) */ __webpack_exports__["createSelectorCreator"] = createSelectorCreator; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSelector", function() { return createSelector; }); /* harmony export (immutable) */ __webpack_exports__["createStructuredSelector"] = createStructuredSelector; function defaultEqualityCheck(a, b) { return a === b; } function areArgumentsShallowlyEqual(equalityCheck, prev, next) { if (prev === null || next === null || prev.length !== next.length) { return false; } // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible. var length = prev.length; for (var i = 0; i < length; i++) { if (!equalityCheck(prev[i], next[i])) { return false; } } return true; } function defaultMemoize(func) { var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck; var lastArgs = null; var lastResult = null; // we reference arguments instead of spreading them for performance reasons return function () { if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) { // apply arguments instead of spreading for performance. lastResult = func.apply(null, arguments); } lastArgs = arguments; return lastResult; }; } function getDependencies(funcs) { var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs; if (!dependencies.every(function (dep) { return typeof dep === 'function'; })) { var dependencyTypes = dependencies.map(function (dep) { return typeof dep; }).join(', '); throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']')); } return dependencies; } function createSelectorCreator(memoize) { for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { memoizeOptions[_key - 1] = arguments[_key]; } return function () { for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { funcs[_key2] = arguments[_key2]; } var recomputations = 0; var resultFunc = funcs.pop(); var dependencies = getDependencies(funcs); var memoizedResultFunc = memoize.apply(undefined, [function () { recomputations++; // apply arguments instead of spreading for performance. return resultFunc.apply(null, arguments); }].concat(memoizeOptions)); // If a selector is called with the exact same arguments we don't need to traverse our dependencies again. var selector = memoize(function () { var params = []; var length = dependencies.length; for (var i = 0; i < length; i++) { // apply arguments instead of spreading and mutate a local list of params for performance. params.push(dependencies[i].apply(null, arguments)); } // apply arguments instead of spreading for performance. return memoizedResultFunc.apply(null, params); }); selector.resultFunc = resultFunc; selector.dependencies = dependencies; selector.recomputations = function () { return recomputations; }; selector.resetRecomputations = function () { return recomputations = 0; }; return selector; }; } var createSelector = createSelectorCreator(defaultMemoize); function createStructuredSelector(selectors) { var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector; if (typeof selectors !== 'object') { throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors)); } var objectKeys = Object.keys(selectors); return selectorCreator(objectKeys.map(function (key) { return selectors[key]; }), function () { for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { values[_key3] = arguments[_key3]; } return values.reduce(function (composition, value, index) { composition[objectKeys[index]] = value; return composition; }, {}); }); } /***/ }), /* 445 */ /***/ (function(module, exports, __webpack_require__) { const SplitBox = __webpack_require__(446); module.exports = SplitBox; /***/ }), /* 446 */ /***/ (function(module, exports, __webpack_require__) { /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const React = __webpack_require__(6); const ReactDOM = __webpack_require__(112); const Draggable = React.createFactory(__webpack_require__(447)); const { Component } = React; const PropTypes = __webpack_require__(0); const dom = __webpack_require__(1); __webpack_require__(448); /** * This component represents a Splitter. The splitter supports vertical * as well as horizontal mode. */ class SplitBox extends Component { static get propTypes() { return { // Custom class name. You can use more names separated by a space. className: PropTypes.string, // Initial size of controlled panel. initialSize: PropTypes.any, // Optional initial width of controlled panel. initialWidth: PropTypes.number, // Optional initial height of controlled panel. initialHeight: PropTypes.number, // Left/top panel startPanel: PropTypes.any, // Left/top panel collapse state. startPanelCollapsed: PropTypes.bool, // Min panel size. minSize: PropTypes.any, // Max panel size. maxSize: PropTypes.any, // Right/bottom panel endPanel: PropTypes.any, // Right/bottom panel collapse state. endPanelCollapsed: PropTypes.bool, // True if the right/bottom panel should be controlled. endPanelControl: PropTypes.bool, // Size of the splitter handle bar. splitterSize: PropTypes.number, // True if the splitter bar is vertical (default is vertical). vert: PropTypes.bool, // Optional style properties passed into the splitbox style: PropTypes.object, // Optional callback when splitbox resize stops onResizeEnd: PropTypes.func }; } static get defaultProps() { return { splitterSize: 5, vert: true, endPanelControl: false, endPanelCollapsed: false, startPanelCollapsed: false }; } constructor(props) { super(props); this.state = { vert: props.vert, // We use integers for these properties width: parseInt(props.initialWidth || props.initialSize, 10), height: parseInt(props.initialHeight || props.initialSize, 10) }; this.onStartMove = this.onStartMove.bind(this); this.onStopMove = this.onStopMove.bind(this); this.onMove = this.onMove.bind(this); this.preparePanelStyles = this.preparePanelStyles.bind(this); } componentWillReceiveProps(nextProps) { if (this.props.vert !== nextProps.vert) { this.setState({ vert: nextProps.vert }); } if (this.props.initialSize !== nextProps.initialSize || this.props.initialWidth !== nextProps.initialWidth || this.props.initialHeight !== nextProps.initialHeight) { this.setState({ width: parseInt(nextProps.initialWidth || nextProps.initialSize, 10), height: parseInt(nextProps.initialHeight || nextProps.initialSize, 10) }); } } // Dragging Events /** * Set 'resizing' cursor on entire document during splitter dragging. * This avoids cursor-flickering that happens when the mouse leaves * the splitter bar area (happens frequently). */ onStartMove() { const splitBox = ReactDOM.findDOMNode(this); const doc = splitBox.ownerDocument; const defaultCursor = doc.documentElement.style.cursor; doc.documentElement.style.cursor = this.state.vert ? "ew-resize" : "ns-resize"; splitBox.classList.add("dragging"); document.dispatchEvent(new CustomEvent("drag:start")); this.setState({ defaultCursor: defaultCursor }); } onStopMove() { const splitBox = ReactDOM.findDOMNode(this); const doc = splitBox.ownerDocument; doc.documentElement.style.cursor = this.state.defaultCursor; splitBox.classList.remove("dragging"); document.dispatchEvent(new CustomEvent("drag:end")); if (this.props.onResizeEnd) { this.props.onResizeEnd(this.state.vert ? this.state.width : this.state.height); } } /** * Adjust size of the controlled panel. Depending on the current * orientation we either remember the width or height of * the splitter box. */ onMove({ movementX, movementY }) { const node = ReactDOM.findDOMNode(this); const doc = node.ownerDocument; if (this.props.endPanelControl) { // For the end panel we need to increase the width/height when the // movement is towards the left/top. movementX = -movementX; movementY = -movementY; } if (this.state.vert) { const isRtl = doc.dir === "rtl"; if (isRtl) { // In RTL we need to reverse the movement again -- but only for vertical // splitters movementX = -movementX; } this.setState((state, props) => ({ width: state.width + movementX })); } else { this.setState((state, props) => ({ height: state.height + movementY })); } } // Rendering preparePanelStyles() { const vert = this.state.vert; const { minSize, maxSize, startPanelCollapsed, endPanelControl, endPanelCollapsed } = this.props; let leftPanelStyle, rightPanelStyle; // Set proper size for panels depending on the current state. if (vert) { const startWidth = endPanelControl ? null : this.state.width, endWidth = endPanelControl ? this.state.width : null; leftPanelStyle = { maxWidth: endPanelControl ? null : maxSize, minWidth: endPanelControl ? null : minSize, width: startPanelCollapsed ? 0 : startWidth }; rightPanelStyle = { maxWidth: endPanelControl ? maxSize : null, minWidth: endPanelControl ? minSize : null, width: endPanelCollapsed ? 0 : endWidth }; } else { const startHeight = endPanelControl ? null : this.state.height, endHeight = endPanelControl ? this.state.height : null; leftPanelStyle = { maxHeight: endPanelControl ? null : maxSize, minHeight: endPanelControl ? null : minSize, height: endPanelCollapsed ? maxSize : startHeight }; rightPanelStyle = { maxHeight: endPanelControl ? maxSize : null, minHeight: endPanelControl ? minSize : null, height: startPanelCollapsed ? maxSize : endHeight }; } return { leftPanelStyle, rightPanelStyle }; } render() { const vert = this.state.vert; const { startPanelCollapsed, startPanel, endPanel, endPanelControl, splitterSize, endPanelCollapsed } = this.props; const style = Object.assign({}, this.props.style); // Calculate class names list. let classNames = ["split-box"]; classNames.push(vert ? "vert" : "horz"); if (this.props.className) { classNames = classNames.concat(this.props.className.split(" ")); } const { leftPanelStyle, rightPanelStyle } = this.preparePanelStyles(); // Calculate splitter size const splitterStyle = { flex: `0 0 ${splitterSize}px` }; return dom.div({ className: classNames.join(" "), style: style }, !startPanelCollapsed ? dom.div({ className: endPanelControl ? "uncontrolled" : "controlled", style: leftPanelStyle }, startPanel) : null, Draggable({ className: "splitter", style: splitterStyle, onStart: this.onStartMove, onStop: this.onStopMove, onMove: this.onMove }), !endPanelCollapsed ? dom.div({ className: endPanelControl ? "controlled" : "uncontrolled", style: rightPanelStyle }, endPanel) : null); } } module.exports = SplitBox; /***/ }), /* 447 */ /***/ (function(module, exports, __webpack_require__) { /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const React = __webpack_require__(6); const ReactDOM = __webpack_require__(112); const { Component } = React; const PropTypes = __webpack_require__(0); const dom = __webpack_require__(1); class Draggable extends Component { static get propTypes() { return { onMove: PropTypes.func.isRequired, onStart: PropTypes.func, onStop: PropTypes.func, style: PropTypes.object, className: PropTypes.string }; } constructor(props) { super(props); this.startDragging = this.startDragging.bind(this); this.onMove = this.onMove.bind(this); this.onUp = this.onUp.bind(this); } startDragging(ev) { ev.preventDefault(); const doc = ReactDOM.findDOMNode(this).ownerDocument; doc.addEventListener("mousemove", this.onMove); doc.addEventListener("mouseup", this.onUp); this.props.onStart && this.props.onStart(); } onMove(ev) { ev.preventDefault(); // When the target is outside of the document, its tagName is undefined if (!ev.target.tagName) { return; } // We pass the whole event because we don't know which properties // the callee needs. this.props.onMove(ev); } onUp(ev) { ev.preventDefault(); const doc = ReactDOM.findDOMNode(this).ownerDocument; doc.removeEventListener("mousemove", this.onMove); doc.removeEventListener("mouseup", this.onUp); this.props.onStop && this.props.onStop(); } render() { return dom.div({ style: this.props.style, className: this.props.className, onMouseDown: this.startDragging }); } } module.exports = Draggable; /***/ }), /* 448 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 449 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = move; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function move(array, moveIndex, toIndex) { /* #move - Moves an array item from one position in an array to another. Note: This is a pure function so a new array will be returned, instead of altering the array argument. Arguments: 1. array (String) : Array in which to move an item. (required) 2. moveIndex (Object) : The index of the item to move. (required) 3. toIndex (Object) : The index to move item at moveIndex to. (required) */ var item = array[moveIndex]; var length = array.length; var diff = moveIndex - toIndex; if (diff > 0) { // move left return [].concat(_toConsumableArray(array.slice(0, toIndex)), [item], _toConsumableArray(array.slice(toIndex, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, length))); } else if (diff < 0) { // move right return [].concat(_toConsumableArray(array.slice(0, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, toIndex + 1)), [item], _toConsumableArray(array.slice(toIndex + 1, length))); } return array; } /***/ }), /* 450 */, /* 451 */, /* 452 */, /* 453 */, /* 454 */, /* 455 */, /* 456 */, /* 457 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { MODE } = __webpack_require__(4); const { REPS, getRep } = __webpack_require__(24); const objectInspector = __webpack_require__(482); const { parseURLEncodedText, parseURLParams, maybeEscapePropertyName, getGripPreviewItems } = __webpack_require__(2); module.exports = { REPS, getRep, MODE, maybeEscapePropertyName, parseURLEncodedText, parseURLParams, getGripPreviewItems, objectInspector }; /***/ }), /* 458 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 459 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders undefined value */ const Undefined = function () { return span({ className: "objectBox objectBox-undefined" }, "undefined"); }; function supportsObject(object, noGrip = false) { if (noGrip === true) { return object === undefined; } return object && object.type && object.type == "undefined" || getGripType(object, noGrip) == "undefined"; } // Exports from this module module.exports = { rep: wrapRender(Undefined), supportsObject }; /***/ }), /* 460 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const { wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders null value */ function Null(props) { return span({ className: "objectBox objectBox-null" }, "null"); } function supportsObject(object, noGrip = false) { if (noGrip === true) { return object === null; } if (object && object.type && object.type == "null") { return true; } return object == null; } // Exports from this module module.exports = { rep: wrapRender(Null), supportsObject }; /***/ }), /* 461 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a number */ Number.propTypes = { object: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.bool]).isRequired }; function Number(props) { const value = props.object; return span({ className: "objectBox objectBox-number" }, stringify(value)); } function stringify(object) { const isNegativeZero = Object.is(object, -0) || object.type && object.type == "-0"; return isNegativeZero ? "-0" : String(object); } function supportsObject(object, noGrip = false) { return ["boolean", "number", "-0"].includes(getGripType(object, noGrip)); } // Exports from this module module.exports = { rep: wrapRender(Number), supportsObject }; /***/ }), /* 462 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { wrapRender, ellipsisElement } = __webpack_require__(2); const PropRep = __webpack_require__(39); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; const DEFAULT_TITLE = "Object"; /** * Renders an object. An object is represented by a list of its * properties enclosed in curly brackets. */ ObjectRep.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), title: PropTypes.string }; function ObjectRep(props) { const object = props.object; const propsArray = safePropIterator(props, object); if (props.mode === MODE.TINY) { const tinyModeItems = []; if (getTitle(props, object) !== DEFAULT_TITLE) { tinyModeItems.push(getTitleElement(props, object)); } else { tinyModeItems.push(span({ className: "objectLeftBrace" }, "{"), propsArray.length > 0 ? ellipsisElement : null, span({ className: "objectRightBrace" }, "}")); } return span({ className: "objectBox objectBox-object" }, ...tinyModeItems); } return span({ className: "objectBox objectBox-object" }, getTitleElement(props, object), span({ className: "objectLeftBrace" }, " { "), ...propsArray, span({ className: "objectRightBrace" }, " }")); } function getTitleElement(props, object) { return span({ className: "objectTitle" }, getTitle(props, object)); } function getTitle(props, object) { return props.title || DEFAULT_TITLE; } function safePropIterator(props, object, max) { max = typeof max === "undefined" ? 3 : max; try { return propIterator(props, object, max); } catch (err) { console.error(err); } return []; } function propIterator(props, object, max) { // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=945377 if (Object.prototype.toString.call(object) === "[object Generator]") { object = Object.getPrototypeOf(object); } const elements = []; const unimportantProperties = []; let propertiesNumber = 0; const propertiesNames = Object.keys(object); const pushPropRep = (name, value) => { elements.push(PropRep({ ...props, key: name, mode: MODE.TINY, name, object: value, equal: ": " })); propertiesNumber++; if (propertiesNumber < propertiesNames.length) { elements.push(", "); } }; try { for (const name of propertiesNames) { if (propertiesNumber >= max) { break; } let value; try { value = object[name]; } catch (exc) { continue; } // Object members with non-empty values are preferred since it gives the // user a better overview of the object. if (isInterestingProp(value)) { pushPropRep(name, value); } else { // If the property is not important, put its name on an array for later // use. unimportantProperties.push(name); } } } catch (err) { console.error(err); } if (propertiesNumber < max) { for (const name of unimportantProperties) { if (propertiesNumber >= max) { break; } let value; try { value = object[name]; } catch (exc) { continue; } pushPropRep(name, value); } } if (propertiesNumber < propertiesNames.length) { elements.push(ellipsisElement); } return elements; } function isInterestingProp(value) { const type = typeof value; return type == "boolean" || type == "number" || type == "string" && value; } function supportsObject(object, noGrip = false) { return noGrip; } // Exports from this module module.exports = { rep: wrapRender(ObjectRep), supportsObject }; /***/ }), /* 463 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { rep: StringRep } = __webpack_require__(25); const { span } = dom; const MAX_STRING_LENGTH = 50; /** * Renders a symbol. */ SymbolRep.propTypes = { object: PropTypes.object.isRequired }; function SymbolRep(props) { const { className = "objectBox objectBox-symbol", object } = props; const { name } = object; let symbolText = name || ""; if (name && name.type && name.type === "longString") { symbolText = StringRep({ object: symbolText, shouldCrop: true, cropLimit: MAX_STRING_LENGTH, useQuotes: false }); } return span({ className, "data-link-actor-id": object.actor }, "Symbol(", symbolText, ")"); } function supportsObject(object, noGrip = false) { return getGripType(object, noGrip) == "symbol"; } // Exports from this module module.exports = { rep: wrapRender(SymbolRep), supportsObject }; /***/ }), /* 464 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a Infinity object */ InfinityRep.propTypes = { object: PropTypes.object.isRequired }; function InfinityRep(props) { const { object } = props; return span({ className: "objectBox objectBox-number" }, object.type); } function supportsObject(object, noGrip = false) { const type = getGripType(object, noGrip); return type == "Infinity" || type == "-Infinity"; } // Exports from this module module.exports = { rep: wrapRender(InfinityRep), supportsObject }; /***/ }), /* 465 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const { getGripType, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a NaN object */ function NaNRep(props) { return span({ className: "objectBox objectBox-nan" }, "NaN"); } function supportsObject(object, noGrip = false) { return getGripType(object, noGrip) == "NaN"; } // Exports from this module module.exports = { rep: wrapRender(NaNRep), supportsObject }; /***/ }), /* 466 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const dom = __webpack_require__(1); const PropTypes = __webpack_require__(0); const { wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const { span } = dom; /** * Renders an object. An object is represented by a list of its * properties enclosed in curly brackets. */ Accessor.propTypes = { object: PropTypes.object.isRequired, mode: PropTypes.oneOf(Object.values(MODE)) }; function Accessor(props) { const { object, evaluation, onInvokeGetterButtonClick } = props; if (evaluation) { const { Rep, Grip } = __webpack_require__(24); return span({ className: "objectBox objectBox-accessor objectTitle" }, Rep({ ...props, object: evaluation.getterValue, mode: props.mode || MODE.TINY, defaultRep: Grip })); } if (hasGetter(object) && onInvokeGetterButtonClick) { return dom.button({ className: "invoke-getter", title: "Invoke getter", onClick: event => { onInvokeGetterButtonClick(); event.stopPropagation(); } }); } const accessors = []; if (hasGetter(object)) { accessors.push("Getter"); } if (hasSetter(object)) { accessors.push("Setter"); } return span({ className: "objectBox objectBox-accessor objectTitle" }, accessors.join(" & ")); } function hasGetter(object) { return object && object.get && object.get.type !== "undefined"; } function hasSetter(object) { return object && object.set && object.set.type !== "undefined"; } function supportsObject(object, noGrip = false) { if (noGrip !== true && (hasGetter(object) || hasSetter(object))) { return true; } return false; } // Exports from this module module.exports = { rep: wrapRender(Accessor), supportsObject }; /***/ }), /* 467 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); const { button, span } = __webpack_require__(1); // Utils const { isGrip, wrapRender } = __webpack_require__(2); const { rep: StringRep } = __webpack_require__(25); /** * Renders Accessible object. */ Accessible.propTypes = { object: PropTypes.object.isRequired, inspectIconTitle: PropTypes.string, nameMaxLength: PropTypes.number, onAccessibleClick: PropTypes.func, onAccessibleMouseOver: PropTypes.func, onAccessibleMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func, roleFirst: PropTypes.bool, separatorText: PropTypes.string }; function Accessible(props) { const { object, inspectIconTitle, nameMaxLength, onAccessibleClick, onAccessibleMouseOver, onAccessibleMouseOut, onInspectIconClick, roleFirst, separatorText } = props; const elements = getElements(object, nameMaxLength, roleFirst, separatorText); const isInTree = object.preview && object.preview.isConnected === true; const baseConfig = { "data-link-actor-id": object.actor, className: "objectBox objectBox-accessible" }; let inspectIcon; if (isInTree) { if (onAccessibleClick) { Object.assign(baseConfig, { onClick: _ => onAccessibleClick(object), className: `${baseConfig.className} clickable` }); } if (onAccessibleMouseOver) { Object.assign(baseConfig, { onMouseOver: _ => onAccessibleMouseOver(object) }); } if (onAccessibleMouseOut) { Object.assign(baseConfig, { onMouseOut: onAccessibleMouseOut }); } if (onInspectIconClick) { inspectIcon = button({ className: "open-accessibility-inspector", title: inspectIconTitle, onClick: e => { if (onAccessibleClick) { e.stopPropagation(); } onInspectIconClick(object, e); } }); } } return span(baseConfig, ...elements, inspectIcon); } function getElements(grip, nameMaxLength, roleFirst = false, separatorText = ": ") { const { name, role } = grip.preview; const elements = []; if (name) { elements.push(StringRep({ className: "accessible-name", object: name, cropLimit: nameMaxLength }), span({ className: "separator" }, separatorText)); } elements.push(span({ className: "accessible-role" }, role)); return roleFirst ? elements.reverse() : elements; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return object.preview && object.typeName && object.typeName === "accessible"; } // Exports from this module module.exports = { rep: wrapRender(Accessible), supportsObject }; /***/ }), /* 468 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); const dom = __webpack_require__(1); const { span } = dom; // Reps const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const { rep: StringRep } = __webpack_require__(25); /** * Renders DOM attribute */ Attribute.propTypes = { object: PropTypes.object.isRequired }; function Attribute(props) { const { object } = props; const value = object.preview.value; return span({ "data-link-actor-id": object.actor, className: "objectBox-Attr" }, span({ className: "attrName" }, getTitle(object)), span({ className: "attrEqual" }, "="), StringRep({ className: "attrValue", object: value, title: value })); } function getTitle(grip) { return grip.preview.nodeName; } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return getGripType(grip, noGrip) == "Attr" && grip.preview; } module.exports = { rep: wrapRender(Attribute), supportsObject }; /***/ }), /* 469 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Used to render JS built-in Date() object. */ DateTime.propTypes = { object: PropTypes.object.isRequired }; function DateTime(props) { const grip = props.object; let date; try { const dateObject = new Date(grip.preview.timestamp); // Calling `toISOString` will throw if the date is invalid, // so we can render an `Invalid Date` element. dateObject.toISOString(); date = span({ "data-link-actor-id": grip.actor, className: "objectBox" }, getTitle(grip), span({ className: "Date" }, dateObject.toString())); } catch (e) { date = span({ className: "objectBox" }, "Invalid Date"); } return date; } function getTitle(grip) { return span({ className: "objectTitle" }, `${grip.class} `); } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return getGripType(grip, noGrip) == "Date" && grip.preview; } // Exports from this module module.exports = { rep: wrapRender(DateTime), supportsObject }; /***/ }), /* 470 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, getURLDisplayString, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders DOM document object. */ Document.propTypes = { object: PropTypes.object.isRequired }; function Document(props) { const grip = props.object; const location = getLocation(grip); return span({ "data-link-actor-id": grip.actor, className: "objectBox objectBox-document" }, getTitle(grip), location ? span({ className: "location" }, ` ${location}`) : null); } function getLocation(grip) { const location = grip.preview.location; return location ? getURLDisplayString(location) : null; } function getTitle(grip) { return span({ className: "objectTitle" }, grip.class); } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } const type = getGripType(object, noGrip); return object.preview && (type === "HTMLDocument" || type === "XULDocument"); } // Exports from this module module.exports = { rep: wrapRender(Document), supportsObject }; /***/ }), /* 471 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders DOM documentType object. */ DocumentType.propTypes = { object: PropTypes.object.isRequired }; function DocumentType(props) { const { object } = props; const name = object && object.preview && object.preview.nodeName ? ` ${object.preview.nodeName}` : ""; return span({ "data-link-actor-id": props.object.actor, className: "objectBox objectBox-document" }, ``); } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } const type = getGripType(object, noGrip); return object.preview && type === "DocumentType"; } // Exports from this module module.exports = { rep: wrapRender(DocumentType), supportsObject }; /***/ }), /* 472 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { isGrip, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const { rep } = __webpack_require__(113); /** * Renders DOM event objects. */ Event.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function Event(props) { const gripProps = { ...props, title: getTitle(props), object: { ...props.object, preview: { ...props.object.preview, ownProperties: {} } } }; if (gripProps.object.preview.target) { Object.assign(gripProps.object.preview.ownProperties, { target: gripProps.object.preview.target }); } Object.assign(gripProps.object.preview.ownProperties, gripProps.object.preview.properties); delete gripProps.object.preview.properties; gripProps.object.ownPropertyLength = Object.keys(gripProps.object.preview.ownProperties).length; switch (gripProps.object.class) { case "MouseEvent": gripProps.isInterestingProp = (type, value, name) => { return ["target", "clientX", "clientY", "layerX", "layerY"].includes(name); }; break; case "KeyboardEvent": gripProps.isInterestingProp = (type, value, name) => { return ["target", "key", "charCode", "keyCode"].includes(name); }; break; case "MessageEvent": gripProps.isInterestingProp = (type, value, name) => { return ["target", "isTrusted", "data"].includes(name); }; break; default: gripProps.isInterestingProp = (type, value, name) => { // We want to show the properties in the order they are declared. return Object.keys(gripProps.object.preview.ownProperties).includes(name); }; } return rep(gripProps); } function getTitle(props) { const preview = props.object.preview; let title = preview.type; if (preview.eventKind == "key" && preview.modifiers && preview.modifiers.length) { title = `${title} ${preview.modifiers.join("-")}`; } return title; } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && grip.preview.kind == "DOMEvent"; } // Exports from this module module.exports = { rep: wrapRender(Event), supportsObject }; /***/ }), /* 473 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Dependencies const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const PropRep = __webpack_require__(39); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a DOM Promise object. */ PromiseRep.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function PromiseRep(props) { const object = props.object; const { promiseState } = object; const config = { "data-link-actor-id": object.actor, className: "objectBox objectBox-object" }; if (props.mode === MODE.TINY) { const { Rep } = __webpack_require__(24); return span(config, getTitle(object), span({ className: "objectLeftBrace" }, " { "), Rep({ object: promiseState.state }), span({ className: "objectRightBrace" }, " }")); } const propsArray = getProps(props, promiseState); return span(config, getTitle(object), span({ className: "objectLeftBrace" }, " { "), ...propsArray, span({ className: "objectRightBrace" }, " }")); } function getTitle(object) { return span({ className: "objectTitle" }, object.class); } function getProps(props, promiseState) { const keys = ["state"]; if (Object.keys(promiseState).includes("value")) { keys.push("value"); } return keys.reduce((res, key, i) => { const object = promiseState[key]; res = res.concat(PropRep({ ...props, mode: MODE.TINY, name: `<${key}>`, object, equal: ": ", suppressQuotes: true })); // Interleave commas between elements if (i !== keys.length - 1) { res.push(", "); } return res; }, []); } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return getGripType(object, noGrip) == "Promise"; } // Exports from this module module.exports = { rep: wrapRender(PromiseRep), supportsObject }; /***/ }), /* 474 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a grip object with regular expression. */ RegExp.propTypes = { object: PropTypes.object.isRequired }; function RegExp(props) { const { object } = props; return span({ "data-link-actor-id": object.actor, className: "objectBox objectBox-regexp regexpSource" }, getSource(object)); } function getSource(grip) { return grip.displayString; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return getGripType(object, noGrip) == "RegExp"; } // Exports from this module module.exports = { rep: wrapRender(RegExp), supportsObject }; /***/ }), /* 475 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, getURLDisplayString, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a grip representing CSSStyleSheet */ StyleSheet.propTypes = { object: PropTypes.object.isRequired }; function StyleSheet(props) { const grip = props.object; return span({ "data-link-actor-id": grip.actor, className: "objectBox objectBox-object" }, getTitle(grip), span({ className: "objectPropValue" }, getLocation(grip))); } function getTitle(grip) { const title = "StyleSheet "; return span({ className: "objectBoxTitle" }, title); } function getLocation(grip) { // Embedded stylesheets don't have URL and so, no preview. const url = grip.preview ? grip.preview.url : ""; return url ? getURLDisplayString(url) : ""; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return getGripType(object, noGrip) == "CSSStyleSheet"; } // Exports from this module module.exports = { rep: wrapRender(StyleSheet), supportsObject }; /***/ }), /* 476 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // Dependencies const PropTypes = __webpack_require__(0); const { isGrip, cropString, cropMultipleLines, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const nodeConstants = __webpack_require__(190); const dom = __webpack_require__(1); const { span } = dom; /** * Renders DOM comment node. */ CommentNode.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])) }; function CommentNode(props) { const { object, mode = MODE.SHORT } = props; let { textContent } = object.preview; if (mode === MODE.TINY) { textContent = cropMultipleLines(textContent, 30); } else if (mode === MODE.SHORT) { textContent = cropString(textContent, 50); } return span({ className: "objectBox theme-comment", "data-link-actor-id": object.actor }, ``); } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return object.preview && object.preview.nodeType === nodeConstants.COMMENT_NODE; } // Exports from this module module.exports = { rep: wrapRender(CommentNode), supportsObject }; /***/ }), /* 477 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Utils const { isGrip, wrapRender } = __webpack_require__(2); const { rep: StringRep, isLongString } = __webpack_require__(25); const { MODE } = __webpack_require__(4); const nodeConstants = __webpack_require__(190); const dom = __webpack_require__(1); const { span } = dom; const MAX_ATTRIBUTE_LENGTH = 50; /** * Renders DOM element node. */ ElementNode.propTypes = { object: PropTypes.object.isRequired, inspectIconTitle: PropTypes.string, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeClick: PropTypes.func, onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function ElementNode(props) { const { object, inspectIconTitle, mode, onDOMNodeClick, onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick } = props; const elements = getElements(object, mode); const isInTree = object.preview && object.preview.isConnected === true; const baseConfig = { "data-link-actor-id": object.actor, className: "objectBox objectBox-node" }; let inspectIcon; if (isInTree) { if (onDOMNodeClick) { Object.assign(baseConfig, { onClick: _ => onDOMNodeClick(object), className: `${baseConfig.className} clickable` }); } if (onDOMNodeMouseOver) { Object.assign(baseConfig, { onMouseOver: _ => onDOMNodeMouseOver(object) }); } if (onDOMNodeMouseOut) { Object.assign(baseConfig, { onMouseOut: onDOMNodeMouseOut }); } if (onInspectIconClick) { inspectIcon = dom.button({ className: "open-inspector", // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands title: inspectIconTitle || "Click to select the node in the inspector", onClick: e => { if (onDOMNodeClick) { e.stopPropagation(); } onInspectIconClick(object, e); } }); } } return span(baseConfig, ...elements, inspectIcon); } function getElements(grip, mode) { const { attributes, nodeName, isAfterPseudoElement, isBeforePseudoElement, isMarkerPseudoElement } = grip.preview; const nodeNameElement = span({ className: "tag-name" }, nodeName); let pseudoNodeName; if (isAfterPseudoElement) { pseudoNodeName = "after"; } else if (isBeforePseudoElement) { pseudoNodeName = "before"; } else if (isMarkerPseudoElement) { pseudoNodeName = "marker"; } if (pseudoNodeName) { return [span({ className: "attrName" }, `::${pseudoNodeName}`)]; } if (mode === MODE.TINY) { const elements = [nodeNameElement]; if (attributes.id) { elements.push(span({ className: "attrName" }, `#${attributes.id}`)); } if (attributes.class) { elements.push(span({ className: "attrName" }, attributes.class.trim().split(/\s+/).map(cls => `.${cls}`).join(""))); } return elements; } const attributeKeys = Object.keys(attributes); if (attributeKeys.includes("class")) { attributeKeys.splice(attributeKeys.indexOf("class"), 1); attributeKeys.unshift("class"); } if (attributeKeys.includes("id")) { attributeKeys.splice(attributeKeys.indexOf("id"), 1); attributeKeys.unshift("id"); } const attributeElements = attributeKeys.reduce((arr, name, i, keys) => { const value = attributes[name]; let title = isLongString(value) ? value.initial : value; if (title.length < MAX_ATTRIBUTE_LENGTH) { title = null; } const attribute = span({}, span({ className: "attrName" }, name), span({ className: "attrEqual" }, "="), StringRep({ className: "attrValue", object: value, cropLimit: MAX_ATTRIBUTE_LENGTH, title })); return arr.concat([" ", attribute]); }, []); return [span({ className: "angleBracket" }, "<"), nodeNameElement, ...attributeElements, span({ className: "angleBracket" }, ">")]; } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return object.preview && object.preview.nodeType === nodeConstants.ELEMENT_NODE; } // Exports from this module module.exports = { rep: wrapRender(ElementNode), supportsObject, MAX_ATTRIBUTE_LENGTH }; /***/ }), /* 478 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { isGrip, cropString, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; /** * Renders DOM #text node. */ TextNode.propTypes = { object: PropTypes.object.isRequired, // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), onDOMNodeMouseOver: PropTypes.func, onDOMNodeMouseOut: PropTypes.func, onInspectIconClick: PropTypes.func }; function TextNode(props) { const { object: grip, mode = MODE.SHORT, onDOMNodeMouseOver, onDOMNodeMouseOut, onInspectIconClick } = props; const baseConfig = { "data-link-actor-id": grip.actor, className: "objectBox objectBox-textNode" }; let inspectIcon; const isInTree = grip.preview && grip.preview.isConnected === true; if (isInTree) { if (onDOMNodeMouseOver) { Object.assign(baseConfig, { onMouseOver: _ => onDOMNodeMouseOver(grip) }); } if (onDOMNodeMouseOut) { Object.assign(baseConfig, { onMouseOut: onDOMNodeMouseOut }); } if (onInspectIconClick) { inspectIcon = dom.button({ className: "open-inspector", draggable: false, // TODO: Localize this with "openNodeInInspector" when Bug 1317038 lands title: "Click to select the node in the inspector", onClick: e => onInspectIconClick(grip, e) }); } } if (mode === MODE.TINY) { return span(baseConfig, getTitle(grip), inspectIcon); } return span(baseConfig, getTitle(grip), span({ className: "nodeValue" }, " ", `"${getTextContent(grip)}"`), inspectIcon); } function getTextContent(grip) { return cropString(grip.preview.textContent); } function getTitle(grip) { const title = "#text"; return span({}, title); } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && grip.class == "Text"; } // Exports from this module module.exports = { rep: wrapRender(TextNode), supportsObject }; /***/ }), /* 479 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { getGripType, isGrip, getURLDisplayString, wrapRender } = __webpack_require__(2); const { MODE } = __webpack_require__(4); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a grip representing a window. */ WindowRep.propTypes = { // @TODO Change this to Object.values when supported in Node's version of V8 mode: PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])), object: PropTypes.object.isRequired }; function WindowRep(props) { const { mode, object } = props; const config = { "data-link-actor-id": object.actor, className: "objectBox objectBox-Window" }; if (mode === MODE.TINY) { return span(config, getTitle(object)); } return span(config, getTitle(object, true), span({ className: "location" }, getLocation(object))); } function getTitle(object, trailingSpace) { let title = object.displayClass || object.class || "Window"; if (trailingSpace === true) { title = `${title} `; } return span({ className: "objectTitle" }, title); } function getLocation(object) { return getURLDisplayString(object.preview.url); } // Registration function supportsObject(object, noGrip = false) { if (noGrip === true || !isGrip(object)) { return false; } return object.preview && getGripType(object, noGrip) == "Window"; } // Exports from this module module.exports = { rep: wrapRender(WindowRep), supportsObject }; /***/ }), /* 480 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { isGrip, wrapRender } = __webpack_require__(2); const String = __webpack_require__(25).rep; const dom = __webpack_require__(1); const { span } = dom; /** * Renders a grip object with textual data. */ ObjectWithText.propTypes = { object: PropTypes.object.isRequired }; function ObjectWithText(props) { const grip = props.object; return span({ "data-link-actor-id": grip.actor, className: `objectTitle objectBox objectBox-${getType(grip)}` }, `${getType(grip)} `, getDescription(grip)); } function getType(grip) { return grip.class; } function getDescription(grip) { return String({ object: grip.preview.text }); } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && grip.preview.kind == "ObjectWithText"; } // Exports from this module module.exports = { rep: wrapRender(ObjectWithText), supportsObject }; /***/ }), /* 481 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // ReactJS const PropTypes = __webpack_require__(0); // Reps const { isGrip, getURLDisplayString, wrapRender } = __webpack_require__(2); const dom = __webpack_require__(1); const { span } = dom; /** * Renders a grip object with URL data. */ ObjectWithURL.propTypes = { object: PropTypes.object.isRequired }; function ObjectWithURL(props) { const grip = props.object; return span({ "data-link-actor-id": grip.actor, className: `objectBox objectBox-${getType(grip)}` }, getTitle(grip), span({ className: "objectPropValue" }, getDescription(grip))); } function getTitle(grip) { return span({ className: "objectTitle" }, `${getType(grip)} `); } function getType(grip) { return grip.class; } function getDescription(grip) { return getURLDisplayString(grip.preview.url); } // Registration function supportsObject(grip, noGrip = false) { if (noGrip === true || !isGrip(grip)) { return false; } return grip.preview && grip.preview.kind == "ObjectWithURL"; } // Exports from this module module.exports = { rep: wrapRender(ObjectWithURL), supportsObject }; /***/ }), /* 482 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const ObjectInspector = __webpack_require__(483); const utils = __webpack_require__(116); const reducer = __webpack_require__(115); module.exports = { ObjectInspector, utils, reducer }; /***/ }), /* 483 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _devtoolsComponents = __webpack_require__(108); var _devtoolsComponents2 = _interopRequireDefault(_devtoolsComponents); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { Component, createFactory, createElement } = __webpack_require__(6); const { connect } = __webpack_require__(484); const actions = __webpack_require__(485); const selectors = __webpack_require__(115); const Tree = createFactory(_devtoolsComponents2.default.Tree); __webpack_require__(486); const ObjectInspectorItem = createFactory(__webpack_require__(487)); const classnames = __webpack_require__(67); const Utils = __webpack_require__(116); const { renderRep, shouldRenderRootsInReps } = Utils; const { getChildrenWithEvaluations, getActor, getParent, getValue, nodeIsPrimitive, nodeHasGetter, nodeHasSetter } = Utils.node; // This implements a component that renders an interactive inspector // for looking at JavaScript objects. It expects descriptions of // objects from the protocol, and will dynamically fetch children // properties as objects are expanded. // // If you want to inspect a single object, pass the name and the // protocol descriptor of it: // // ObjectInspector({ // name: "foo", // desc: { writable: true, ..., { value: { actor: "1", ... }}}, // ... // }) // // If you want multiple top-level objects (like scopes), you can pass // an array of manually constructed nodes as `roots`: // // ObjectInspector({ // roots: [{ name: ... }, ...], // ... // }); // There are 3 types of nodes: a simple node with a children array, an // object that has properties that should be children when they are // fetched, and a primitive value that should be displayed with no // children. class ObjectInspector extends Component { constructor(props) { super(); this.cachedNodes = new Map(); const self = this; self.getItemChildren = this.getItemChildren.bind(this); self.isNodeExpandable = this.isNodeExpandable.bind(this); self.setExpanded = this.setExpanded.bind(this); self.focusItem = this.focusItem.bind(this); self.activateItem = this.activateItem.bind(this); self.getRoots = this.getRoots.bind(this); self.getNodeKey = this.getNodeKey.bind(this); self.shouldItemUpdate = this.shouldItemUpdate.bind(this); } componentWillMount() { this.roots = this.props.roots; this.focusedItem = this.props.focusedItem; this.activeItem = this.props.activeItem; } componentWillUpdate(nextProps) { this.removeOutdatedNodesFromCache(nextProps); if (this.roots !== nextProps.roots) { // Since the roots changed, we assume the properties did as well, // so we need to cleanup the component internal state. this.roots = nextProps.roots; this.focusedItem = nextProps.focusedItem; this.activeItem = nextProps.activeItem; if (this.props.rootsChanged) { this.props.rootsChanged(); } } } removeOutdatedNodesFromCache(nextProps) { // When the roots changes, we can wipe out everything. if (this.roots !== nextProps.roots) { this.cachedNodes.clear(); return; } // If there are new evaluations, we want to remove the existing cached // nodes from the cache. if (nextProps.evaluations > this.props.evaluations) { for (const key of nextProps.evaluations.keys()) { if (!this.props.evaluations.has(key)) { this.cachedNodes.delete(key); } } } } shouldComponentUpdate(nextProps) { const { expandedPaths, loadedProperties, evaluations } = this.props; // We should update if: // - there are new loaded properties // - OR there are new evaluations // - OR the expanded paths number changed, and all of them have properties // loaded // - OR the expanded paths number did not changed, but old and new sets // differ // - OR the focused node changed. // - OR the active node changed. return loadedProperties.size !== nextProps.loadedProperties.size || evaluations.size !== nextProps.evaluations.size || expandedPaths.size !== nextProps.expandedPaths.size && [...nextProps.expandedPaths].every(path => nextProps.loadedProperties.has(path)) || expandedPaths.size === nextProps.expandedPaths.size && [...nextProps.expandedPaths].some(key => !expandedPaths.has(key)) || this.focusedItem !== nextProps.focusedItem || this.activeItem !== nextProps.activeItem || this.roots !== nextProps.roots; } componentWillUnmount() { this.props.closeObjectInspector(); } getItemChildren(item) { const { loadedProperties, evaluations } = this.props; const { cachedNodes } = this; return getChildrenWithEvaluations({ evaluations, loadedProperties, cachedNodes, item }); } getRoots() { return this.props.roots; } getNodeKey(item) { return item.path && typeof item.path.toString === "function" ? item.path.toString() : JSON.stringify(item); } isNodeExpandable(item) { if (nodeIsPrimitive(item)) { return false; } if (nodeHasSetter(item) || nodeHasGetter(item)) { return false; } return true; } setExpanded(item, expand) { if (!this.isNodeExpandable(item)) { return; } const { nodeExpand, nodeCollapse, recordTelemetryEvent, roots } = this.props; if (expand === true) { const actor = getActor(item, roots); nodeExpand(item, actor); if (recordTelemetryEvent) { recordTelemetryEvent("object_expanded"); } } else { nodeCollapse(item); } } focusItem(item) { const { focusable = true, onFocus } = this.props; if (focusable && this.focusedItem !== item) { this.focusedItem = item; this.forceUpdate(); if (onFocus) { onFocus(item); } } } activateItem(item) { const { focusable = true, onActivate } = this.props; if (focusable && this.activeItem !== item) { this.activeItem = item; this.forceUpdate(); if (onActivate) { onActivate(item); } } } shouldItemUpdate(prevItem, nextItem) { const value = getValue(nextItem); // Long string should always update because fullText loading will not // trigger item re-render. return value && value.type === "longString"; } render() { const { autoExpandAll = true, autoExpandDepth = 1, focusable = true, disableWrap = false, expandedPaths, inline } = this.props; return Tree({ className: classnames({ inline, nowrap: disableWrap, "object-inspector": true }), autoExpandAll, autoExpandDepth, isExpanded: item => expandedPaths && expandedPaths.has(item.path), isExpandable: this.isNodeExpandable, focused: this.focusedItem, active: this.activeItem, getRoots: this.getRoots, getParent, getChildren: this.getItemChildren, getKey: this.getNodeKey, onExpand: item => this.setExpanded(item, true), onCollapse: item => this.setExpanded(item, false), onFocus: focusable ? this.focusItem : null, onActivate: focusable ? this.activateItem : null, shouldItemUpdate: this.shouldItemUpdate, renderItem: (item, depth, focused, arrow, expanded) => ObjectInspectorItem({ ...this.props, item, depth, focused, arrow, expanded, setExpanded: this.setExpanded }) }); } } function mapStateToProps(state, props) { return { expandedPaths: selectors.getExpandedPaths(state), loadedProperties: selectors.getLoadedProperties(state), evaluations: selectors.getEvaluations(state) }; } const OI = connect(mapStateToProps, actions)(ObjectInspector); module.exports = props => { const { roots } = props; if (shouldRenderRootsInReps(roots)) { return renderRep(roots[0], props); } return createElement(OI, props); }; /***/ }), /* 484 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_484__; /***/ }), /* 485 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const { loadItemProperties } = __webpack_require__(196); /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { getLoadedProperties, getActors } = __webpack_require__(115); /** * This action is responsible for expanding a given node, which also means that * it will call the action responsible to fetch properties. */ function nodeExpand(node, actor) { return async ({ dispatch, getState }) => { dispatch({ type: "NODE_EXPAND", data: { node } }); dispatch(nodeLoadProperties(node, actor)); }; } function nodeCollapse(node) { return { type: "NODE_COLLAPSE", data: { node } }; } /* * This action checks if we need to fetch properties, entries, prototype and * symbols for a given node. If we do, it will call the appropriate ObjectClient * functions. */ function nodeLoadProperties(node, actor) { return async ({ dispatch, client, getState }) => { const state = getState(); const loadedProperties = getLoadedProperties(state); if (loadedProperties.has(node.path)) { return; } try { const properties = await loadItemProperties(node, client.createObjectClient, client.createLongStringClient, loadedProperties); dispatch(nodePropertiesLoaded(node, actor, properties)); } catch (e) { console.error(e); } }; } function nodePropertiesLoaded(node, actor, properties) { return { type: "NODE_PROPERTIES_LOADED", data: { node, actor, properties } }; } function closeObjectInspector() { return async ({ getState, client }) => { releaseActors(getState(), client); }; } /* * This action is dispatched when the `roots` prop, provided by a consumer of * the ObjectInspector (inspector, console, …), is modified. It will clean the * internal state properties (expandedPaths, loadedProperties, …) and release * the actors consumed with the previous roots. * It takes a props argument which reflects what is passed by the upper-level * consumer. */ function rootsChanged(props) { return async ({ dispatch, client, getState }) => { releaseActors(getState(), client); dispatch({ type: "ROOTS_CHANGED", data: props }); }; } function releaseActors(state, client) { const actors = getActors(state); for (const actor of actors) { client.releaseActor(actor); } } function invokeGetter(node, targetGrip, receiverId, getterName) { return async ({ dispatch, client, getState }) => { try { const objectClient = client.createObjectClient(targetGrip); const result = await objectClient.getPropertyValue(getterName, receiverId); dispatch({ type: "GETTER_INVOKED", data: { node, result } }); } catch (e) { console.error(e); } }; } module.exports = { closeObjectInspector, invokeGetter, nodeExpand, nodeCollapse, nodeLoadProperties, nodePropertiesLoaded, rootsChanged }; /***/ }), /* 486 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /* 487 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _devtoolsServices = __webpack_require__(37); var _devtoolsServices2 = _interopRequireDefault(_devtoolsServices); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ const { Component } = __webpack_require__(6); const dom = __webpack_require__(1); const { appinfo } = _devtoolsServices2.default; const isMacOS = appinfo.OS === "Darwin"; const classnames = __webpack_require__(67); const { MODE } = __webpack_require__(4); const Utils = __webpack_require__(116); const { getValue, nodeHasAccessors, nodeHasProperties, nodeIsBlock, nodeIsDefaultProperties, nodeIsFunction, nodeIsGetter, nodeIsMapEntry, nodeIsMissingArguments, nodeIsOptimizedOut, nodeIsPrimitive, nodeIsPrototype, nodeIsSetter, nodeIsUninitializedBinding, nodeIsUnmappedBinding, nodeIsUnscopedBinding, nodeIsWindow, nodeIsLongString, nodeHasFullText, nodeHasGetter, getNonPrototypeParentGripValue, getParentGripValue } = Utils.node; class ObjectInspectorItem extends Component { // eslint-disable-next-line complexity getLabelAndValue() { const { item, depth, expanded, mode } = this.props; const label = item.name; const isPrimitive = nodeIsPrimitive(item); if (nodeIsOptimizedOut(item)) { return { label, value: dom.span({ className: "unavailable" }, "(optimized away)") }; } if (nodeIsUninitializedBinding(item)) { return { label, value: dom.span({ className: "unavailable" }, "(uninitialized)") }; } if (nodeIsUnmappedBinding(item)) { return { label, value: dom.span({ className: "unavailable" }, "(unmapped)") }; } if (nodeIsUnscopedBinding(item)) { return { label, value: dom.span({ className: "unavailable" }, "(unscoped)") }; } const itemValue = getValue(item); const unavailable = isPrimitive && itemValue && itemValue.hasOwnProperty && itemValue.hasOwnProperty("unavailable"); if (nodeIsMissingArguments(item) || unavailable) { return { label, value: dom.span({ className: "unavailable" }, "(unavailable)") }; } if (nodeIsFunction(item) && !nodeIsGetter(item) && !nodeIsSetter(item) && (mode === MODE.TINY || !mode)) { return { label: Utils.renderRep(item, { ...this.props, functionName: label }) }; } if (nodeHasProperties(item) || nodeHasAccessors(item) || nodeIsMapEntry(item) || nodeIsLongString(item) || isPrimitive) { const repProps = { ...this.props }; if (depth > 0) { repProps.mode = mode === MODE.LONG ? MODE.SHORT : MODE.TINY; } if (expanded) { repProps.mode = MODE.TINY; } if (nodeIsLongString(item)) { repProps.member = { open: nodeHasFullText(item) && expanded }; } if (nodeHasGetter(item)) { const targetGrip = getParentGripValue(item); const receiverGrip = getNonPrototypeParentGripValue(item); if (targetGrip && receiverGrip) { Object.assign(repProps, { onInvokeGetterButtonClick: () => this.props.invokeGetter(item, targetGrip, receiverGrip.actor, item.name) }); } } return { label, value: Utils.renderRep(item, repProps) }; } return { label }; } getTreeItemProps() { const { item, depth, focused, expanded, onCmdCtrlClick, onDoubleClick, dimTopLevelWindow } = this.props; const parentElementProps = { className: classnames("node object-node", { focused, lessen: !expanded && (nodeIsDefaultProperties(item) || nodeIsPrototype(item) || nodeIsGetter(item) || nodeIsSetter(item) || dimTopLevelWindow === true && nodeIsWindow(item) && depth === 0), block: nodeIsBlock(item) }), onClick: e => { if (onCmdCtrlClick && (isMacOS && e.metaKey || !isMacOS && e.ctrlKey)) { onCmdCtrlClick(item, { depth, event: e, focused, expanded }); e.stopPropagation(); return; } // If this click happened because the user selected some text, bail out. // Note that if the user selected some text before and then clicks here, // the previously selected text will be first unselected, unless the // user clicked on the arrow itself. Indeed because the arrow is an // image, clicking on it does not remove any existing text selection. // So we need to also check if the arrow was clicked. if (Utils.selection.documentHasSelection() && !(e.target && e.target.matches && e.target.matches(".arrow"))) { e.stopPropagation(); } } }; if (onDoubleClick) { parentElementProps.onDoubleClick = e => { e.stopPropagation(); onDoubleClick(item, { depth, focused, expanded }); }; } return parentElementProps; } renderLabel(label) { if (label === null || typeof label === "undefined") { return null; } const { item, depth, focused, expanded, onLabelClick } = this.props; return dom.span({ className: "object-label", onClick: onLabelClick ? event => { event.stopPropagation(); // If the user selected text, bail out. if (Utils.selection.documentHasSelection()) { return; } onLabelClick(item, { depth, focused, expanded, setExpanded: this.props.setExpanded }); } : undefined }, label); } render() { const { arrow } = this.props; const { label, value } = this.getLabelAndValue(); const labelElement = this.renderLabel(label); const delimiter = value && labelElement ? dom.span({ className: "object-delimiter" }, ": ") : null; return dom.div(this.getTreeItemProps(), arrow, labelElement, delimiter, value); } } module.exports = ObjectInspectorItem; /***/ }), /* 488 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function documentHasSelection() { const selection = getSelection(); if (!selection) { return false; } return selection.type === "Range"; } module.exports = { documentHasSelection }; /***/ }), /* 489 */, /* 490 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getVisibleSelectedFrame = exports.getSelectedFrames = exports.getSelectedFrame = exports.shouldPauseOnAnyXHR = exports.getXHRBreakpoints = exports.getBreakpointSources = exports.getCallStackFrames = exports.isSelectedFrameVisible = exports.inComponent = exports.getFirstVisibleBreakpoints = exports.getVisibleBreakpoints = exports.getBreakpointsAtLine = exports.getBreakpointAtLocation = exports.getQuickOpenType = exports.getQuickOpenQuery = exports.getQuickOpenEnabled = exports.getSourceActorsForThread = exports.getSourceActors = exports.hasSourceActor = exports.getSourceActor = undefined; var _expressions = __webpack_require__(569); Object.keys(_expressions).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _expressions[key]; } }); }); var _sources = __webpack_require__(498); Object.keys(_sources).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _sources[key]; } }); }); var _tabs = __webpack_require__(545); Object.keys(_tabs).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _tabs[key]; } }); }); var _eventListeners = __webpack_require__(575); Object.keys(_eventListeners).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _eventListeners[key]; } }); }); var _pause = __webpack_require__(530); Object.keys(_pause).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _pause[key]; } }); }); var _debuggee = __webpack_require__(577); Object.keys(_debuggee).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _debuggee[key]; } }); }); var _breakpoints = __webpack_require__(518); Object.keys(_breakpoints).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _breakpoints[key]; } }); }); var _pendingBreakpoints = __webpack_require__(580); Object.keys(_pendingBreakpoints).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _pendingBreakpoints[key]; } }); }); var _ui = __webpack_require__(581); Object.keys(_ui).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ui[key]; } }); }); var _fileSearch = __webpack_require__(582); Object.keys(_fileSearch).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _fileSearch[key]; } }); }); var _ast = __webpack_require__(583); Object.keys(_ast).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ast[key]; } }); }); var _projectTextSearch = __webpack_require__(532); Object.keys(_projectTextSearch).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _projectTextSearch[key]; } }); }); var _sourceTree = __webpack_require__(584); Object.keys(_sourceTree).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _sourceTree[key]; } }); }); var _sourceActors = __webpack_require__(529); Object.defineProperty(exports, "getSourceActor", { enumerable: true, get: function () { return _sourceActors.getSourceActor; } }); Object.defineProperty(exports, "hasSourceActor", { enumerable: true, get: function () { return _sourceActors.hasSourceActor; } }); Object.defineProperty(exports, "getSourceActors", { enumerable: true, get: function () { return _sourceActors.getSourceActors; } }); Object.defineProperty(exports, "getSourceActorsForThread", { enumerable: true, get: function () { return _sourceActors.getSourceActorsForThread; } }); var _quickOpen = __webpack_require__(585); Object.defineProperty(exports, "getQuickOpenEnabled", { enumerable: true, get: function () { return _quickOpen.getQuickOpenEnabled; } }); Object.defineProperty(exports, "getQuickOpenQuery", { enumerable: true, get: function () { return _quickOpen.getQuickOpenQuery; } }); Object.defineProperty(exports, "getQuickOpenType", { enumerable: true, get: function () { return _quickOpen.getQuickOpenType; } }); var _breakpointAtLocation = __webpack_require__(642); Object.defineProperty(exports, "getBreakpointAtLocation", { enumerable: true, get: function () { return _breakpointAtLocation.getBreakpointAtLocation; } }); Object.defineProperty(exports, "getBreakpointsAtLine", { enumerable: true, get: function () { return _breakpointAtLocation.getBreakpointsAtLine; } }); var _visibleBreakpoints = __webpack_require__(587); Object.defineProperty(exports, "getVisibleBreakpoints", { enumerable: true, get: function () { return _visibleBreakpoints.getVisibleBreakpoints; } }); Object.defineProperty(exports, "getFirstVisibleBreakpoints", { enumerable: true, get: function () { return _visibleBreakpoints.getFirstVisibleBreakpoints; } }); var _inComponent = __webpack_require__(643); Object.defineProperty(exports, "inComponent", { enumerable: true, get: function () { return _inComponent.inComponent; } }); var _isSelectedFrameVisible = __webpack_require__(644); Object.defineProperty(exports, "isSelectedFrameVisible", { enumerable: true, get: function () { return _isSelectedFrameVisible.isSelectedFrameVisible; } }); var _getCallStackFrames = __webpack_require__(645); Object.defineProperty(exports, "getCallStackFrames", { enumerable: true, get: function () { return _getCallStackFrames.getCallStackFrames; } }); var _breakpointSources = __webpack_require__(649); Object.defineProperty(exports, "getBreakpointSources", { enumerable: true, get: function () { return _breakpointSources.getBreakpointSources; } }); var _breakpoints2 = __webpack_require__(579); Object.defineProperty(exports, "getXHRBreakpoints", { enumerable: true, get: function () { return _breakpoints2.getXHRBreakpoints; } }); Object.defineProperty(exports, "shouldPauseOnAnyXHR", { enumerable: true, get: function () { return _breakpoints2.shouldPauseOnAnyXHR; } }); var _visibleColumnBreakpoints = __webpack_require__(650); Object.keys(_visibleColumnBreakpoints).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _visibleColumnBreakpoints[key]; } }); }); var _pause2 = __webpack_require__(576); Object.defineProperty(exports, "getSelectedFrame", { enumerable: true, get: function () { return _pause2.getSelectedFrame; } }); Object.defineProperty(exports, "getSelectedFrames", { enumerable: true, get: function () { return _pause2.getSelectedFrames; } }); Object.defineProperty(exports, "getVisibleSelectedFrame", { enumerable: true, get: function () { return _pause2.getVisibleSelectedFrame; } }); var _devtoolsReps = __webpack_require__(457); const { reducer } = _devtoolsReps.objectInspector; // eslint-disable-next-line import/named Object.keys(reducer).forEach(function (key) { if (key === "default" || key === "__esModule") { return; } Object.defineProperty(exports, key, { enumerable: true, get: reducer[key] }); }); /***/ }), /* 491 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.connect = connect; var _reactRedux = __webpack_require__(484); var _react = __webpack_require__(6); var React = _interopRequireWildcard(_react); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function connect(mapStateToProps, mapDispatchToProps) { // $FlowFixMe return (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps); } /***/ }), /* 492 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (immutable) */ __webpack_exports__["verifyPrefSchema"] = verifyPrefSchema; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_devtools_modules__ = __webpack_require__(183); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_devtools_modules___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_devtools_modules__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_devtools_environment__ = __webpack_require__(102); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_devtools_environment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_devtools_environment__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_devtools_services__ = __webpack_require__(37); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_devtools_services___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_devtools_services__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__asyncStoreHelper__ = __webpack_require__(615); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__asyncStoreHelper___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__asyncStoreHelper__); /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // @flow // Schema version to bump when the async store format has changed incompatibly // and old stores should be cleared. This needs to match the prefs schema // version in devtools/client/preferences/debugger.js. const prefsSchemaVersion = "1.0.9"; const pref = __WEBPACK_IMPORTED_MODULE_2_devtools_services___default.a.pref; if (Object(__WEBPACK_IMPORTED_MODULE_1_devtools_environment__["isDevelopment"])()) { pref("devtools.debugger.logging", false); pref("devtools.debugger.alphabetize-outline", false); pref("devtools.debugger.auto-pretty-print", false); pref("devtools.source-map.client-service.enabled", true); pref("devtools.chrome.enabled", false); pref("devtools.debugger.pause-on-exceptions", false); pref("devtools.debugger.pause-on-caught-exceptions", false); pref("devtools.debugger.ignore-caught-exceptions", true); pref("devtools.debugger.call-stack-visible", true); pref("devtools.debugger.scopes-visible", true); pref("devtools.debugger.component-visible", true); pref("devtools.debugger.workers-visible", true); pref("devtools.debugger.expressions-visible", true); pref("devtools.debugger.xhr-breakpoints-visible", true); pref("devtools.debugger.breakpoints-visible", true); pref("devtools.debugger.event-listeners-visible", true); pref("devtools.debugger.start-panel-collapsed", false); pref("devtools.debugger.end-panel-collapsed", false); pref("devtools.debugger.start-panel-size", 300); pref("devtools.debugger.end-panel-size", 300); pref("devtools.debugger.tabsBlackBoxed", "[]"); pref("devtools.debugger.ui.editor-wrapping", false); pref("devtools.debugger.ui.framework-grouping-on", true); pref("devtools.debugger.pending-selected-location", "{}"); pref("devtools.debugger.expressions", "[]"); pref("devtools.debugger.file-search-case-sensitive", false); pref("devtools.debugger.file-search-whole-word", false); pref("devtools.debugger.file-search-regex-match", false); pref("devtools.debugger.project-directory-root", ""); pref("devtools.debugger.map-scopes-enabled", false); pref("devtools.debugger.prefs-schema-version", prefsSchemaVersion); pref("devtools.debugger.skip-pausing", false); pref("devtools.debugger.features.workers", true); pref("devtools.debugger.features.async-stepping", true); pref("devtools.debugger.features.wasm", true); pref("devtools.debugger.features.shortcuts", true); pref("devtools.debugger.features.root", true); pref("devtools.debugger.features.map-scopes", true); pref("devtools.debugger.features.remove-command-bar-options", true); pref("devtools.debugger.features.code-folding", false); pref("devtools.debugger.features.outline", true); pref("devtools.debugger.features.column-breakpoints", true); pref("devtools.debugger.features.skip-pausing", true); pref("devtools.debugger.features.component-pane", false); pref("devtools.debugger.features.autocomplete-expressions", false); pref("devtools.debugger.features.map-expression-bindings", true); pref("devtools.debugger.features.map-await-expression", true); pref("devtools.debugger.features.xhr-breakpoints", true); pref("devtools.debugger.features.original-blackbox", true); pref("devtools.debugger.features.windowless-workers", true); pref("devtools.debugger.features.event-listeners-breakpoints", true); pref("devtools.debugger.features.log-points", true); pref("devtools.debugger.log-actions", true); } const prefs = new __WEBPACK_IMPORTED_MODULE_0_devtools_modules__["PrefsHelper"]("devtools", { logging: ["Bool", "debugger.logging"], editorWrapping: ["Bool", "debugger.ui.editor-wrapping"], alphabetizeOutline: ["Bool", "debugger.alphabetize-outline"], autoPrettyPrint: ["Bool", "debugger.auto-pretty-print"], clientSourceMapsEnabled: ["Bool", "source-map.client-service.enabled"], chromeAndExtenstionsEnabled: ["Bool", "chrome.enabled"], pauseOnExceptions: ["Bool", "debugger.pause-on-exceptions"], pauseOnCaughtExceptions: ["Bool", "debugger.pause-on-caught-exceptions"], ignoreCaughtExceptions: ["Bool", "debugger.ignore-caught-exceptions"], callStackVisible: ["Bool", "debugger.call-stack-visible"], scopesVisible: ["Bool", "debugger.scopes-visible"], componentVisible: ["Bool", "debugger.component-visible"], workersVisible: ["Bool", "debugger.workers-visible"], breakpointsVisible: ["Bool", "debugger.breakpoints-visible"], expressionsVisible: ["Bool", "debugger.expressions-visible"], xhrBreakpointsVisible: ["Bool", "debugger.xhr-breakpoints-visible"], eventListenersVisible: ["Bool", "debugger.event-listeners-visible"], startPanelCollapsed: ["Bool", "debugger.start-panel-collapsed"], endPanelCollapsed: ["Bool", "debugger.end-panel-collapsed"], startPanelSize: ["Int", "debugger.start-panel-size"], endPanelSize: ["Int", "debugger.end-panel-size"], frameworkGroupingOn: ["Bool", "debugger.ui.framework-grouping-on"], tabsBlackBoxed: ["Json", "debugger.tabsBlackBoxed", []], pendingSelectedLocation: ["Json", "debugger.pending-selected-location", {}], expressions: ["Json", "debugger.expressions", []], fileSearchCaseSensitive: ["Bool", "debugger.file-search-case-sensitive"], fileSearchWholeWord: ["Bool", "debugger.file-search-whole-word"], fileSearchRegexMatch: ["Bool", "debugger.file-search-regex-match"], debuggerPrefsSchemaVersion: ["Char", "debugger.prefs-schema-version"], projectDirectoryRoot: ["Char", "debugger.project-directory-root", ""], skipPausing: ["Bool", "debugger.skip-pausing"], mapScopes: ["Bool", "debugger.map-scopes-enabled"], logActions: ["Bool", "debugger.log-actions"] }); /* harmony export (immutable) */ __webpack_exports__["prefs"] = prefs; const features = new __WEBPACK_IMPORTED_MODULE_0_devtools_modules__["PrefsHelper"]("devtools.debugger.features", { asyncStepping: ["Bool", "async-stepping"], wasm: ["Bool", "wasm"], shortcuts: ["Bool", "shortcuts"], root: ["Bool", "root"], columnBreakpoints: ["Bool", "column-breakpoints"], mapScopes: ["Bool", "map-scopes"], removeCommandBarOptions: ["Bool", "remove-command-bar-options"], workers: ["Bool", "workers"], windowlessWorkers: ["Bool", "windowless-workers"], outline: ["Bool", "outline"], codeFolding: ["Bool", "code-folding"], skipPausing: ["Bool", "skip-pausing"], autocompleteExpression: ["Bool", "autocomplete-expressions"], mapExpressionBindings: ["Bool", "map-expression-bindings"], mapAwaitExpression: ["Bool", "map-await-expression"], componentPane: ["Bool", "component-pane"], xhrBreakpoints: ["Bool", "xhr-breakpoints"], originalBlackbox: ["Bool", "original-blackbox"], eventListenersBreakpoints: ["Bool", "event-listeners-breakpoints"], logPoints: ["Bool", "log-points"] }); /* harmony export (immutable) */ __webpack_exports__["features"] = features; const asyncStore = Object(__WEBPACK_IMPORTED_MODULE_3__asyncStoreHelper__["asyncStoreHelper"])("debugger", { pendingBreakpoints: ["pending-breakpoints", {}], tabs: ["tabs", []], xhrBreakpoints: ["xhr-breakpoints", []], eventListenerBreakpoints: ["event-listener-breakpoints", []] }); /* harmony export (immutable) */ __webpack_exports__["asyncStore"] = asyncStore; function verifyPrefSchema() { if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) { // clear pending Breakpoints asyncStore.pendingBreakpoints = {}; asyncStore.tabs = []; asyncStore.xhrBreakpoints = []; prefs.debuggerPrefsSchemaVersion = prefsSchemaVersion; } } /***/ }), /* 493 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _breakpoints = __webpack_require__(504); var breakpoints = _interopRequireWildcard(_breakpoints); var _expressions = __webpack_require__(511); var expressions = _interopRequireWildcard(_expressions); var _eventListeners = __webpack_require__(674); var eventListeners = _interopRequireWildcard(_eventListeners); var _pause = __webpack_require__(548); var pause = _interopRequireWildcard(_pause); var _navigation = __webpack_require__(675); var navigation = _interopRequireWildcard(_navigation); var _ui = __webpack_require__(538); var ui = _interopRequireWildcard(_ui); var _fileSearch = __webpack_require__(598); var fileSearch = _interopRequireWildcard(_fileSearch); var _ast = __webpack_require__(597); var ast = _interopRequireWildcard(_ast); var _projectTextSearch = __webpack_require__(676); var projectTextSearch = _interopRequireWildcard(_projectTextSearch); var _quickOpen = __webpack_require__(677); var quickOpen = _interopRequireWildcard(_quickOpen); var _sourceTree = __webpack_require__(678); var sourceTree = _interopRequireWildcard(_sourceTree); var _sources = __webpack_require__(505); var sources = _interopRequireWildcard(_sources); var _sourceActors = __webpack_require__(552); var sourcesActors = _interopRequireWildcard(_sourceActors); var _tabs = __webpack_require__(547); var tabs = _interopRequireWildcard(_tabs); var _debuggee = __webpack_require__(599); var debuggee = _interopRequireWildcard(_debuggee); var _toolbox = __webpack_require__(679); var toolbox = _interopRequireWildcard(_toolbox); var _preview = __webpack_require__(680); var preview = _interopRequireWildcard(_preview); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } exports.default = { ...navigation, ...breakpoints, ...expressions, ...eventListeners, ...sources, ...sourcesActors, ...tabs, ...pause, ...ui, ...fileSearch, ...ast, ...projectTextSearch, ...quickOpen, ...sourceTree, ...debuggee, ...toolbox, ...preview }; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ /***/ }), /* 494 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sourceTypes = exports.isMinified = undefined; var _isMinified = __webpack_require__(621); Object.defineProperty(exports, "isMinified", { enumerable: true, get: function () { return _isMinified.isMinified; } }); exports.shouldBlackbox = shouldBlackbox; exports.shouldPrettyPrint = shouldPrettyPrint; exports.isJavaScript = isJavaScript; exports.isPretty = isPretty; exports.isPrettyURL = isPrettyURL; exports.isThirdParty = isThirdParty; exports.getPrettySourceURL = getPrettySourceURL; exports.getRawSourceURL = getRawSourceURL; exports.getFormattedSourceId = getFormattedSourceId; exports.getFilename = getFilename; exports.getTruncatedFileName = getTruncatedFileName; exports.getDisplayPath = getDisplayPath; exports.getFileURL = getFileURL; exports.getSourcePath = getSourcePath; exports.getSourceLineCount = getSourceLineCount; exports.getMode = getMode; exports.isInlineScript = isInlineScript; exports.getTextAtPosition = getTextAtPosition; exports.getSourceClassnames = getSourceClassnames; exports.getRelativeUrl = getRelativeUrl; exports.underRoot = underRoot; exports.isOriginal = isOriginal; exports.isGenerated = isGenerated; exports.getSourceQueryString = getSourceQueryString; exports.isUrlExtension = isUrlExtension; exports.getPlainUrl = getPlainUrl; var _devtoolsSourceMap = __webpack_require__(182); var _devtoolsModules = __webpack_require__(183); var _utils = __webpack_require__(524); var _text = __webpack_require__(514); var _url = __webpack_require__(515); var _wasm = __webpack_require__(516); var _editor = __webpack_require__(496); var _sourcesTree = __webpack_require__(526); var _prefs = __webpack_require__(492); var _asyncValue = __webpack_require__(497); const sourceTypes = exports.sourceTypes = { coffee: "coffeescript", js: "javascript", jsx: "react", ts: "typescript", vue: "vue" }; /** * Trims the query part or reference identifier of a url string, if necessary. * * @memberof utils/source * @static */ function trimUrlQuery(url) { const length = url.length; const q1 = url.indexOf("?"); const q2 = url.indexOf("&"); const q3 = url.indexOf("#"); const q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); return url.slice(0, q); } function shouldBlackbox(source) { if (!source) { return false; } if (!source.url) { return false; } if ((0, _devtoolsSourceMap.isOriginalId)(source.id) && !_prefs.features.originalBlackbox) { return false; } return true; } function shouldPrettyPrint(source, content) { if (!source || isPretty(source) || !isJavaScript(source, content) || isOriginal(source) || _prefs.prefs.clientSourceMapsEnabled && source.sourceMapURL) { return false; } return true; } /** * Returns true if the specified url and/or content type are specific to * javascript files. * * @return boolean * True if the source is likely javascript. * * @memberof utils/source * @static */ function isJavaScript(source, content) { const url = source.url; const contentType = content.type === "wasm" ? null : content.contentType; return url && /\.(jsm|js)?$/.test(trimUrlQuery(url)) || !!(contentType && contentType.includes("javascript")); } /** * @memberof utils/source * @static */ function isPretty(source) { const url = source.url; return isPrettyURL(url); } function isPrettyURL(url) { return url ? /formatted$/.test(url) : false; } function isThirdParty(source) { const url = source.url; if (!source || !url) { return false; } return !!url.match(/(node_modules|bower_components)/); } /** * @memberof utils/source * @static */ function getPrettySourceURL(url) { if (!url) { url = ""; } return `${url}:formatted`; } /** * @memberof utils/source * @static */ function getRawSourceURL(url) { return url ? url.replace(/:formatted$/, "") : url; } function resolveFileURL(url, transformUrl = initialUrl => initialUrl, truncate = true) { url = getRawSourceURL(url || ""); const name = transformUrl(url); if (!truncate) { return name; } return (0, _utils.endTruncateStr)(name, 50); } function getFormattedSourceId(id) { const sourceId = id.split("/")[1]; return `SOURCE${sourceId}`; } /** * Gets a readable filename from a source URL for display purposes. * If the source does not have a URL, the source ID will be returned instead. * * @memberof utils/source * @static */ function getFilename(source) { const { url, id } = source; if (!getRawSourceURL(url)) { return getFormattedSourceId(id); } const { filename } = (0, _sourcesTree.getURL)(source); return getRawSourceURL(filename); } /** * Provides a middle-trunated filename * * @memberof utils/source * @static */ function getTruncatedFileName(source, querystring = "", length = 30) { return (0, _text.truncateMiddleText)(`${getFilename(source)}${querystring}`, length); } /* Gets path for files with same filename for editor tabs, breakpoints, etc. * Pass the source, and list of other sources * * @memberof utils/source * @static */ function getDisplayPath(mySource, sources) { const filename = getFilename(mySource); // Find sources that have the same filename, but different paths // as the original source const similarSources = sources.filter(source => getRawSourceURL(mySource.url) != getRawSourceURL(source.url) && filename == getFilename(source)); if (similarSources.length == 0) { return undefined; } // get an array of source path directories e.g. ['a/b/c.html'] => [['b', 'a']] const paths = [mySource, ...similarSources].map(source => (0, _sourcesTree.getURL)(source).path.split("/").reverse().slice(1)); // create an array of similar path directories and one dis-similar directory // for example [`a/b/c.html`, `a1/b/c.html`] => ['b', 'a'] // where 'b' is the similar directory and 'a' is the dis-similar directory. let similar = true; const displayPath = []; for (let i = 0; similar && i < paths[0].length; i++) { const [dir, ...dirs] = paths.map(path => path[i]); displayPath.push(dir); similar = dirs.includes(dir); } return displayPath.reverse().join("/"); } /** * Gets a readable source URL for display purposes. * If the source does not have a URL, the source ID will be returned instead. * * @memberof utils/source * @static */ function getFileURL(source, truncate = true) { const { url, id } = source; if (!url) { return getFormattedSourceId(id); } return resolveFileURL(url, _devtoolsModules.getUnicodeUrl, truncate); } const contentTypeModeMap = { "text/javascript": { name: "javascript" }, "text/typescript": { name: "javascript", typescript: true }, "text/coffeescript": { name: "coffeescript" }, "text/typescript-jsx": { name: "jsx", base: { name: "javascript", typescript: true } }, "text/jsx": { name: "jsx" }, "text/x-elm": { name: "elm" }, "text/x-clojure": { name: "clojure" }, "text/x-clojurescript": { name: "clojure" }, "text/wasm": { name: "text" }, "text/html": { name: "htmlmixed" } }; function getSourcePath(url) { if (!url) { return ""; } const { path, href } = (0, _url.parse)(url); // for URLs like "about:home" the path is null so we pass the full href return path || href; } /** * Returns amount of lines in the source. If source is a WebAssembly binary, * the function returns amount of bytes. */ function getSourceLineCount(content) { if (content.type === "wasm") { const { binary } = content.value; return binary.length; } return content.value.split("\n").length; } /** * * Checks if a source is minified based on some heuristics * @param key * @param text * @return boolean * @memberof utils/source * @static */ /** * * Returns Code Mirror mode for source content type * @param contentType * @return String * @memberof utils/source * @static */ // eslint-disable-next-line complexity function getMode(source, content, symbols) { const { url } = source; if (content.type !== "text") { return { name: "text" }; } const { contentType, value: text } = content; if (url && url.match(/\.jsx$/i) || symbols && symbols.hasJsx) { if (symbols && symbols.hasTypes) { return { name: "text/typescript-jsx" }; } return { name: "jsx" }; } if (symbols && symbols.hasTypes) { if (symbols.hasJsx) { return { name: "text/typescript-jsx" }; } return { name: "text/typescript" }; } const languageMimeMap = [{ ext: ".c", mode: "text/x-csrc" }, { ext: ".kt", mode: "text/x-kotlin" }, { ext: ".cpp", mode: "text/x-c++src" }, { ext: ".m", mode: "text/x-objectivec" }, { ext: ".rs", mode: "text/x-rustsrc" }, { ext: ".hx", mode: "text/x-haxe" }]; // check for C and other non JS languages if (url) { const result = languageMimeMap.find(({ ext }) => url.endsWith(ext)); if (result !== undefined) { return { name: result.mode }; } } // if the url ends with .marko we set the name to Javascript so // syntax highlighting works for marko too if (url && url.match(/\.marko$/i)) { return { name: "javascript" }; } // Use HTML mode for files in which the first non whitespace // character is `<` regardless of extension. const isHTMLLike = text.match(/^\s* { props = { ...props, className: (0, _classnames2.default)("img", props.className) }; return _react2.default.createElement("span", props); }; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ exports.default = AccessibleImage; /***/ }), /* 496 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.onMouseOver = undefined; var _sourceDocuments = __webpack_require__(540); Object.keys(_sourceDocuments).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _sourceDocuments[key]; } }); }); var _getTokenLocation = __webpack_require__(624); Object.keys(_getTokenLocation).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _getTokenLocation[key]; } }); }); var _sourceSearch = __webpack_require__(625); Object.keys(_sourceSearch).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _sourceSearch[key]; } }); }); var _ui = __webpack_require__(525); Object.keys(_ui).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ui[key]; } }); }); var _tokenEvents = __webpack_require__(626); Object.defineProperty(exports, "onMouseOver", { enumerable: true, get: function () { return _tokenEvents.onMouseOver; } }); exports.getEditor = getEditor; exports.removeEditor = removeEditor; exports.startOperation = startOperation; exports.endOperation = endOperation; exports.shouldShowPrettyPrint = shouldShowPrettyPrint; exports.traverseResults = traverseResults; exports.toEditorLine = toEditorLine; exports.fromEditorLine = fromEditorLine; exports.toEditorPosition = toEditorPosition; exports.toEditorRange = toEditorRange; exports.toSourceLine = toSourceLine; exports.scrollToColumn = scrollToColumn; exports.getLocationsInViewport = getLocationsInViewport; exports.markText = markText; exports.lineAtHeight = lineAtHeight; exports.getSourceLocationFromMouseEvent = getSourceLocationFromMouseEvent; exports.forEachLine = forEachLine; exports.removeLineClass = removeLineClass; exports.clearLineClass = clearLineClass; exports.getTextForLine = getTextForLine; exports.getCursorLine = getCursorLine; exports.getTokenEnd = getTokenEnd; var _createEditor = __webpack_require__(561); var _source = __webpack_require__(494); var _wasm = __webpack_require__(516); let editor; function getEditor() { if (editor) { return editor; } editor = (0, _createEditor.createEditor)(); return editor; } function removeEditor() { editor = null; } function getCodeMirror() { return editor && editor.hasCodeMirror ? editor.codeMirror : null; } function startOperation() { const codeMirror = getCodeMirror(); if (!codeMirror) { return; } codeMirror.startOperation(); } function endOperation() { const codeMirror = getCodeMirror(); if (!codeMirror) { return; } codeMirror.endOperation(); } function shouldShowPrettyPrint(source, content) { return (0, _source.shouldPrettyPrint)(source, content); } function traverseResults(e, ctx, query, dir, modifiers) { e.stopPropagation(); e.preventDefault(); if (dir == "prev") { (0, _sourceSearch.findPrev)(ctx, query, true, modifiers); } else if (dir == "next") { (0, _sourceSearch.findNext)(ctx, query, true, modifiers); } } function toEditorLine(sourceId, lineOrOffset) { if ((0, _wasm.isWasm)(sourceId)) { // TODO ensure offset is always "mappable" to edit line. return (0, _wasm.wasmOffsetToLine)(sourceId, lineOrOffset) || 0; } return lineOrOffset ? lineOrOffset - 1 : 1; } function fromEditorLine(sourceId, line) { if ((0, _wasm.isWasm)(sourceId)) { return (0, _wasm.lineToWasmOffset)(sourceId, line) || 0; } return line + 1; } function toEditorPosition(location) { return { line: toEditorLine(location.sourceId, location.line), column: (0, _wasm.isWasm)(location.sourceId) || !location.column ? 0 : location.column }; } function toEditorRange(sourceId, location) { const { start, end } = location; return { start: toEditorPosition({ ...start, sourceId }), end: toEditorPosition({ ...end, sourceId }) }; } function toSourceLine(sourceId, line) { return (0, _wasm.isWasm)(sourceId) ? (0, _wasm.lineToWasmOffset)(sourceId, line) : line + 1; } function scrollToColumn(codeMirror, line, column) { const { top, left } = codeMirror.charCoords({ line: line, ch: column }, "local"); if (!isVisible(codeMirror, top, left)) { const scroller = codeMirror.getScrollerElement(); const centeredX = Math.max(left - scroller.offsetWidth / 2, 0); const centeredY = Math.max(top - scroller.offsetHeight / 2, 0); codeMirror.scrollTo(centeredX, centeredY); } } function isVisible(codeMirror, top, left) { function withinBounds(x, min, max) { return x >= min && x <= max; } const scrollArea = codeMirror.getScrollInfo(); const charWidth = codeMirror.defaultCharWidth(); const fontHeight = codeMirror.defaultTextHeight(); const { scrollTop, scrollLeft } = codeMirror.doc; const inXView = withinBounds(left, scrollLeft, scrollLeft + (scrollArea.clientWidth - 30) - charWidth); const inYView = withinBounds(top, scrollTop, scrollTop + scrollArea.clientHeight - fontHeight); return inXView && inYView; } function getLocationsInViewport({ codeMirror }) { // Get scroll position if (!codeMirror) { return { start: { line: 0, column: 0 }, end: { line: 0, column: 0 } }; } const charWidth = codeMirror.defaultCharWidth(); const scrollArea = codeMirror.getScrollInfo(); const { scrollLeft } = codeMirror.doc; const rect = codeMirror.getWrapperElement().getBoundingClientRect(); const topVisibleLine = codeMirror.lineAtHeight(rect.top, "window"); const bottomVisibleLine = codeMirror.lineAtHeight(rect.bottom, "window"); const leftColumn = Math.floor(scrollLeft > 0 ? scrollLeft / charWidth : 0); const rightPosition = scrollLeft + (scrollArea.clientWidth - 30); const rightCharacter = Math.floor(rightPosition / charWidth); return { start: { line: topVisibleLine, column: leftColumn }, end: { line: bottomVisibleLine, column: rightCharacter } }; } function markText({ codeMirror }, className, { start, end }) { return codeMirror.markText({ ch: start.column, line: start.line }, { ch: end.column, line: end.line }, { className }); } function lineAtHeight({ codeMirror }, sourceId, event) { const _editorLine = codeMirror.lineAtHeight(event.clientY); return toSourceLine(sourceId, _editorLine); } function getSourceLocationFromMouseEvent({ codeMirror }, source, e) { const { line, ch } = codeMirror.coordsChar({ left: e.clientX, top: e.clientY }); return { sourceId: source.id, line: line + 1, column: ch + 1 }; } function forEachLine(codeMirror, iter) { codeMirror.operation(() => { codeMirror.doc.iter(0, codeMirror.lineCount(), iter); }); } function removeLineClass(codeMirror, line, className) { codeMirror.removeLineClass(line, "line", className); } function clearLineClass(codeMirror, className) { forEachLine(codeMirror, line => { removeLineClass(codeMirror, line, className); }); } function getTextForLine(codeMirror, line) { return codeMirror.getLine(line - 1).trim(); } function getCursorLine(codeMirror) { return codeMirror.getCursor().line; } function getTokenEnd(codeMirror, line, column) { const token = codeMirror.getTokenAt({ line: line, ch: column + 1 }); return token.end; } /***/ }), /* 497 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pending = pending; exports.fulfilled = fulfilled; exports.rejected = rejected; exports.isPending = isPending; exports.isFulfilled = isFulfilled; exports.isRejected = isRejected; function pending() { return { state: "pending" }; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ function fulfilled(value) { return { state: "fulfilled", value }; } function rejected(value) { return { state: "rejected", value }; } function isPending(value) { return value.state === "pending"; } function isFulfilled(value) { return value.state === "fulfilled"; } function isRejected(value) { return value.state === "rejected"; } /***/ }), /* 498 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSelectedBreakableLines = exports.getDisplayedSources = exports.getSelectedSourceWithContent = exports.getSelectedSource = exports.getSelectedLocation = undefined; exports.initialSourcesState = initialSourcesState; exports.getBlackBoxList = getBlackBoxList; exports.getSourceThreads = getSourceThreads; exports.getSourceInSources = getSourceInSources; exports.getSource = getSource; exports.getSourceFromId = getSourceFromId; exports.getSourceByActorId = getSourceByActorId; exports.getSourcesByURLInSources = getSourcesByURLInSources; exports.getSourcesByURL = getSourcesByURL; exports.getSourceByURL = getSourceByURL; exports.getSpecificSourceByURLInSources = getSpecificSourceByURLInSources; exports.getSpecificSourceByURL = getSpecificSourceByURL; exports.getOriginalSourceByURL = getOriginalSourceByURL; exports.getGeneratedSourceByURL = getGeneratedSourceByURL; exports.getGeneratedSource = getGeneratedSource; exports.getGeneratedSourceById = getGeneratedSourceById; exports.getPendingSelectedLocation = getPendingSelectedLocation; exports.getPrettySource = getPrettySource; exports.hasPrettySource = hasPrettySource; exports.getSourcesUrlsInSources = getSourcesUrlsInSources; exports.getHasSiblingOfSameName = getHasSiblingOfSameName; exports.getSources = getSources; exports.getSourcesEpoch = getSourcesEpoch; exports.getUrls = getUrls; exports.getPlainUrls = getPlainUrls; exports.getSourceList = getSourceList; exports.getDisplayedSourcesList = getDisplayedSourcesList; exports.getSourceCount = getSourceCount; exports.getSourceWithContent = getSourceWithContent; exports.getSourceContent = getSourceContent; exports.getSelectedSourceId = getSelectedSourceId; exports.getProjectDirectoryRoot = getProjectDirectoryRoot; exports.getSourceActorsForSource = getSourceActorsForSource; exports.getBreakpointPositions = getBreakpointPositions; exports.getBreakpointPositionsForSource = getBreakpointPositionsForSource; exports.hasBreakpointPositions = hasBreakpointPositions; exports.hasBreakpointPositionsForLine = hasBreakpointPositionsForLine; exports.getBreakpointPositionsForLocation = getBreakpointPositionsForLocation; exports.getBreakableLines = getBreakableLines; exports.isSourceLoadingOrLoaded = isSourceLoadingOrLoaded; var _reselect = __webpack_require__(444); var _source = __webpack_require__(494); var _resource = __webpack_require__(570); var _breakpointPositions = __webpack_require__(574); var _asyncValue = __webpack_require__(497); var asyncValue = _interopRequireWildcard(_asyncValue); var _devtoolsSourceMap = __webpack_require__(182); var _prefs = __webpack_require__(492); var _sourceActors = __webpack_require__(529); var _lodash = __webpack_require__(417); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function initialSourcesState() { return { sources: (0, _resource.createInitial)(), urls: {}, plainUrls: {}, content: {}, actors: {}, breakpointPositions: {}, breakableLines: {}, epoch: 1, selectedLocation: undefined, pendingSelectedLocation: _prefs.prefs.pendingSelectedLocation, projectDirectoryRoot: _prefs.prefs.projectDirectoryRoot, chromeAndExtenstionsEnabled: _prefs.prefs.chromeAndExtenstionsEnabled, focusedItem: null }; } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ /** * Sources reducer * @module reducers/sources */ function update(state = initialSourcesState(), action) { let location = null; switch (action.type) { case "CLEAR_SOURCE_MAP_URL": return clearSourceMaps(state, action.sourceId); case "ADD_SOURCE": return addSources(state, [action.source]); case "ADD_SOURCES": return addSources(state, action.sources); case "INSERT_SOURCE_ACTORS": return insertSourceActors(state, action); case "REMOVE_SOURCE_ACTORS": return removeSourceActors(state, action); case "SET_SELECTED_LOCATION": location = { ...action.location, url: action.source.url }; if (action.source.url) { _prefs.prefs.pendingSelectedLocation = location; } return { ...state, selectedLocation: { sourceId: action.source.id, ...action.location }, pendingSelectedLocation: location }; case "CLEAR_SELECTED_LOCATION": location = { url: "" }; _prefs.prefs.pendingSelectedLocation = location; return { ...state, selectedLocation: null, pendingSelectedLocation: location }; case "SET_PENDING_SELECTED_LOCATION": location = { url: action.url, line: action.line }; _prefs.prefs.pendingSelectedLocation = location; return { ...state, pendingSelectedLocation: location }; case "LOAD_SOURCE_TEXT": return updateLoadedState(state, action); case "BLACKBOX": if (action.status === "done") { const { id, url } = action.source; const { isBlackBoxed } = action.value; updateBlackBoxList(url, isBlackBoxed); return updateBlackboxFlag(state, id, isBlackBoxed); } break; case "SET_PROJECT_DIRECTORY_ROOT": return updateProjectDirectoryRoot(state, action.url); case "SET_BREAKABLE_LINES": { const { breakableLines, sourceId } = action; return { ...state, breakableLines: { ...state.breakableLines, [sourceId]: breakableLines } }; } case "ADD_BREAKPOINT_POSITIONS": { const { source, positions } = action; const breakpointPositions = state.breakpointPositions[source.id]; return { ...state, breakpointPositions: { ...state.breakpointPositions, [source.id]: { ...breakpointPositions, ...positions } } }; } case "NAVIGATE": return { ...initialSourcesState(), epoch: state.epoch + 1 }; case "SET_FOCUSED_SOURCE_ITEM": return { ...state, focusedItem: action.item }; } return state; } function resourceAsSource(r) { return r; } /* * Add sources to the sources store * - Add the source to the sources store * - Add the source URL to the urls map */ function addSources(state, sources) { state = { ...state, content: { ...state.content }, urls: { ...state.urls }, plainUrls: { ...state.plainUrls } }; state.sources = (0, _resource.insertResources)(state.sources, sources); for (const source of sources) { // 1. Add the source to the sources map state.content[source.id] = null; // 2. Update the source url map const existing = state.urls[source.url] || []; if (!existing.includes(source.id)) { state.urls[source.url] = [...existing, source.id]; } // 3. Update the plain url map if (source.url) { const plainUrl = (0, _source.getPlainUrl)(source.url); const existingPlainUrls = state.plainUrls[plainUrl] || []; if (!existingPlainUrls.includes(source.url)) { state.plainUrls[plainUrl] = [...existingPlainUrls, source.url]; } } } state = updateRootRelativeValues(state, sources); return state; } function insertSourceActors(state, action) { const { items } = action; state = { ...state, actors: { ...state.actors } }; for (const sourceActor of items) { state.actors[sourceActor.source] = [...(state.actors[sourceActor.source] || []), sourceActor.id]; } const scriptActors = items.filter(item => item.introductionType === "scriptElement"); if (scriptActors.length > 0) { const { ...breakpointPositions } = state.breakpointPositions; // If new HTML sources are being added, we need to clear the breakpoint // positions since the new source is a