123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- "use strict";
- var global = arguments[3];
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- var HMR_HOST = null;
- var HMR_PORT = 12345;
- var HMR_ENV_HASH = "d751713988987e9331980363e24189ce";
- module.bundle.HMR_BUNDLE_ID = "9677950b377d8783c801420daf7bdb91";
- /* global HMR_HOST, HMR_PORT, HMR_ENV_HASH */
- var OVERLAY_ID = '__parcel__error__overlay__';
- var OldModule = module.bundle.Module;
- function Module(moduleName) {
- OldModule.call(this, moduleName);
- this.hot = {
- data: module.bundle.hotData,
- _acceptCallbacks: [],
- _disposeCallbacks: [],
- accept: function accept(fn) {
- this._acceptCallbacks.push(fn || function () {});
- },
- dispose: function dispose(fn) {
- this._disposeCallbacks.push(fn);
- }
- };
- module.bundle.hotData = null;
- }
- module.bundle.Module = Module;
- var checkedAssets, assetsToAccept, acceptedAssets; // eslint-disable-next-line no-redeclare
- var parent = module.bundle.parent;
- if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
- var hostname = HMR_HOST || (location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost');
- var port = HMR_PORT || location.port;
- var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
- var ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/');
- ws.onmessage = function (event) {
- checkedAssets = {};
- assetsToAccept = [];
- acceptedAssets = {};
- var data = JSON.parse(event.data);
- if (data.type === 'update') {
- // Remove error overlay if there is one
- removeErrorOverlay();
- var assets = data.assets.filter(function (asset) {
- return asset.envHash === HMR_ENV_HASH;
- }); // Handle HMR Update
- var handled = false;
- assets.forEach(function (asset) {
- var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);
- if (didAccept) {
- handled = true;
- }
- });
- if (handled) {
- console.clear();
- assets.forEach(function (asset) {
- hmrApply(global.parcelRequire, asset);
- });
- for (var i = 0; i < assetsToAccept.length; i++) {
- var id = assetsToAccept[i][1];
- if (!acceptedAssets[id]) {
- hmrAcceptRun(assetsToAccept[i][0], id);
- }
- }
- } else {
- window.location.reload();
- }
- }
- if (data.type === 'error') {
- // Log parcel errors to console
- var _iterator = _createForOfIteratorHelper(data.diagnostics.ansi),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var ansiDiagnostic = _step.value;
- var stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
- console.error('🚨 [parcel]: ' + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n'));
- } // Render the fancy html overlay
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- removeErrorOverlay();
- var overlay = createErrorOverlay(data.diagnostics.html);
- document.body.appendChild(overlay);
- }
- };
- ws.onerror = function (e) {
- console.error(e.message);
- };
- ws.onclose = function (e) {
- console.warn('[parcel] 🚨 Connection to the HMR server was lost');
- };
- }
- function removeErrorOverlay() {
- var overlay = document.getElementById(OVERLAY_ID);
- if (overlay) {
- overlay.remove();
- console.log('[parcel] ✨ Error resolved');
- }
- }
- function createErrorOverlay(diagnostics) {
- var overlay = document.createElement('div');
- overlay.id = OVERLAY_ID;
- var errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
- var _iterator2 = _createForOfIteratorHelper(diagnostics),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var diagnostic = _step2.value;
- var stack = diagnostic.codeframe ? diagnostic.codeframe : diagnostic.stack;
- errorHTML += "\n <div>\n <div style=\"font-size: 18px; font-weight: bold; margin-top: 20px;\">\n \uD83D\uDEA8 ".concat(diagnostic.message, "\n </div>\n <pre>\n ").concat(stack, "\n </pre>\n <div>\n ").concat(diagnostic.hints.map(function (hint) {
- return '<div>' + hint + '</div>';
- }).join(''), "\n </div>\n </div>\n ");
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- errorHTML += '</div>';
- overlay.innerHTML = errorHTML;
- return overlay;
- }
- function getParents(bundle, id) {
- var modules = bundle.modules;
- if (!modules) {
- return [];
- }
- var parents = [];
- var k, d, dep;
- for (k in modules) {
- for (d in modules[k][1]) {
- dep = modules[k][1][d];
- if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
- parents.push([bundle, k]);
- }
- }
- }
- if (bundle.parent) {
- parents = parents.concat(getParents(bundle.parent, id));
- }
- return parents;
- }
- function hmrApply(bundle, asset) {
- var modules = bundle.modules;
- if (!modules) {
- return;
- }
- if (modules[asset.id] || !bundle.parent) {
- if (asset.type === 'css') {
- var newStyle = document.createElement('style');
- newStyle.innerHTML = asset.output;
- document.body.appendChild(newStyle);
- } else {
- var fn = new Function('require', 'module', 'exports', asset.output);
- modules[asset.id] = [fn, asset.depsByBundle[bundle.HMR_BUNDLE_ID]];
- }
- } else if (bundle.parent) {
- hmrApply(bundle.parent, asset);
- }
- }
- function hmrAcceptCheck(bundle, id) {
- var modules = bundle.modules;
- if (!modules) {
- return;
- }
- if (!modules[id] && bundle.parent) {
- return hmrAcceptCheck(bundle.parent, id);
- }
- if (checkedAssets[id]) {
- return;
- }
- checkedAssets[id] = true;
- var cached = bundle.cache[id];
- assetsToAccept.push([bundle, id]);
- if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
- return true;
- }
- return getParents(global.parcelRequire, id).some(function (v) {
- return hmrAcceptCheck(v[0], v[1]);
- });
- }
- function hmrAcceptRun(bundle, id) {
- var cached = bundle.cache[id];
- bundle.hotData = {};
- if (cached && cached.hot) {
- cached.hot.data = bundle.hotData;
- }
- if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
- cached.hot._disposeCallbacks.forEach(function (cb) {
- cb(bundle.hotData);
- });
- }
- delete bundle.cache[id];
- bundle(id);
- cached = bundle.cache[id];
- if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
- cached.hot._acceptCallbacks.forEach(function (cb) {
- var assetsToAlsoAccept = cb(function () {
- return getParents(global.parcelRequire, id);
- });
- if (assetsToAlsoAccept && assetsToAccept.length) {
- assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
- }
- });
- }
- acceptedAssets[id] = true;
- }
|