diff --git a/.gitignore b/.gitignore index 4b90444..ae84271 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -./node_modules +./node_modules \ No newline at end of file diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..ee63f67 --- /dev/null +++ b/bundle.js @@ -0,0 +1,17 @@ +import webpack from "webpack"; +import path from "path"; + +const __dirname = path.resolve(path.dirname(decodeURI(new URL(import.meta.url).pathname))).slice(3); + +console.log(__dirname); + +webpack({ + mode: 'none', + entry: path.join(__dirname, './rewrite/index.js'), + output: { + path: __dirname, + filename: './lib/uv.bundle.js', + } +}, (err, i) => + console.log(!err ? 'Ultraviolet bundled!' : e) +); \ No newline at end of file diff --git a/client/dom/attr.js b/client/dom/attr.js new file mode 100644 index 0000000..fa09e82 --- /dev/null +++ b/client/dom/attr.js @@ -0,0 +1,44 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class AttrApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Attr = this.window.Attr || {}; + this.attrProto = this.Attr.prototype || {}; + this.value = ctx.nativeMethods.getOwnPropertyDescriptor(this.attrProto, 'value'); + this.name = ctx.nativeMethods.getOwnPropertyDescriptor(this.attrProto, 'name'); + }; + override() { + this.ctx.overrideDescriptor(this.attrProto, 'name', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('name', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.attrProto, 'value', { + get: (target, that) => { + const event = new HookEvent({ name: this.name.get.call(that), value: target.call(that) }, target, that); + this.emit('getValue', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new HookEvent({ name: this.name.get.call(that), value: val }, target, that); + this.emit('setValue', event); + + if (event.intercepted) return event.returnValue; + event.target.call(event.that, event.data.value); + } + }); + }; +}; + +export default AttrApi; \ No newline at end of file diff --git a/client/dom/document.js b/client/dom/document.js new file mode 100644 index 0000000..cbfd1f8 --- /dev/null +++ b/client/dom/document.js @@ -0,0 +1,184 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class DocumentHook extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.document = this.window.document; + this.Document = this.window.Document || {}; + this.DOMParser = this.window.DOMParser || {}; + this.docProto = this.Document.prototype || {}; + this.domProto = this.DOMParser.prototype || {}; + this.title = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'title'); + this.cookie = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'cookie'); + this.referrer = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'referrer'); + this.domain = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'domain'); + this.documentURI = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'documentURI'); + this.write = this.docProto.write; + this.writeln = this.docProto.writeln; + this.querySelector = this.docProto.querySelector; + this.querySelectorAll = this.docProto.querySelectorAll; + this.parseFromString = this.domProto.parseFromString; + this.URL = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'URL'); + }; + overrideParseFromString() { + this.ctx.override(this.domProto, 'parseFromString', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ string, type ] = args; + + const event = new HookEvent({ string, type }, target, that); + this.emit('parseFromString', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.string, event.data.type); + }); + }; + overrideQuerySelector() { + this.ctx.override(this.docProto, 'querySelector', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ selectors ] = args; + + const event = new HookEvent({ selectors }, target, that); + this.emit('querySelector', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.selectors); + }); + }; + overrideDomain() { + this.ctx.overrideDescriptor(this.docProto, 'domain', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getDomain', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new HookEvent({ value: val }, target, that); + this.emit('setDomain', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; + overrideReferrer() { + this.ctx.overrideDescriptor(this.docProto, 'referrer', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('referrer', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideCreateTreeWalker() { + this.ctx.override(this.docProto, 'createTreeWalker', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ root, show = 0xFFFFFFFF, filter, expandEntityReferences ] = args; + + const event = new HookEvent({ root, show, filter, expandEntityReferences }, target, that); + this.emit('createTreeWalker', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.root, event.data.show, event.data.filter, event.data.expandEntityReferences); + }); + }; + overrideWrite() { + this.ctx.override(this.docProto, 'write', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ ...html ] = args; + + const event = new HookEvent({ html }, target, that); + this.emit('write', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.html); + }); + this.ctx.override(this.docProto, 'writeln', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ ...html ] = args; + + const event = new HookEvent({ html }, target, that); + this.emit('writeln', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.html); + }); + }; + overrideDocumentURI() { + this.ctx.overrideDescriptor(this.docProto, 'documentURI', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('documentURI', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideURL() { + this.ctx.overrideDescriptor(this.docProto, 'URL', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('url', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideReferrer() { + this.ctx.overrideDescriptor(this.docProto, 'referrer', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('referrer', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideCookie() { + this.ctx.overrideDescriptor(this.docProto, 'cookie', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getCookie', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ value ]) => { + const event = new HookEvent({ value, }, target, that); + this.emit('setCookie', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; + overrideTitle() { + this.ctx.overrideDescriptor(this.docProto, 'title', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getTitle', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ value ]) => { + const event = new HookEvent({ value, }, target, that); + this.emit('setTitle', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; +}; + +export default DocumentHook; \ No newline at end of file diff --git a/client/dom/element.js b/client/dom/element.js new file mode 100644 index 0000000..260fd50 --- /dev/null +++ b/client/dom/element.js @@ -0,0 +1,165 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class ElementApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Audio = this.window.Audio; + this.Element = this.window.Element; + this.elemProto = this.Element ? this.Element.prototype : {}; + this.innerHTML = ctx.nativeMethods.getOwnPropertyDescriptor(this.elemProto, 'innerHTML'); + this.outerHTML = ctx.nativeMethods.getOwnPropertyDescriptor(this.elemProto, 'outerHTML'); + this.setAttribute = this.elemProto.setAttribute; + this.getAttribute = this.elemProto.getAttribute; + this.removeAttribute = this.elemProto.removeAttribute; + this.hasAttribute = this.elemProto.hasAttribute; + this.querySelector = this.elemProto.querySelector; + this.querySelectorAll = this.elemProto.querySelectorAll; + this.insertAdjacentHTML = this.elemProto.insertAdjacentHTML; + this.insertAdjacentText = this.elemProto.insertAdjacentText; + }; + overrideQuerySelector() { + this.ctx.override(this.elemProto, 'querySelector', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ selectors ] = args; + + const event = new HookEvent({ selectors }, target, that); + this.emit('querySelector', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.selectors); + }); + }; + overrideAttribute() { + this.ctx.override(this.elemProto, 'getAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new HookEvent({ name }, target, that); + this.emit('getAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + this.ctx.override(this.elemProto, 'setAttribute', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ name, value ] = args; + + const event = new HookEvent({ name, value }, target, that); + this.emit('setAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name, event.data.value); + }); + this.ctx.override(this.elemProto, 'hasAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new HookEvent({ name }, target, that); + this.emit('hasAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + this.ctx.override(this.elemProto, 'removeAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new HookEvent({ name }, target, that); + this.emit('removeAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + }; + overrideAudio() { + this.ctx.override(this.window, 'Audio', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url ] = args; + + const event = new HookEvent({ url }, target, that); + this.emit('audio', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url); + }, true); + }; + overrideHtml() { + this.hookProperty(this.Element, 'innerHTML', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getInnerHTML', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new HookEvent({ value: val }, target, that); + this.emit('setInnerHTML', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + this.hookProperty(this.Element, 'outerHTML', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getOuterHTML', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new HookEvent({ value: val }, target, that); + this.emit('setOuterHTML', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + }; + overrideInsertAdjacentHTML() { + this.ctx.override(this.elemProto, 'insertAdjacentHTML', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ position, html ] = args; + + const event = new HookEvent({ position, html }, target, that); + this.emit('insertAdjacentHTML', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.position, event.data.html); + }); + }; + overrideInsertAdjacentText() { + this.ctx.override(this.elemProto, 'insertAdjacentText', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ position, text ] = args; + + const event = new HookEvent({ position, text }, target, that); + this.emit('insertAdjacentText', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.position, event.data.text); + }); + }; + hookProperty(element, prop, handler) { + if (!element || !prop in element) return false; + + if (this.ctx.nativeMethods.isArray(element)) { + for (const elem of element) { + this.hookProperty(elem, prop, handler); + }; + return true; + }; + + const proto = element.prototype; + + this.ctx.overrideDescriptor(proto, prop, handler); + + return true; + }; +}; + +export default ElementApi; \ No newline at end of file diff --git a/client/dom/node.js b/client/dom/node.js new file mode 100644 index 0000000..9c646bc --- /dev/null +++ b/client/dom/node.js @@ -0,0 +1,121 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class NodeApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Node = ctx.window.Node || {}; + this.nodeProto = this.Node.prototype || {}; + this.compareDocumentPosition = this.nodeProto.compareDocumentPosition; + this.contains = this.nodeProto.contains; + this.insertBefore = this.nodeProto.insertBefore; + this.replaceChild = this.nodeProto.replaceChild; + this.append = this.nodeProto.append; + this.appendChild = this.nodeProto.appendChild; + this.removeChild = this.nodeProto.removeChild; + + this.textContent = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'textContent'); + this.parentNode = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'parentNode'); + this.parentElement = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'parentElement'); + this.childNodes = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'childNodes'); + this.baseURI = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'baseURI'); + this.previousSibling = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'previousSibling'); + this.ownerDocument = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'ownerDocument'); + }; + overrideTextContent() { + this.ctx.overrideDescriptor(this.nodeProto, 'textContent', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('getTextContent', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new HookEvent({ value: val }, target, that); + this.emit('setTextContent', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + }; + overrideAppend() { + this.ctx.override(this.nodeProto, 'append', (target, that, [ ...nodes ]) => { + const event = new HookEvent({ nodes }, target, that); + this.emit('append', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.nodes); + }); + this.ctx.override(this.nodeProto, 'appendChild', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ node ] = args; + + const event = new HookEvent({ node }, target, that); + this.emit('appendChild', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.node); + }); + }; + overrideBaseURI() { + this.ctx.overrideDescriptor(this.nodeProto, 'baseURI', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('baseURI', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }) + }; + overrideParent() { + this.ctx.overrideDescriptor(this.nodeProto, 'parentNode', { + get: (target, that) => { + const event = new HookEvent({ node: target.call(that) }, target, that); + this.emit('parentNode', event); + + if (event.intercepted) return event.returnValue; + return event.data.node; + }, + }); + this.ctx.overrideDescriptor(this.nodeProto, 'parentElement', { + get: (target, that) => { + const event = new HookEvent({ element: target.call(that) }, target, that); + this.emit('parentElement', event); + + if (event.intercepted) return event.returnValue; + return event.data.node; + }, + }); + }; + overrideOwnerDocument() { + this.ctx.overrideDescriptor(this.nodeProto, 'ownerDocument', { + get: (target, that) => { + const event = new HookEvent({ document: target.call(that) }, target, that); + this.emit('ownerDocument', event); + + if (event.intercepted) return event.returnValue; + return event.data.document; + }, + }); + }; + overrideCompareDocumentPosit1ion() { + this.ctx.override(this.nodeProto, 'compareDocumentPosition', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ node ] = args; + const event = new HookEvent({ node }, target, that); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.node); + }); + }; + overrideChildMethods() { + this.ctx.override(this.nodeProto, 'removeChild') + }; +}; + +export default NodeApi; \ No newline at end of file diff --git a/client/events.js b/client/events.js new file mode 100644 index 0000000..b9be953 --- /dev/null +++ b/client/events.js @@ -0,0 +1,497 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} + +export default EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} \ No newline at end of file diff --git a/client/history.js b/client/history.js new file mode 100644 index 0000000..3b83c7c --- /dev/null +++ b/client/history.js @@ -0,0 +1,78 @@ +import EventEmitter from "./events.js"; +import HookEvent from "./hook.js"; + +class History extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.History = this.window.History; + this.history = this.window.history; + this.historyProto = this.History ? this.History.prototype : {}; + this.pushState = this.historyProto.pushState; + this.replaceState = this.historyProto.replaceState; + this.go = this.historyProto.go; + this.back = this.historyProto.back; + this.forward = this.historyProto.forward; + }; + override() { + this.overridePushState(); + this.overrideReplaceState(); + this.overrideGo(); + this.overrideForward(); + this.overrideBack(); + }; + overridePushState() { + this.ctx.override(this.historyProto, 'pushState', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ state, title, url = '' ] = args; + + const event = new HookEvent({ state, title, url }, target, that); + this.emit('pushState', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.state, event.data.title, event.data.url); + }); + }; + overrideReplaceState() { + this.ctx.override(this.historyProto, 'replaceState', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ state, title, url = '' ] = args; + + const event = new HookEvent({ state, title, url }, target, that); + this.emit('replaceState', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.state, event.data.title, event.data.url); + }); + }; + overrideGo() { + this.ctx.override(this.historyProto, 'go', (target, that, [ delta ]) => { + const event = new HookEvent({ delta }, target, that); + this.emit('go', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.delta); + }); + }; + overrideForward() { + this.ctx.override(this.historyProto, 'forward', (target, that) => { + const event = new HookEvent(null, target, that); + this.emit('forward', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that); + }); + }; + overrideBack() { + this.ctx.override(this.historyProto, 'back', (target, that) => { + const event = new HookEvent(null, target, that); + this.emit('back', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that); + }); + }; +}; + +export default History; \ No newline at end of file diff --git a/client/hook.js b/client/hook.js new file mode 100644 index 0000000..aa82975 --- /dev/null +++ b/client/hook.js @@ -0,0 +1,23 @@ +class HookEvent { + #intercepted; + #returnValue; + constructor(data = {}, target = null, that = null) { + this.#intercepted = false; + this.#returnValue = null; + this.data = data; + this.target = target; + this.that = that; + }; + get intercepted() { + return this.#intercepted; + }; + get returnValue() { + return this.#returnValue; + }; + respondWith(input) { + this.#returnValue = input; + this.#intercepted = true; + }; +}; + +export default HookEvent; \ No newline at end of file diff --git a/client/index.js b/client/index.js new file mode 100644 index 0000000..b84f493 --- /dev/null +++ b/client/index.js @@ -0,0 +1,101 @@ +import DocumentHook from "./dom/document.js"; +import ElementApi from "./dom/element.js"; +import NodeApi from "./dom/node.js"; +import AttrApi from "./dom/attr.js"; +import FunctionHook from "./native/function.js"; +import ObjectHook from "./native/object.js"; +import Fetch from "./requests/fetch.js"; +import WebSocketApi from "./requests/websocket.js"; +import Xhr from "./requests/xhr.js"; +import EventSourceApi from "./requests/eventsource.js"; +import History from "./history.js"; +import LocationApi from "./location.js"; +import MessageApi from "./message.js"; +import NavigatorApi from "./navigator.js"; +import Workers from "./worker.js"; +import URLApi from "./url.js"; +import EventEmitter from "./events.js"; + +class UVClient extends EventEmitter { + constructor(window = self, worker = !window.window) { + super(); + this.window = window; + this.nativeMethods = { + fnToString: this.window.Function.prototype.toString, + defineProperty: this.window.Object.defineProperty, + getOwnPropertyDescriptor: this.window.Object.getOwnPropertyDescriptor, + getOwnPropertyDescriptors: this.window.Object.getOwnPropertyDescriptors, + isArray: this.window.Array.isArray, + setPrototypeOf: this.window.Object.setPrototypeOf, + isExtensible: this.window.Object.isExtensible, + }; + this.worker = worker; + this.fetch = new Fetch(this); + this.xhr = new Xhr(this); + this.history = new History(this); + this.element = new ElementApi(this); + this.node = new NodeApi(this) + this.document = new DocumentHook(this); + this.function = new FunctionHook(this); + this.object = new ObjectHook(this); + this.message = new MessageApi(this); + this.websocket = new WebSocketApi(this); + this.navigator = new NavigatorApi(this); + this.eventSource = new EventSourceApi(this); + this.attribute = new AttrApi(this); + this.url = new URLApi(this); + this.workers = new Workers(this); + this.location = new LocationApi(this); + }; + initLocation(rewriteUrl, sourceUrl) { + this.location = new LocationApi(this, sourceUrl, rewriteUrl, this.worker); + }; + override(obj, prop, wrapper, construct) { + if (!prop in obj) return false; + const wrapped = this.wrap(obj, prop, wrapper, construct); + return obj[prop] = wrapped; + }; + overrideDescriptor(obj, prop, wrapObj = {}) { + const wrapped = this.wrapDescriptor(obj, prop, wrapObj); + if (!wrapped) return {}; + this.nativeMethods.defineProperty(obj, prop, wrapped); + return wrapped; + }; + wrap(obj, prop, wrap, construct) { + const fn = obj[prop]; + if (!fn) return fn; + const wrapped = 'prototype' in fn ? function attach() { + return wrap(fn, this, [...arguments]); + } : { + attach() { + return wrap(fn, this, [...arguments]); + }, + }.attach; + + if (!!construct) { + wrapped.prototype = fn.prototype; + wrapped.prototype.constructor = wrapped; + }; + + this.emit('wrap', fn, wrapped, !!construct); + + return wrapped; + }; + wrapDescriptor(obj, prop, wrapObj = {}) { + const descriptor = this.nativeMethods.getOwnPropertyDescriptor(obj, prop); + if (!descriptor) return false; + for (let key in wrapObj) { + if (key in descriptor) { + if (key === 'get' || key === 'set') { + descriptor[key] = this.wrap(descriptor, key, wrapObj[key]); + } else { + descriptor[key] = typeof wrapObj[key] == 'function' ? wrapObj[key](descriptor[key]) : wrapObj[key]; + }; + } + }; + return descriptor; + }; +}; + +export default UVClient; +if (typeof self === 'object') self.UVClient = UVClient; \ No newline at end of file diff --git a/client/location.js b/client/location.js new file mode 100644 index 0000000..3ec0f40 --- /dev/null +++ b/client/location.js @@ -0,0 +1,119 @@ +class LocationApi { + constructor(ctx) { + this.ctx = ctx; + this.window = ctx.window; + this.location = this.window.location; + this.WorkerLocation = this.ctx.worker ? this.window.WorkerLocation : null; + this.workerLocProto = this.WorkerLocation ? this.WorkerLocation.prototype : {}; + this.keys = ['href', 'protocol', 'host', 'hostname', 'port', 'pathname', 'search', 'hash', 'origin']; + this.href = this.WorkerLocation ? ctx.nativeMethods.getOwnPropertyDescriptor(this.workerLocProto, 'href') : + ctx.nativeMethods.getOwnPropertyDescriptor(this.location, 'href'); + }; + overrideWorkerLocation(parse) { + if (!this.WorkerLocation) return false; + const uv = this; + + for (const key of this.keys) { + this.ctx.overrideDescriptor(this.workerLocProto, key, { + get: (target, that) => { + return parse( + uv.href.get.call(this.location) + )[key] + }, + }); + }; + + return true; + }; + emulate(parse, wrap) { + const emulation = {}; + const that = this; + + for (const key of that.keys) { + this.ctx.nativeMethods.defineProperty(emulation, key, { + get() { + return parse( + that.href.get.call(that.location) + )[key]; + }, + set: key !== 'origin' ? function (val) { + switch(key) { + case 'href': + that.location.href = wrap(val); + break; + case 'hash': + that.location.hash = val; + break; + default: + const url = new URL(emulation.href); + url[key] = val; + that.location.href = wrap(url.href); + }; + } : undefined, + configurable: false, + enumerable: true, + }); + }; + + if ('reload' in this.location) { + this.ctx.nativeMethods.defineProperty(emulation, 'reload', { + value: this.ctx.wrap(this.location, 'reload', (target, that) => { + return target.call(that === emulation ? this.location : that); + }), + writable: false, + enumerable: true, + }); + }; + + if ('replace' in this.location) { + this.ctx.nativeMethods.defineProperty(emulation, 'replace', { + value: this.ctx.wrap(this.location, 'assign', (target, that, args) => { + if (!args.length || that !== emulation) target.call(that); + that = this.location; + let [ input ] = args; + + const url = new URL(input, emulation.href); + return target.call(that === emulation ? this.location : that, wrap(url.href)); + }), + writable: false, + enumerable: true, + }); + }; + + if ('assign' in this.location) { + this.ctx.nativeMethods.defineProperty(emulation, 'assign', { + value: this.ctx.wrap(this.location, 'assign', (target, that, args) => { + if (!args.length || that !== emulation) target.call(that); + that = this.location; + let [ input ] = args; + + const url = new URL(input, emulation.href); + return target.call(that === emulation ? this.location : that, wrap(url.href)); + }), + writable: false, + enumerable: true, + }); + }; + + + this.ctx.nativeMethods.defineProperty(emulation, 'toString', { + value: this.ctx.wrap(this.location, 'toString', () => { + return emulation.href; + }), + enumerable: true, + writable: false, + }); + + this.ctx.nativeMethods.defineProperty(emulation, Symbol.toPrimitive, { + value: () => emulation.href, + writable: false, + enumerable: false, + }); + + if (this.ctx.window.Location) this.ctx.nativeMethods.setPrototypeOf(emulation, this.ctx.window.Location.prototype); + + return emulation; + }; +}; + +export default LocationApi; \ No newline at end of file diff --git a/client/message.js b/client/message.js new file mode 100644 index 0000000..4f41717 --- /dev/null +++ b/client/message.js @@ -0,0 +1,84 @@ +import EventEmitter from "./events.js"; +import HookEvent from "./hook.js"; + +class MessageApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.postMessage = this.window.postMessage; + this.MessageEvent = this.window.MessageEvent || {}; + this.MessagePort = this.window.MessagePort || {}; + this.mpProto = this.MessagePort.prototype || {}; + this.mpPostMessage = this.mpProto.postMessage; + this.messageProto = this.MessageEvent.prototype || {}; + this.messageData = ctx.nativeMethods.getOwnPropertyDescriptor(this.messageProto, 'data'); + this.messageOrigin = ctx.nativeMethods.getOwnPropertyDescriptor(this.messageProto, 'origin'); + }; + overridePostMessage() { + this.ctx.override(this.window, 'postMessage', (target, that, args) => { + if (!args.length) return target.apply(that, args); + + let message; + let origin; + let transfer; + + if (!this.ctx.worker) { + [ message, origin, transfer = [] ] = args; + } else { + [ message, transfer = [] ] = args; + }; + + const event = new HookEvent({ message, origin, transfer, worker: this.ctx.worker }, target, that); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return this.ctx.worker ? event.target.call(event.that, event.data.message, event.data.transfer) : event.target.call(event.that, event.data.message, event.data.origin, event.data.transfer); + }); + }; + wrapPostMessage(obj, prop, noOrigin = false) { + return this.ctx.wrap(obj, prop, (target, that, args) => { + if (this.ctx.worker ? !args.length : 2 > args) return target.apply(that, args); + let message; + let origin; + let transfer; + + if (!noOrigin) { + [ message, origin, transfer = [] ] = args; + } else { + [ message, transfer = [] ] = args; + origin = null; + }; + + const event = new HookEvent({ message, origin, transfer, worker: this.ctx.worker }, target, obj); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return noOrigin ? event.target.call(event.that, event.data.message, event.data.transfer) : event.target.call(event.that, event.data.message, event.data.origin, event.data.transfer); + }); + }; + overrideMessageOrigin() { + this.ctx.overrideDescriptor(this.messageProto, 'origin', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('origin', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + } + }); + }; + overrideMessageData() { + this.ctx.overrideDescriptor(this.messageProto, 'data', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('data', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + } + }); + }; +}; + +export default MessageApi; \ No newline at end of file diff --git a/client/native/function.js b/client/native/function.js new file mode 100644 index 0000000..8b85ea6 --- /dev/null +++ b/client/native/function.js @@ -0,0 +1,46 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class FunctionHook extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Function = this.window.Function; + this.fnProto = this.Function.prototype; + this.toString = this.fnProto.toString; + this.fnStrings = ctx.fnStrings; + this.call = this.fnProto.call; + this.apply = this.fnProto.apply; + this.bind = this.fnProto.bind; + }; + overrideFunction() { + this.ctx.override(this.window, 'Function', (target, that, args) => { + if (!args.length) return target.apply(that, args); + + let script = args[args.length - 1]; + let fnArgs = []; + + for (let i = 0; i < args.length - 1; i++) { + fnArgs.push(args[i]); + }; + + const event = new HookEvent({ script, args: fnArgs }, target, that); + this.emit('function', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, ...event.data.args, event.data.script); + }, true); + }; + overrideToString() { + this.ctx.override(this.fnProto, 'toString', (target, that) => { + const event = new HookEvent({ fn: that }, target, that); + this.emit('toString', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.data.fn); + }); + }; +}; + +export default FunctionHook; \ No newline at end of file diff --git a/client/native/object.js b/client/native/object.js new file mode 100644 index 0000000..1cd6caa --- /dev/null +++ b/client/native/object.js @@ -0,0 +1,40 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class ObjectHook extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Object = this.window.Object; + this.getOwnPropertyDescriptors = this.Object.getOwnPropertyDescriptors; + this.getOwnPropertyDescriptor = this.Object.getOwnPropertyDescriptor; + this.getOwnPropertyNames = this.Object.getOwnPropertyNames; + }; + overrideGetPropertyNames() { + this.ctx.override(this.Object, 'getOwnPropertyNames', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ object ] = args; + + const event = new HookEvent({ names: target.call(that, object) }, target, that); + this.emit('getOwnPropertyNames', event); + + if (event.intercepted) return event.returnValue; + return event.data.names; + }); + }; + overrideGetOwnPropertyDescriptors() { + this.ctx.override(this.Object, 'getOwnPropertyDescriptors', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ object ] = args; + + const event = new HookEvent({ descriptors: target.call(that, object) }, target, that); + this.emit('getOwnPropertyDescriptors', event); + + if (event.intercepted) return event.returnValue; + return event.data.descriptors; + }); + }; +}; + +export default ObjectHook; \ No newline at end of file diff --git a/client/navigator.js b/client/navigator.js new file mode 100644 index 0000000..1bf217b --- /dev/null +++ b/client/navigator.js @@ -0,0 +1,28 @@ +import EventEmitter from "./events.js"; +import HookEvent from "./hook.js"; + +class NavigatorApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.navigator = this.window.navigator; + this.Navigator = this.window.Navigator || {}; + this.navProto = this.Navigator.prototype || {}; + this.sendBeacon = this.navProto.sendBeacon; + }; + overrideSendBeacon() { + this.ctx.override(this.navProto, 'sendBeacon', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url, data = '' ] = args; + + const event = new HookEvent({ url, data }, target, that); + this.emit('sendBeacon', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url, event.data.data); + }); + }; +}; + +export default NavigatorApi; \ No newline at end of file diff --git a/client/requests/eventsource.js b/client/requests/eventsource.js new file mode 100644 index 0000000..3ab3bd6 --- /dev/null +++ b/client/requests/eventsource.js @@ -0,0 +1,36 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class EventSourceApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.EventSource = this.window.EventSource || {}; + this.esProto = this.EventSource.prototype || {}; + this.url = ctx.nativeMethods.getOwnPropertyDescriptor(this.esProto, 'url'); + }; + overrideConstruct() { + this.ctx.override(this.window, 'EventSource', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, config = {} ] = args; + + const event = new HookEvent({ url, config }, target, that); + this.emit('construct', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url, event.data.config); + }, true); + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.esProto, 'url', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('url', event); + return event.data.value; + }, + }); + }; +}; + +export default EventSourceApi; \ No newline at end of file diff --git a/client/requests/fetch.js b/client/requests/fetch.js new file mode 100644 index 0000000..bf3e626 --- /dev/null +++ b/client/requests/fetch.js @@ -0,0 +1,166 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class Fetch extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.fetch = this.window.fetch; + this.Request = this.window.Request; + this.Response = this.window.Response; + this.Headers = this.window.Headers; + this.reqProto = this.Request ? this.Request.prototype : {}; + this.resProto = this.Response ? this.Response.prototype : {}; + this.headersProto = this.Headers ? this.Headers.prototype : {}; + this.reqUrl = ctx.nativeMethods.getOwnPropertyDescriptor(this.reqProto, 'url'); + this.resUrl = ctx.nativeMethods.getOwnPropertyDescriptor(this.resProto, 'url'); + this.reqHeaders = ctx.nativeMethods.getOwnPropertyDescriptor(this.reqProto, 'headers'); + this.resHeaders = ctx.nativeMethods.getOwnPropertyDescriptor(this.resProto, 'headers'); + }; + override() { + this.overrideRequest(); + this.overrideUrl(); + this.overrideHeaders(); + return true; + }; + overrideRequest() { + if (!this.fetch) return false; + + this.ctx.override(this.window, 'fetch', (target, that, args) => { + if (!args.length || args[0] instanceof this.Request) return target.apply(that, args); + + let [ input, options = {} ] = args; + const event = new HookEvent({ input, options }, target, that); + + this.emit('request', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.input, event.data.options); + }); + + this.ctx.override(this.window, 'Request', (target, that, args) => { + if (!args.length) return new target(...args); + + let [ input, options = {} ] = args; + const event = new HookEvent({ input, options }, target); + + this.emit('request', event); + if (event.intercepted) return event.returnValue; + + return new event.target(event.data.input, event.data.options); + }, true); + return true; + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.reqProto, 'url', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + + this.emit('requestUrl', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.resProto, 'url', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + + this.emit('responseUrl', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + return true; + }; + overrideHeaders() { + if (!this.Headers) return false; + + this.ctx.overrideDescriptor(this.reqProto, 'headers', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + + this.emit('requestHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.resProto, 'headers', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + + this.emit('responseHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.override(this.headersProto, 'get', (target, that, [ name ]) => { + if (!name) return target.call(that); + const event = new HookEvent({ name, value: target.call(that, name) }, target, that); + + this.emit('getHeader', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + + this.ctx.override(this.headersProto, 'set', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new HookEvent({ name, value }, target, that); + + this.emit('setHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + + this.ctx.override(this.headersProto, 'has', (target, that, args) => { + if (!args.length) return target.call(that); + let [ name ] = args; + + const event = new HookEvent({ name, value: target.call(that, name) }, target, that); + + this.emit('hasHeader', event); + if (event.intercepted) return event.returnValue; + + return event.data; + }); + + this.ctx.override(this.headersProto, 'append', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new HookEvent({ name, value }, target, that); + + this.emit('appendHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + + this.ctx.override(this.headersProto, 'delete', (target, that, args) => { + if (!args.length) return target.apply(that, args); + + let [ name ] = args; + const event = new HookEvent({ name }, target, that); + + this.emit('deleteHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name); + }); + + return true; + }; +}; + +export default Fetch; \ No newline at end of file diff --git a/client/requests/websocket.js b/client/requests/websocket.js new file mode 100644 index 0000000..50d8082 --- /dev/null +++ b/client/requests/websocket.js @@ -0,0 +1,49 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class WebSocketApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.WebSocket = this.window.WebSocket || {}; + this.wsProto = this.WebSocket.prototype || {}; + this.url = ctx.nativeMethods.getOwnPropertyDescriptor(this.wsProto, 'url'); + this.protocol = ctx.nativeMethods.getOwnPropertyDescriptor(this.wsProto, 'protocol'); + this.send = this.wsProto.send; + this.close = this.wsProto.close; + }; + overrideWebSocket() { + this.ctx.override(this.window, 'WebSocket', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, protocols = [] ] = args; + + if (!this.ctx.nativeMethods.isArray(protocols)) protocols = [ protocols ]; + const event = new HookEvent({ url, protocols }, target, that); + this.emit('websocket', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url, event.data.protocols); + }, true); + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.wsProto, 'url', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('url', event); + return event.data.value; + }, + }); + }; + overrideProtocol() { + this.ctx.overrideDescriptor(this.wsProto, 'protocol', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('protocol', event); + return event.data.value; + }, + }); + }; +}; + +export default WebSocketApi; \ No newline at end of file diff --git a/client/requests/xhr.js b/client/requests/xhr.js new file mode 100644 index 0000000..493b71c --- /dev/null +++ b/client/requests/xhr.js @@ -0,0 +1,109 @@ +import EventEmitter from "../events.js"; +import HookEvent from "../hook.js"; + +class Xhr extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.XMLHttpRequest = this.window.XMLHttpRequest; + this.xhrProto = this.window.XMLHttpRequest ? this.window.XMLHttpRequest.prototype : {}; + this.open = this.xhrProto.open; + this.abort = this.xhrProto.abort; + this.send = this.xhrProto.send; + this.overrideMimeType = this.xhrProto.overrideMimeType + this.getAllResponseHeaders = this.xhrProto.getAllResponseHeaders; + this.getResponseHeader = this.xhrProto.getResponseHeader; + this.setRequestHeader = this.xhrProto.setRequestHeader; + this.responseURL = ctx.nativeMethods.getOwnPropertyDescriptor(this.xhrProto, 'responseURL'); + this.responseText = ctx.nativeMethods.getOwnPropertyDescriptor(this.xhrProto, 'responseText'); + }; + override() { + this.overrideOpen(); + this.overrideSend(); + this.overrideMimeType(); + this.overrideGetResHeader(); + this.overrideGetResHeaders(); + this.overrideSetReqHeader(); + }; + overrideOpen() { + this.ctx.override(this.xhrProto, 'open', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ method, input, async = true, user = null, password = null ] = args; + const event = new HookEvent({ method, input, async, user, password }, target, that); + + this.emit('open', event); + if (event.intercepted) return event.returnValue; + + return event.target.call( + event.that, + event.data.method, + event.data.input, + event.data.async, + event.data.user, + event.data.password + ); + }); + }; + overrideResponseUrl() { + this.ctx.overrideDescriptor(this.xhrProto, 'responseURL', { + get: (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + this.emit('responseUrl', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideSend() { + this.ctx.override(this.xhrProto, 'send', (target, that, [ body = null ]) => { + const event = new HookEvent({ body }, target, that); + + this.emit('send', event); + if (event.intercepted) return event.returnValue; + + return event.target.call( + event.that, + event.data.body, + ); + }); + }; + overrideSetReqHeader() { + this.ctx.override(this.xhrProto, 'setRequestHeader', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new HookEvent({ name, value }, target, that); + + this.emit('setReqHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + }; + overrideGetResHeaders() { + this.ctx.override(this.xhrProto, 'getAllResponseHeaders', (target, that) => { + const event = new HookEvent({ value: target.call(that) }, target, that); + + this.emit('getAllResponseHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + }; + overrideGetResHeader() { + this.ctx.override(this.xhrProto, 'getResponseHeader', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new HookEvent({ name, value: target.call(that, name) }, target, that); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + }; +}; + +export default Xhr \ No newline at end of file diff --git a/client/url.js b/client/url.js new file mode 100644 index 0000000..bb6e747 --- /dev/null +++ b/client/url.js @@ -0,0 +1,37 @@ +import EventEmitter from "./events.js"; +import HookEvent from "./hook.js"; + +class URLApi extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.URL = this.window.URL || {}; + this.createObjectURL = this.URL.createObjectURL; + this.revokeObjectURL = this.URL.revokeObjectURL; + }; + overrideObjectURL() { + this.ctx.override(this.URL, 'createObjectURL', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ object ] = args; + + const event = new HookEvent({ object }, target, that); + this.emit('createObjectURL', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.object); + }); + this.ctx.override(this.URL, 'revokeObjectURL', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url ] = args; + + const event = new HookEvent({ url }, target, that); + this.emit('revokeObjectURL', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url); + }); + }; +}; + +export default URLApi; \ No newline at end of file diff --git a/client/worker.js b/client/worker.js new file mode 100644 index 0000000..f567a2b --- /dev/null +++ b/client/worker.js @@ -0,0 +1,66 @@ +import EventEmitter from "./events.js"; +import HookEvent from "./hook.js"; + +class Workers extends EventEmitter { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Worker = this.window.Worker || {}; + this.Worklet = this.window.Worklet || {}; + this.workletProto = this.Worklet.prototype || {}; + this.workerProto = this.Worker.prototype || {}; + this.postMessage = this.workerProto.postMessage; + this.terminate = this.workerProto.terminate; + this.addModule = this.workletProto.addModule; + }; + overrideWorker() { + this.ctx.override(this.window, 'Worker', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, options = {} ] = args; + + const event = new HookEvent({ url, options }, target, that); + this.emit('worker', event); + + if (event.intercepted) return event.returnValue; + return new event.target(...[ event.data.url, event.data.options ]); + }, true); + }; + overrideAddModule() { + this.ctx.override(this.workletProto, 'addModule', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url, options = {} ] = args; + + const event = new HookEvent({ url, options }, target, that); + this.emit('addModule', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url, event.data.options); + }); + }; + overridePostMessage() { + this.ctx.override(this.workerProto, 'postMessage', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ message, transfer = [] ] = args; + + const event = new HookEvent({ message, transfer }, target, that); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.message, event.data.transfer); + }); + }; + overrideImportScripts() { + this.ctx.override(this.window, 'importScripts', (target, that, scripts) => { + if (!scripts.length) return target.apply(that, scripts); + + const event = new HookEvent({ scripts }, target, that); + this.emit('importScripts', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.scripts); + }); + }; +}; + +export default Workers; \ No newline at end of file diff --git a/example/config.json b/example/config.json new file mode 100644 index 0000000..4a9bd5a --- /dev/null +++ b/example/config.json @@ -0,0 +1,4 @@ +{ + "prefix": "/service/", + "bare": "/bare/" +} \ No newline at end of file diff --git a/example/index.js b/example/index.js new file mode 100644 index 0000000..1e56e3d --- /dev/null +++ b/example/index.js @@ -0,0 +1,138 @@ +import https from "https"; +import httpStatic from "node-static"; +import path from "path"; +import { readFileSync, createReadStream, read } from "fs"; +import request from "../server/v1/request.js"; + +const __dirname = path.resolve(path.dirname(decodeURI(new URL(import.meta.url).pathname))).slice(3); +const config = JSON.parse(readFileSync(path.join(__dirname, './config.json'), 'utf-8')); +const file = new httpStatic.Server(path.join(__dirname, './static/')); + +const server = https.createServer({ + key: readFileSync(path.join(__dirname, './ssl.key')), + cert: readFileSync(path.join(__dirname, './ssl.cert')), +}); + +server.on('request', (req, res) => { + if (req.url.startsWith(config.bare + 'v1/')) { + return request(req, res); + }; + + if (req.url.startsWith('/uv.handler.js')) { + res.writeHead(200, { "Content-Type": "application/javascript" }); + createUVFileStream('uv.handler.js').pipe(res); + return true; + }; + + if (req.url.startsWith('/uv.sw.js')) { + res.writeHead(200, { "Content-Type": "application/javascript" }); + createUVFileStream('uv.sw.js').pipe(res); + return true; + }; + + if (req.url.startsWith('/uv.bundle.js')) { + res.writeHead(200, { "Content-Type": "application/javascript" }); + createUVFileStream('uv.bundle.js').pipe(res); + return true; + }; + + if (req.url.startsWith(config.prefix)) { + res.writeHead(200, { "Content-Type": "text/html" }); + createReadStream(path.join(__dirname, './load.html')).pipe(res); + return true; + }; + + file.serve(req, res); +}); + +const impl = { + 'accept-encoding': 'Accept-Encoding', + 'accept-language': 'Accept-Language', + 'accept': 'Accept', + 'sec-websocket-extensions': 'Sec-WebSocket-Extensions', + 'sec-websocket-key': 'Sec-WebSocket-Key', + 'sec-websocket-version': 'Sec-WebSocket-Version' +}; + +server.on('upgrade', (req, socket, head) => { + if (!req.url.startsWith('/bare/v1/') || !req.headers['sec-websocket-protocol']) return socket.end(); + try { + const [ bare, data ] = req.headers['sec-websocket-protocol'].split(/,\s*/g); + const { + remote, + headers, + forward_headers: forward, + } = JSON.parse(decodeProtocol(data)); + + for (const header of forward) { + if (req.headers[header]) headers[(impl[header] || header)] = req.headers[header]; + }; + + const url = new URL(remote.protocol + '//' + remote.host + ':' + remote.port + remote.path); + const remoteRequest = (url.protocol === 'https:' ? https : http).request( + url, + { + headers, + method: req.method, + } + ); + + remoteRequest.on('upgrade', (remoteResponse, remoteSocket, remoteHead) => { + let handshake = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n'; + if (remoteResponse.headers['sec-websocket-accept']) handshake += `Sec-WebSocket-Accept: ${remoteResponse.headers['sec-websocket-accept']}\r\n`; + if (remoteResponse.headers['sec-websocket-extensions']) handshake += `Sec-WebSocket-Extensions: ${remoteResponse.headers['sec-websocket-extensions']}\r\n`; + handshake += `Sec-WebSocket-Protocol: bare\r\n`; + if (remoteResponse.headers['connection']) handshake += `Connection: ${remoteResponse.headers['connection']}\r\n`; + if (remoteResponse.headers['upgrade']) handshake += `Upgrade: ${remoteResponse.headers['upgrade']}\r\n`; + handshake += '\r\n'; + socket.write(handshake); + socket.write(remoteHead); + remoteSocket.on('close', () => socket.end()); + socket.on('close', () => remoteSocket.end()); + remoteSocket.on('error', () => socket.end()); + socket.on('error', () => remoteSocket.end()); + + remoteSocket.pipe(socket); + socket.pipe(remoteSocket); + }); + + remoteRequest.on('error', () => socket.end()); + + remoteRequest.end(); + + } catch(e) { + console.log(e); + socket.end(); + }; +}) + +function decodeProtocol(protocol){ + if(typeof protocol != 'string')throw new TypeError('protocol must be a string'); + + let result = ''; + + for(let i = 0; i < protocol.length; i++){ + const char = protocol[i]; + + if(char == '%'){ + const code = parseInt(protocol.slice(i + 1, i + 3), 16); + const decoded = String.fromCharCode(code); + + result += decoded; + i += 2; + }else{ + result += char; + } + } + + return result; +} + + +server.listen(443); + +function createUVFileStream(file) { + return createReadStream( + path.join(__dirname, '../lib/', file) + ); +}; \ No newline at end of file diff --git a/example/index.test.js b/example/index.test.js new file mode 100644 index 0000000..1b585d7 --- /dev/null +++ b/example/index.test.js @@ -0,0 +1,229 @@ +import http from "http"; +import https from "https"; +import httpStatic from "node-static"; +import path from "path"; +import { readFileSync, createReadStream } from "fs"; +import webpack from "webpack"; + +const __dirname = path.resolve(path.dirname(decodeURI(new URL(import.meta.url).pathname))).slice(3); +const file = new httpStatic.Server(path.join(__dirname, './static/')); + +const server = https.createServer({ + key: readFileSync(path.join(__dirname, './ssl.key')), + cert: readFileSync(path.join(__dirname, './ssl.cert')), +}); + +server.on('request', (req, res) => { + + if (req.url.startsWith('/service/')) { + res.writeHead(200, { "Content-Type": "text/html", "Cache-Control": 'no-cache' }); + createReadStream(path.join(__dirname, './load.html')).pipe(res); + return; + }; + + if (!req.url.startsWith('/bare/v1/')) return file.serve(req, res); + + + try { + const headers = JSON.parse(req.headers['x-bare-headers']); + const forward = JSON.parse((req.headers['x-bare-forward-headers'] || '[]')); + const url = new URL(req.headers['x-bare-protocol'] + '//' + req.headers['x-bare-host'] + ':' + req.headers['x-bare-port'] + req.headers['x-bare-path']); + + for (const header of forward) { + if (req.headers[header]) headers[header] = req.headers[header]; + }; + + const remoteRequest = (url.protocol === 'https:' ? https : http).request( + url, + { + headers: headers, + method: req.method, + } + ); + + remoteRequest.on('response', remoteResponse => { + remoteResponse.headers['x-bare-headers'] = JSON.stringify(remoteResponse.headers); + remoteResponse.headers['x-bare-status'] = remoteResponse.statusCode.toString(); + remoteResponse.headers['x-bare-status-text'] = remoteResponse.statusMessage; + remoteResponse.headers['cache-control'] = 'no-cache'; + + const headers = { + 'x-bare-headers': JSON.stringify(remoteResponse.headers), + 'x-bare-status': remoteResponse.statusCode.toString(), + 'x-bare-status-text': remoteResponse.statusMessage, + 'cache-control': 'no-cache', + }; + + if (remoteResponse.headers['content-encoding']) headers['content-encoding'] = remoteResponse.headers['content-encoding']; + if (remoteResponse.headers['content-length']) headers['content-length'] = remoteResponse.headers['content-length']; + + res.writeHead(200, headers); + remoteResponse.pipe(res); + }); + + remoteRequest.on('error', e => { + res.writeHead(500, {}); + res.end(); + }); + + req.pipe(remoteRequest); + } catch(e) { + res.writeHead(500, {}); + res.end(); + }; + +}); + +const impl = { + 'accept-encoding': 'Accept-Encoding', + 'accept-language': 'Accept-Language', + 'accept': 'Accept', + 'sec-websocket-extensions': 'Sec-WebSocket-Extensions', + 'sec-websocket-key': 'Sec-WebSocket-Key', + 'sec-websocket-version': 'Sec-WebSocket-Version' +}; + +server.on('upgrade', (req, socket, head) => { + if (!req.url.startsWith('/bare/v1/') || !req.headers['sec-websocket-protocol']) return socket.end(); + try { + const [ bare, data ] = req.headers['sec-websocket-protocol'].split(/,\s*/g); + const { + remote, + headers, + forward_headers: forward, + } = JSON.parse(decodeProtocol(data)); + + for (const header of forward) { + if (req.headers[header]) headers[(impl[header] || header)] = req.headers[header]; + }; + + const url = new URL(remote.protocol + '//' + remote.host + ':' + remote.port + remote.path); + const remoteRequest = (url.protocol === 'https:' ? https : http).request( + url, + { + headers, + method: req.method, + } + ); + + remoteRequest.on('upgrade', (remoteResponse, remoteSocket, remoteHead) => { + let handshake = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n'; + if (remoteResponse.headers['sec-websocket-accept']) handshake += `Sec-WebSocket-Accept: ${remoteResponse.headers['sec-websocket-accept']}\r\n`; + if (remoteResponse.headers['sec-websocket-extensions']) handshake += `Sec-WebSocket-Extensions: ${remoteResponse.headers['sec-websocket-extensions']}\r\n`; + handshake += `Sec-WebSocket-Protocol: bare\r\n`; + if (remoteResponse.headers['connection']) handshake += `Connection: ${remoteResponse.headers['connection']}\r\n`; + if (remoteResponse.headers['upgrade']) handshake += `Upgrade: ${remoteResponse.headers['upgrade']}\r\n`; + handshake += '\r\n'; + socket.write(handshake); + socket.write(remoteHead); + remoteSocket.on('close', () => socket.end()); + socket.on('close', () => remoteSocket.end()); + remoteSocket.on('error', () => socket.end()); + socket.on('error', () => remoteSocket.end()); + + remoteSocket.pipe(socket); + socket.pipe(remoteSocket); + }); + + remoteRequest.on('error', () => socket.end()); + + remoteRequest.end(); + + } catch(e) { + console.log(e); + socket.end(); + }; +}); + + +server.listen(443); + + +const valid_chars = "!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~"; +const reserved_chars = "%"; + +function encodeProtocol(protocol){ + protocol = protocol.toString(); + + let result = ''; + + for(let i = 0; i < protocol.length; i++){ + const char = protocol[i]; + + if(valid_chars.includes(char) && !reserved_chars.includes(char)){ + result += char; + }else{ + const code = char.charCodeAt(); + result += '%' + code.toString(16).padStart(2, 0); + } + } + + return result; +} + +function decodeProtocol(protocol){ + if(typeof protocol != 'string')throw new TypeError('protocol must be a string'); + + let result = ''; + + for(let i = 0; i < protocol.length; i++){ + const char = protocol[i]; + + if(char == '%'){ + const code = parseInt(protocol.slice(i + 1, i + 3), 16); + const decoded = String.fromCharCode(code); + + result += decoded; + i += 2; + }else{ + result += char; + } + } + + return result; +} + + +function parseRawHeaders(rawHeaders = []) { + const obj = {}; + + for (let i = 0; i < rawHeaders.length; i+=2) { + const name = rawHeaders[i] || ''; + const lowerCaseName = name.toLowerCase(); + const value = rawHeaders[i + 1] || ''; + + if (lowerCaseName in obj) { + if (Array.isArray(obj[lowerCaseName].value)) { + obj[lowerCaseName].value.push(value); + } else { + obj[lowerCaseName].value = [ obj[lowerCaseName].value, value ]; + }; + } else { + obj[lowerCaseName] = { name, value }; + }; + }; + + return obj; +}; + +function compileParsedHeaders(headers = {}, prefix = false) { + const compiled = {}; + + for (const key in headers) { + const { name, value } = headers[key]; + compiled[(prefix ? 'x-op-' : '') + name] = value; + }; + + return compiled; +}; + +webpack({ + mode: 'none', + entry: path.join(__dirname, '../lib/index.js'), + output: { + path: __dirname, + filename: './static/op.bundle.js', + } +}, (err, i) => + console.log(!err ? 'Ultraviolet bundled!' : 'Err') +); \ No newline at end of file diff --git a/example/load.html b/example/load.html new file mode 100644 index 0000000..f6ad2bd --- /dev/null +++ b/example/load.html @@ -0,0 +1,16 @@ + + +
+ + + + \ No newline at end of file diff --git a/example/ssl.cert b/example/ssl.cert new file mode 100644 index 0000000..f87b9e0 --- /dev/null +++ b/example/ssl.cert @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIJAJnCkScWtmL0MA0GCSqGSIb3DQEBCwUAMGwxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRgwFgYDVQQKDA9UaXRhbml1bU5l +dHdvcmsxDjAMBgNVBAsMBWdhbWVyMR4wHAYDVQQDDBUqLnRpdGFuaXVtbmV0d29y +ay5vcmcwHhcNMjAwNjEzMTg0OTU2WhcNMjEwNjEzMTg0OTU2WjBsMQswCQYDVQQG +EwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEYMBYGA1UECgwPVGl0YW5pdW1OZXR3 +b3JrMQ4wDAYDVQQLDAVnYW1lcjEeMBwGA1UEAwwVKi50aXRhbml1bW5ldHdvcmsu +b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPL69+RE6r8RrFh4 +njzC8ZRnLB+yNtuGw14C0dvNb5JwgdLl5g9/wK/s0V5NGlqwxlQlxQ/gUSuYEcUR +6MYjcnaUmZZe/gaKVV0fkfkuigOWhLnI5AQxx7rhkzx1ujuyJ9D2pkDtZpSvv0yn +2yrvWhJMtjuxGYip8jaLuRpbXoafvR7nrlDaNcE/GwIjnCCxsRnY2bGbxYK840mN +fuMfF2nz+fXKPuQ/9PT48e3wOo9vM5s7yKhiHYwrogqzGN4cH4sSr1FE8C7flFyT +Yw101u7fUaopfeGCo9Pg6IrfzyzE5Qb7OlqlVk2IkvXx7pPqVc6lZCJEhOX/qF9o +n3mFqwIDAQABo1AwTjAdBgNVHQ4EFgQUC561ob2kGtFQ4az6y64b98+Fy+IwHwYD +VR0jBBgwFoAUC561ob2kGtFQ4az6y64b98+Fy+IwDAYDVR0TBAUwAwEB/zANBgkq +hkiG9w0BAQsFAAOCAQEAotvUsSLSzFyxQz329tEPyH6Tmi19FQoA5ZbLg6EqeTI9 +08qOByDGkSYJi0npaIlPO1I557NxRzdO0PxK3ybol6lnzuSlqCJP5nb1dr0z2Eax +wgKht9P+ap/yozU5ye05ah2nkpcaeDPnwnnWFmfsnYNfgu62EshOS+5FETWEKVUb +LXQhGInOdJq8KZvhoLZWJoUhyAqxBfW4oVvaqs+Ff96A2NNKrvbiAVYX30rVa+x0 +KIl0/DoVvDx2Q6TiL396cAXdKUW7edRQcSsGFcxwIrU5lePm0V05aN+oCoEBvXBG +ArPN+a5kpGjJwfcpcBVf9cJ6IsvptGS9de3eTHoTyw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/example/ssl.key b/example/ssl.key new file mode 100644 index 0000000..a878bfd --- /dev/null +++ b/example/ssl.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDA8vr35ETqvxGs +WHiePMLxlGcsH7I224bDXgLR281vknCB0uXmD3/Ar+zRXk0aWrDGVCXFD+BRK5gR +xRHoxiNydpSZll7+BopVXR+R+S6KA5aEucjkBDHHuuGTPHW6O7In0PamQO1mlK+/ +TKfbKu9aEky2O7EZiKnyNou5Gltehp+9HueuUNo1wT8bAiOcILGxGdjZsZvFgrzj +SY1+4x8XafP59co+5D/09Pjx7fA6j28zmzvIqGIdjCuiCrMY3hwfixKvUUTwLt+U +XJNjDXTW7t9Rqil94YKj0+Doit/PLMTlBvs6WqVWTYiS9fHuk+pVzqVkIkSE5f+o +X2ifeYWrAgMBAAECggEAbihK8Ev6rKr5RBQeiPjXs2SuoppV/MvIXLHHmliLKS/J +29S0PGyM202VPtM/4dP1KMXR6nft8WmaIEsKtoKoqijZHfajtRO21pWb+JLy5wi1 +XoFTGBrs8MLZFl5mODTsuZ6rsq9O2kn5LJZvHsmcbSgVc9UQfytvG0HY840ArS3g +kSDtUFb1xRui6wtCBKzHVvCT+FXhSBbwkHalmbqP6BefhJ3lW2VonkOcHDrdXPfW +CEN18IJ2v8QYgXqZP6VUlAweNXLJ33ZOl+jXGdygcOG24MFqdw0VtP0XFGk0jnSS +W6dX67BZKeZ71EKaTy02jw5LpQNXA70ismPJHQ2uQQKBgQDuROawnBIW1fC3xOle +m+JmP0eMe0eIQycxRsMXsXhYAA0wV3qYZSLZrNK2eRhmSNt+ODSmZ2Vt11dwOv5u +bo8WONrRlM097SmitS2S+8o7ASem2VKQzyRE72Y9517Q+aNBdLRVtjrRNSw/hfSu +ayLuG36+yukSH7wq7mfoUX34ZwKBgQDPTrgyyw8n5XhZT/qTTRnQJ2GTvPxDzNoJ +IAGhGJGFAb6wgLoSpGx6BC122vuRxcTjkjAiMDci5N2zNW+YZVni+F0KTVvNFfU2 +pOTJUg3luRTygCra6O02PxwpbP/9KCBAKq/kYw/eBW+gxhPwP3ZrbAirvBjgBh0I +kIrFijNOHQKBgGUUAbFGZD4fwCCVflLOWnr5uUaVPcFGi6fR1w2EEgNy8iVh1vYz +YVdqg3E5aepqWgLvoRY+or64LbXEsQ70A+tvbxSdxXvR0mnd5lmGS0JAuSuE4gvg +dAhybrMwJf8NB/7KnX4G8mix3/WKxEQB2y2bqGcT+U/g+phTzuy1NXVdAoGBAIrl +jVjK4J60iswcYCEteWwT1rbr2oF60WNnxG+xTF63apJLzWAMNnoSLnwCAKgMv/xR +yFo/v9FrUnduCBUtYupFyeDLMATa/27bUEbq6VDPjw9jfFMr2TONWUsQMvvlVKZp +c2wsS0dQkRhBXr6LZsZWngCiiHAg6HcCkVgFXpapAoGBAJ/8oLGt0Ar+0MTl+gyk +xSqgHnsc5jgqhix3nIoI5oEAbfibdGmRD1S3rtWD9YsnPxMIl+6E5bOAHrmd+Zr8 +O7EP+CLvbz4JXidaaa85h9ThXSG5xk1A1UTtSFrp+KolLE1Vvmjjd+R844XsM2wZ +OAHbihzk0iPPphjEWR4lU4Av +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/example/static/index.html b/example/static/index.html new file mode 100644 index 0000000..3a53252 --- /dev/null +++ b/example/static/index.html @@ -0,0 +1,17 @@ + + + + + + + + +
- First 'p' closes without a closing + // tag and for cases like
['"])|(?\/\*|\*\/)/g; + this.ctx = ctx; + this.meta = ctx.meta; + this.parsel = _parsel_js__WEBPACK_IMPORTED_MODULE_1__["default"]; + }; + rewrite(str, options = this.meta) { + return this.rewriteChunk(str, options, {}, 'rewrite').output.join(""); + }; + rewriteSelector(str, attributes = [], list = true, prefix = '__op-attr-') { + if (!str) return str; + + try { + if (list) { + const selectors = str.split(/(\s*$),(\s*$)/); + const processed = []; + + + for (const selector of selectors) { + processed.push( + this.rewriteSelector(selector, attributes, false, prefix) + ) + }; + + return processed.join(', '); + }; + let slice = 0; + const output = []; + const tokens = this.parsel.tokenize(str) + + for (const token of tokens) { + if (token.type !== 'attribute') continue; + + + const [ start ] = token.pos; + const end = start + token.content.length; + + if (attributes.includes(token.name)) { + output.push( + str.slice(slice, start) + ); + + output.push( + token.content.replace(token.name, prefix + token.name) + ); + + slice = end; + }; + }; + + output.push( + str.slice(slice) + ); + + return output.join(''); + } catch(e) { + return str; + }; + }; + rewriteChunk(chunk, options = this.meta, state = {}, type = 'rewrite') { + const regex = new RegExp(this.regex); + state.string ||= false; + state.quote ||= ''; + state.previous ||= null; + state.url ||= false; + state.urlContent ||= ''; + state.rewriteString ||= false; + state.comment ||= false; + state.stringContent ||= ''; + + const output = []; + let loc = 0; + let cutoff = chunk.length; + let match = null; + + if (state.string || state.url) cutoff = 0; + + while ((match = regex.exec(chunk)) !== null) { + const { + url, + parathesis, + quote, + trailingEscape, + comment, + } = match.groups; + + if (state.comment) { + if (comment === '*/') { + state.comment = false; + } + continue; + }; + + if (comment === '/*') { + state.comment = true; + continue; + }; + + if (state.string) { + if (quote) { + if (state.quote === quote) { + // Checks for backslashes that can escape the quote. + // Also checking for backslashes that can escape the backslash behind the quote. Unlikely to happen, but still possible. + if (trailingEscape && trailingEscape.length & 1) continue; + + if (state.rewriteString) { + const string = state.stringContent + chunk.slice(cutoff, match.index); + + output.push( + chunk.slice(loc, cutoff) + ); + + const url = new URLEvent(string, state, options, type); + this.emit('url', url); + + output.push( + url.value + ); + + output.push(quote); + + loc = regex.lastIndex; + cutoff = chunk.length; + + chunk.slice(loc, cutoff); + + state.rewriteString = false; + }; + + state.quote = ''; + state.string = false; + state.stringContent = ''; + }; + }; + continue; + }; + + if (quote) { + state.string = true; + state.quote = quote; + + if (state.previous && state.previous.groups.import) { + state.rewriteString = true; + cutoff = regex.lastIndex; + }; + }; + + if (state.url && parathesis === ')' && !state.string) { + const string = (state.urlContent + chunk.slice(cutoff, match.index)).trim(); + + output.push( + chunk.slice(loc, cutoff) + ); + + if ((string[0] === '"' || string[0] === "'") && string[0] === string[string.length - 1]) { + output.push(string[0]); + + const url = new URLEvent(string.slice(1, string.length - 1), state, options, type); + this.emit('url', url); + + output.push( + url.value + ); + + output.push(string[0]); + } else { + const url = new URLEvent(string, state, options, type); + this.emit('url', url); + + output.push( + url.value, + ); + }; + + output.push(parathesis); + + loc = regex.lastIndex; + cutoff = chunk.length; + + chunk.slice(loc, cutoff); + + state.urlContent = ''; + state.url = false; + }; + + if (state.url) { + continue; + }; + + if (url) { + state.url = true; + cutoff = regex.lastIndex; + }; + + state.previous = match; + }; + + if (state.string) { + state.stringContent += chunk.slice(cutoff); + }; + + if (state.url) { + state.urlContent += chunk.slice(cutoff); + }; + + output.push( + chunk.slice(loc, cutoff) + ); + + return { output, state }; + }; +}; + +class URLEvent { + constructor(value, state = {}, options = {}, type = 'rewrite') { + this.value = value; + this.state = state; + this.options = options; + this.type = type; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CSS); + +/***/ }), +/* 28 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function (exports) { + 'use strict'; + + const TOKENS = { + attribute: /\[\s*(?:(? \*|[-\w]*)\|)?(? [-\w\u{0080}-\u{FFFF}]+)\s*(?:(? \W?=)\s*(? .+?)\s*(? [iIsS])?\s*)?\]/gu, + id: /#(? (?:[-\w\u{0080}-\u{FFFF}]|\\.)+)/gu, + class: /\.(? (?:[-\w\u{0080}-\u{FFFF}]|\\.)+)/gu, + comma: /\s*,\s*/g, // must be before combinator + combinator: /\s*[\s>+~]\s*/g, // this must be after attribute + "pseudo-element": /::(? [-\w\u{0080}-\u{FFFF}]+)(?:\((? ¶+)\))?/gu, // this must be before pseudo-class + "pseudo-class": /:(? [-\w\u{0080}-\u{FFFF}]+)(?:\((? ¶+)\))?/gu, + type: /(?:(? \*|[-\w]*)\|)?(? [-\w\u{0080}-\u{FFFF}]+)|\*/gu // this must be last + }; + + const TOKENS_WITH_PARENS = new Set(["pseudo-class", "pseudo-element"]); + const TOKENS_WITH_STRINGS = new Set([...TOKENS_WITH_PARENS, "attribute"]); + const TRIM_TOKENS = new Set(["combinator", "comma"]); + const RECURSIVE_PSEUDO_CLASSES = new Set(["not", "is", "where", "has", "matches", "-moz-any", "-webkit-any", "nth-child", "nth-last-child"]); + + const RECURSIVE_PSEUDO_CLASSES_ARGS = { + "nth-child": /(? [\dn+-]+)\s+of\s+(? .+)/ + }; + + RECURSIVE_PSEUDO_CLASSES["nth-last-child"] = RECURSIVE_PSEUDO_CLASSES_ARGS["nth-child"]; + + const TOKENS_FOR_RESTORE = Object.assign({}, TOKENS); + TOKENS_FOR_RESTORE["pseudo-element"] = RegExp(TOKENS["pseudo-element"].source.replace("(? ¶+)", "(? .+?)"), "gu"); + TOKENS_FOR_RESTORE["pseudo-class"] = RegExp(TOKENS["pseudo-class"].source.replace("(? ¶+)", "(? .+)"), "gu"); + + function gobbleParens(text, i) { + let str = "", stack = []; + + for (; i < text.length; i++) { + let char = text[i]; + + if (char === "(") { + stack.push(char); + } + else if (char === ")") { + if (stack.length > 0) { + stack.pop(); + } + else { + throw new Error("Closing paren without opening paren at " + i); + } + } + + str += char; + + if (stack.length === 0) { + return str; + } + } + + throw new Error("Opening paren without closing paren"); + } + + function tokenizeBy (text, grammar) { + if (!text) { + return []; + } + + var strarr = [text]; + + for (var token in grammar) { + let pattern = grammar[token]; + + for (var i=0; i < strarr.length; i++) { // Don’t cache length as it changes during the loop + var str = strarr[i]; + + if (typeof str === "string") { + pattern.lastIndex = 0; + + var match = pattern.exec(str); + + if (match) { + let from = match.index - 1; + let args = []; + let content = match[0]; + + let before = str.slice(0, from + 1); + if (before) { + args.push(before); + } + + args.push({ + type: token, + content, + ...match.groups + }); + + let after = str.slice(from + content.length + 1); + if (after) { + args.push(after); + } + + strarr.splice(i, 1, ...args); + } + + } + } + } + + let offset = 0; + for (let i=0; i { + strings.push({str, start}); + return quote + "§".repeat(content.length) + quote; + }); + + // Now that strings are out of the way, extract parens and replace them with parens with whitespace (to preserve offsets) + let parens = [], offset = 0, start; + while ((start = selector.indexOf("(", offset)) > -1) { + let str = gobbleParens(selector, start); + parens.push({str, start}); + selector = selector.substring(0, start) + "(" + "¶".repeat(str.length - 2) + ")" + selector.substring(start + str.length); + offset = start + str.length; + } + + // Now we have no nested structures and we can parse with regexes + let tokens = tokenizeBy(selector, TOKENS); + + // Now restore parens and strings in reverse order + function restoreNested(strings, regex, types) { + for (let str of strings) { + for (let token of tokens) { + if (types.has(token.type) && token.pos[0] < str.start && str.start < token.pos[1]) { + let content = token.content; + token.content = token.content.replace(regex, str.str); + + if (token.content !== content) { // actually changed? + // Re-evaluate groups + TOKENS_FOR_RESTORE[token.type].lastIndex = 0; + let match = TOKENS_FOR_RESTORE[token.type].exec(token.content); + let groups = match.groups; + Object.assign(token, groups); + } + } + } + } + } + + restoreNested(parens, /\(¶+\)/, TOKENS_WITH_PARENS); + restoreNested(strings, /(['"])§+?\1/, TOKENS_WITH_STRINGS); + + return tokens; + } + + // Convert a flat list of tokens into a tree of complex & compound selectors + function nestTokens(tokens, {list = true} = {}) { + if (list && tokens.find(t => t.type === "comma")) { + let selectors = [], temp = []; + + for (let i=0; i =0; i--) { + let token = tokens[i]; + + if (token.type === "combinator") { + let left = tokens.slice(0, i); + let right = tokens.slice(i + 1); + + return { + type: "complex", + combinator: token.content, + left: nestTokens(left), + right: nestTokens(right) + }; + } + } + + if (tokens.length === 0) { + return null; + } + + // If we're here, there are no combinators, so it's just a list + return tokens.length === 1? tokens[0] : { + type: "compound", + list: [...tokens] // clone to avoid pointers messing up the AST + }; + } + + // Traverse an AST (or part thereof), in depth-first order + function walk(node, callback, o, parent) { + if (!node) { + return; + } + + if (node.type === "complex") { + walk(node.left, callback, o, node); + walk(node.right, callback, o, node); + } + else if (node.type === "compound") { + for (let n of node.list) { + walk(n, callback, o, node); + } + } + else if (node.subtree && o && o.subtree) { + walk(node.subtree, callback, o, node); + } + + callback(node, parent); + } + + /** + * Parse a CSS selector + * @param selector {String} The selector to parse + * @param options.recursive {Boolean} Whether to parse the arguments of pseudo-classes like :is(), :has() etc. Defaults to true. + * @param options.list {Boolean} Whether this can be a selector list (A, B, C etc). Defaults to true. + */ + function parse(selector, {recursive = true, list = true} = {}) { + let tokens = tokenize(selector); + + if (!tokens) { + return null; + } + + let ast = nestTokens(tokens, {list}); + + if (recursive) { + walk(ast, node => { + if (node.type === "pseudo-class" && node.argument) { + if (RECURSIVE_PSEUDO_CLASSES.has(node.name)) { + let argument = node.argument; + const childArg = RECURSIVE_PSEUDO_CLASSES_ARGS[node.name]; + if (childArg) { + const match = childArg.exec(argument); + if (!match) { + return; + } + + Object.assign(node, match.groups); + argument = match.groups.subtree; + } + if (argument) { + node.subtree = parse(argument, {recursive: true, list: true}); + } + } + } + }); + } + + return ast; + } + + function specificityToNumber(specificity, base) { + base = base || Math.max(...specificity) + 1; + + return specificity[0] * base ** 2 + specificity[1] * base + specificity[2]; + } + + function maxIndexOf(arr) { + let max = arr[0], ret = 0; + + for (let i=0; i max) { + ret = i; + max = arr[i]; + } + } + + return arr.length === 0? -1 : ret; + } + + /** + * Calculate specificity of a selector. + * If the selector is a list, the max specificity is returned. + */ + function specificity(selector, {format = "array"} = {}) { + let ast = typeof selector === "object"? selector : parse(selector, {recursive: true}); + + if (!ast) { + return null; + } + + if (ast.type === "list") { + // Return max specificity + let base = 10; + let specificities = ast.list.map(s => { + let sp = specificity(s); + base = Math.max(base, ...sp); + return sp; + }); + let numbers = specificities.map(s => specificityToNumber(s, base)); + let i = maxIndexOf(numbers); + return specificities[i]; + } + + let ret = [0, 0, 0]; + + walk(ast, node => { + if (node.type === "id") { + ret[0]++; + } + else if (node.type === "class" || node.type === "attribute") { + ret[1]++; + } + else if ((node.type === "type" && node.content !== "*") || node.type === "pseudo-element") { + ret[2]++; + } + else if (node.type === "pseudo-class" && node.name !== "where") { + if (RECURSIVE_PSEUDO_CLASSES.has(node.name) && node.subtree) { + // Max of argument list + let sub = specificity(node.subtree); + sub.forEach((s, i) => ret[i] += s); + } + else { + ret[1]++; + } + } + }); + + return ret; + } + + exports.RECURSIVE_PSEUDO_CLASSES = RECURSIVE_PSEUDO_CLASSES; + exports.RECURSIVE_PSEUDO_CLASSES_ARGS = RECURSIVE_PSEUDO_CLASSES_ARGS; + exports.TOKENS = TOKENS; + exports.TRIM_TOKENS = TRIM_TOKENS; + exports.gobbleParens = gobbleParens; + exports.nestTokens = nestTokens; + exports.parse = parse; + exports.specificity = specificity; + exports.specificityToNumber = specificityToNumber; + exports.tokenize = tokenize; + exports.tokenizeBy = tokenizeBy; + exports.walk = walk; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +}({})); + +/***/ }), +/* 29 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ "NodeEvent": () => (/* binding */ NodeEvent) +/* harmony export */ }); +/* harmony import */ var meriyah__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30); +/* harmony import */ var esotope_hammerhead__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2); + +// import { parse } from 'acorn-hammerhead'; + + + +class JS extends _events_js__WEBPACK_IMPORTED_MODULE_2__["default"] { + constructor() { + super(); + /* + this.parseOptions = { + allowReturnOutsideFunction: true, + allowImportExportEverywhere: true, + ecmaVersion: 2021, + }; + */ + this.parseOptions = { + ranges: true, + module: true, + globalReturn: true, + }; + this.generationOptions = { + format: { + quotes: 'double', + escapeless: true, + compact: true, + }, + }; + this.parse = meriyah__WEBPACK_IMPORTED_MODULE_0__.parseScript /*parse*/; + this.generate = esotope_hammerhead__WEBPACK_IMPORTED_MODULE_1__.generate; + }; + rewrite(str, data = {}) { + return this.recast(str, data, 'rewrite'); + }; + source(str, data = {}) { + return this.recast(str, data, 'source'); + }; + recast(str, data = {}, type = '') { + try { + const output = []; + const ast = this.parse(str, this.parseOptions); + const meta = { + data, + changes: [], + str, + get slice() { + return slice; + }, + }; + let slice = 0; + + this.iterate(ast, (node, parent = null) => { + if (parent && parent.inTransformer) node.isTransformer = true; + node.parent = parent; + + this.emit(node.type, node, meta, type); + }); + + meta.changes.sort((a, b) => (a.start - b.start) || (a.end - b.end)); + + for (const change of meta.changes) { + output.push(str.slice(slice, change.start)); + if (change.node) output.push(typeof change.node === 'string' ? change.node : (0,esotope_hammerhead__WEBPACK_IMPORTED_MODULE_1__.generate)(change.node, this.generationOptions)); + slice = change.end; + }; + output.push(str.slice(slice)); + return output.join(''); + } catch(e) { + return str; + }; + }; + iterate(ast, handler) { + if (typeof ast != 'object' || !handler) return; + walk(ast, null, handler); + function walk(node, parent, handler) { + if (typeof node != 'object' || !handler) return; + handler(node, parent, handler); + for (const child in node) { + if (child === 'parent') continue; + if (Array.isArray(node[child])) { + node[child].forEach(entry => { + if (entry) walk(entry, node, handler) + }); + } else { + if (node[child]) walk(node[child], node, handler); + }; + }; + if (typeof node.iterateEnd === 'function') node.iterateEnd(); + }; + }; +}; + +class NodeEvent extends _events_js__WEBPACK_IMPORTED_MODULE_2__["default"] { + constructor(node, parent = null) { + super(); + this._node = node; + for (let key in node) { + Object.defineProperty(this, key, { + get: () => node[key], + sel: val => node[key] = val, + }); + }; + this.parent = parent; + }; + iterate(handler) { + for (const key in this._node) { + if (key === 'parent') continue; + if (Array.isArray(this._node[key])) { + this._node[key].forEach(entry => { + const child = new this.constructor(entry, this._node); + handler(child); + }); + } else { + const child = new this.constructor(entry, this._node); + walk(this._node[key], this._node, handler); + }; + }; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JS); + + +/***/ }), +/* 30 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ESTree": () => (/* binding */ estree), +/* harmony export */ "parse": () => (/* binding */ parse), +/* harmony export */ "parseModule": () => (/* binding */ parseModule), +/* harmony export */ "parseScript": () => (/* binding */ parseScript), +/* harmony export */ "version": () => (/* binding */ version) +/* harmony export */ }); +const errorMessages = { + [0]: 'Unexpected token', + [28]: "Unexpected token: '%0'", + [1]: 'Octal escape sequences are not allowed in strict mode', + [2]: 'Octal escape sequences are not allowed in template strings', + [3]: 'Unexpected token `#`', + [4]: 'Illegal Unicode escape sequence', + [5]: 'Invalid code point %0', + [6]: 'Invalid hexadecimal escape sequence', + [8]: 'Octal literals are not allowed in strict mode', + [7]: 'Decimal integer literals with a leading zero are forbidden in strict mode', + [9]: 'Expected number in radix %0', + [145]: 'Invalid left-hand side assignment to a destructible right-hand side', + [10]: 'Non-number found after exponent indicator', + [11]: 'Invalid BigIntLiteral', + [12]: 'No identifiers allowed directly after numeric literal', + [13]: 'Escapes \\8 or \\9 are not syntactically valid escapes', + [14]: 'Unterminated string literal', + [15]: 'Unterminated template literal', + [16]: 'Multiline comment was not closed properly', + [17]: 'The identifier contained dynamic unicode escape that was not closed', + [18]: "Illegal character '%0'", + [19]: 'Missing hexadecimal digits', + [20]: 'Invalid implicit octal', + [21]: 'Invalid line break in string literal', + [22]: 'Only unicode escapes are legal in identifier names', + [23]: "Expected '%0'", + [24]: 'Invalid left-hand side in assignment', + [25]: 'Invalid left-hand side in async arrow', + [26]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass', + [27]: 'Member access on super must be in a method', + [29]: 'Await expression not allowed in formal parameter', + [30]: 'Yield expression not allowed in formal parameter', + [92]: "Unexpected token: 'escaped keyword'", + [31]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses', + [119]: 'Async functions can only be declared at the top level or inside a block', + [32]: 'Unterminated regular expression', + [33]: 'Unexpected regular expression flag', + [34]: "Duplicate regular expression flag '%0'", + [35]: '%0 functions must have exactly %1 argument%2', + [36]: 'Setter function argument must not be a rest parameter', + [37]: '%0 declaration must have a name in this context', + [38]: 'Function name may not contain any reserved words or be eval or arguments in strict mode', + [39]: 'The rest operator is missing an argument', + [40]: 'A getter cannot be a generator', + [41]: 'A computed property name must be followed by a colon or paren', + [130]: 'Object literal keys that are strings or numbers must be a method or have a colon', + [43]: 'Found `* async x(){}` but this should be `async * x(){}`', + [42]: 'Getters and setters can not be generators', + [44]: "'%0' can not be generator method", + [45]: "No line break is allowed after '=>'", + [46]: 'The left-hand side of the arrow can only be destructed through assignment', + [47]: 'The binding declaration is not destructible', + [48]: 'Async arrow can not be followed by new expression', + [49]: "Classes may not have a static property named 'prototype'", + [50]: 'Class constructor may not be a %0', + [51]: 'Duplicate constructor method in class', + [52]: 'Invalid increment/decrement operand', + [53]: 'Invalid use of `new` keyword on an increment/decrement expression', + [54]: '`=>` is an invalid assignment target', + [55]: 'Rest element may not have a trailing comma', + [56]: 'Missing initializer in %0 declaration', + [57]: "'for-%0' loop head declarations can not have an initializer", + [58]: 'Invalid left-hand side in for-%0 loop: Must have a single binding', + [59]: 'Invalid shorthand property initializer', + [60]: 'Property name __proto__ appears more than once in object literal', + [61]: 'Let is disallowed as a lexically bound name', + [62]: "Invalid use of '%0' inside new expression", + [63]: "Illegal 'use strict' directive in function with non-simple parameter list", + [64]: 'Identifier "let" disallowed as left-hand side expression in strict mode', + [65]: 'Illegal continue statement', + [66]: 'Illegal break statement', + [67]: 'Cannot have `let[...]` as a var name in strict mode', + [68]: 'Invalid destructuring assignment target', + [69]: 'Rest parameter may not have a default initializer', + [70]: 'The rest argument must the be last parameter', + [71]: 'Invalid rest argument', + [73]: 'In strict mode code, functions can only be declared at top level or inside a block', + [74]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement', + [75]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement', + [76]: "Class declaration can't appear in single-statement context", + [77]: 'Invalid left-hand side in for-%0', + [78]: 'Invalid assignment in for-%0', + [79]: 'for await (... of ...) is only valid in async functions and async generators', + [80]: 'The first token after the template expression should be a continuation of the template', + [82]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode', + [81]: '`let \n [` is a restricted production at the start of a statement', + [83]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)', + [84]: 'Catch clause parameter does not support default values', + [85]: 'Missing catch or finally after try', + [86]: 'More than one default clause in switch statement', + [87]: 'Illegal newline after throw', + [88]: 'Strict mode code may not include a with statement', + [89]: 'Illegal return statement', + [90]: 'The left hand side of the for-header binding declaration is not destructible', + [91]: 'new.target only allowed within functions', + [93]: "'#' not followed by identifier", + [99]: 'Invalid keyword', + [98]: "Can not use 'let' as a class name", + [97]: "'A lexical declaration can't define a 'let' binding", + [96]: 'Can not use `let` as variable name in strict mode', + [94]: "'%0' may not be used as an identifier in this context", + [95]: 'Await is only valid in async functions', + [100]: 'The %0 keyword can only be used with the module goal', + [101]: 'Unicode codepoint must not be greater than 0x10FFFF', + [102]: '%0 source must be string', + [103]: 'Only a identifier can be used to indicate alias', + [104]: "Only '*' or '{...}' can be imported after default", + [105]: 'Trailing decorator may be followed by method', + [106]: "Decorators can't be used with a constructor", + [108]: 'HTML comments are only allowed with web compatibility (Annex B)', + [109]: "The identifier 'let' must not be in expression position in strict mode", + [110]: 'Cannot assign to `eval` and `arguments` in strict mode', + [111]: "The left-hand side of a for-of loop may not start with 'let'", + [112]: 'Block body arrows can not be immediately invoked without a group', + [113]: 'Block body arrows can not be immediately accessed without a group', + [114]: 'Unexpected strict mode reserved word', + [115]: 'Unexpected eval or arguments in strict mode', + [116]: 'Decorators must not be followed by a semicolon', + [117]: 'Calling delete on expression not allowed in strict mode', + [118]: 'Pattern can not have a tail', + [120]: 'Can not have a `yield` expression on the left side of a ternary', + [121]: 'An arrow function can not have a postfix update operator', + [122]: 'Invalid object literal key character after generator star', + [123]: 'Private fields can not be deleted', + [125]: 'Classes may not have a field called constructor', + [124]: 'Classes may not have a private element named constructor', + [126]: 'A class field initializer may not contain arguments', + [127]: 'Generators can only be declared at the top level or inside a block', + [128]: 'Async methods are a restricted production and cannot have a newline following it', + [129]: 'Unexpected character after object literal property name', + [131]: 'Invalid key token', + [132]: "Label '%0' has already been declared", + [133]: 'continue statement must be nested within an iteration statement', + [134]: "Undefined label '%0'", + [135]: 'Trailing comma is disallowed inside import(...) arguments', + [136]: 'import() requires exactly one argument', + [137]: 'Cannot use new with import(...)', + [138]: '... is not allowed in import()', + [139]: "Expected '=>'", + [140]: "Duplicate binding '%0'", + [141]: "Cannot export a duplicate name '%0'", + [144]: 'Duplicate %0 for-binding', + [142]: "Exported binding '%0' needs to refer to a top-level declared variable", + [143]: 'Unexpected private field', + [147]: 'Numeric separators are not allowed at the end of numeric literals', + [146]: 'Only one underscore is allowed as numeric separator', + [148]: 'JSX value should be either an expression or a quoted JSX text', + [149]: 'Expected corresponding JSX closing tag for %0', + [150]: 'Adjacent JSX elements must be wrapped in an enclosing tag', + [151]: "JSX attributes must only be assigned a non-empty 'expression'", + [152]: "'%0' has already been declared", + [153]: "'%0' shadowed a catch clause binding", + [154]: 'Dot property must be an identifier', + [155]: 'Encountered invalid input after spread/rest argument', + [156]: 'Catch without try', + [157]: 'Finally without try', + [158]: 'Expected corresponding closing tag for JSX fragment', + [159]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses', + [160]: 'Invalid tagged template on optional chain', + [161]: 'Invalid optional chain from super property', + [162]: 'Invalid optional chain from new expression', + [163]: 'Cannot use "import.meta" outside a module', + [164]: 'Leading decorators must be attached to a class declaration' +}; +class ParseError extends SyntaxError { + constructor(startindex, line, column, type, ...params) { + const message = '[' + line + ':' + column + ']: ' + errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]); + super(`${message}`); + this.index = startindex; + this.line = line; + this.column = column; + this.description = message; + this.loc = { + line, + column + }; + } +} +function report(parser, type, ...params) { + throw new ParseError(parser.index, parser.line, parser.column, type, ...params); +} +function reportScopeError(scope) { + throw new ParseError(scope.index, scope.line, scope.column, scope.type, scope.params); +} +function reportMessageAt(index, line, column, type, ...params) { + throw new ParseError(index, line, column, type, ...params); +} +function reportScannerError(index, line, column, type) { + throw new ParseError(index, line, column, type); +} + +const unicodeLookup = ((compressed, lookup) => { + const result = new Uint32Array(104448); + let index = 0; + let subIndex = 0; + while (index < 3540) { + const inst = compressed[index++]; + if (inst < 0) { + subIndex -= inst; + } + else { + let code = compressed[index++]; + if (inst & 2) + code = lookup[code]; + if (inst & 1) { + result.fill(code, subIndex, subIndex += compressed[index++]); + } + else { + result[subIndex++] = code; + } + } + } + return result; +})([-1, 2, 24, 2, 25, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 131, 2, 6, 2, 56, -1, 2, 37, 0, 4294443263, 2, 1, 3, 0, 3, 0, 4294901711, 2, 39, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 194, 2, 3, 0, 3825204735, 0, 123747807, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 66, 0, 4284449919, 0, 851904, 2, 4, 2, 11, 0, 67076095, -1, 2, 67, 0, 1073741743, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 32, 0, 4294844415, 0, 4278190047, 2, 18, 2, 129, -1, 3, 0, 2, 2, 21, 2, 0, 2, 9, 2, 0, 2, 14, 2, 15, 3, 0, 10, 2, 69, 2, 0, 2, 70, 2, 71, 2, 72, 2, 0, 2, 73, 2, 0, 2, 10, 0, 261632, 2, 23, 3, 0, 2, 2, 12, 2, 4, 3, 0, 18, 2, 74, 2, 5, 3, 0, 2, 2, 75, 0, 2088959, 2, 27, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 41, 0, 67057664, 3, 0, 2, 2, 40, 2, 0, 2, 28, 2, 0, 2, 29, 2, 7, 0, 268374015, 2, 26, 2, 49, 2, 0, 2, 76, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 3221160064, 0, 1, -1, 3, 0, 2, 2, 42, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 51, 0, 4294960127, 2, 9, 2, 38, 2, 10, 0, 4294377472, 2, 11, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 12, 2, 0, 2, 78, 2, 9, 2, 0, 2, 79, 2, 80, 2, 81, -1, 2, 124, 0, 1048577, 2, 82, 2, 13, -1, 2, 13, 0, 131042, 2, 83, 2, 84, 2, 85, 2, 0, 2, 33, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 14, 2, 0, 0, 2147516671, 2, 20, 3, 86, 2, 2, 0, -16, 2, 87, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 15, 2, 77, 2, 16, 3, 0, 2, 2, 47, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 655, 2, 18, 3, 0, 36, 2, 68, -1, 2, 17, 2, 9, 3, 0, 8, 2, 89, 2, 121, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 90, 2, 91, 3, 0, 2, 2, 92, 2, 0, 2, 93, 2, 94, 2, 0, 0, 4351, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 22, 2, 8, 2, 18, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 20, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 15, 2, 21, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 22, 3, 0, 2, 2, 31, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 19, 2, 103, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 45, 2, 0, 2, 30, 2, 104, 2, 23, 0, 1638399, 2, 172, 2, 105, 3, 0, 3, 2, 18, 2, 24, 2, 25, 2, 5, 2, 26, 2, 0, 2, 7, 2, 106, -1, 2, 107, 2, 108, 2, 109, -1, 3, 0, 3, 2, 11, -2, 2, 0, 2, 27, -3, 2, 150, -4, 2, 18, 2, 0, 2, 35, 0, 1, 2, 0, 2, 62, 2, 28, 2, 11, 2, 9, 2, 0, 2, 110, -1, 3, 0, 4, 2, 9, 2, 21, 2, 111, 2, 6, 2, 0, 2, 112, 2, 0, 2, 48, -4, 3, 0, 9, 2, 20, 2, 29, 2, 30, -4, 2, 113, 2, 114, 2, 29, 2, 20, 2, 7, -2, 2, 115, 2, 29, 2, 31, -2, 2, 0, 2, 116, -2, 0, 4277137519, 0, 2269118463, -1, 3, 18, 2, -1, 2, 32, 2, 36, 2, 0, 3, 29, 2, 2, 34, 2, 19, -3, 3, 0, 2, 2, 33, -1, 2, 0, 2, 34, 2, 0, 2, 34, 2, 0, 2, 46, -10, 2, 0, 0, 203775, -2, 2, 18, 2, 43, 2, 35, -2, 2, 17, 2, 117, 2, 20, 3, 0, 2, 2, 36, 0, 2147549120, 2, 0, 2, 11, 2, 17, 2, 135, 2, 0, 2, 37, 2, 52, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 120, 0, 1090519039, -2, 2, 122, 2, 38, 2, 0, 0, 67045375, 2, 39, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 40, 2, 41, -1, 2, 10, 2, 42, -6, 2, 0, 2, 11, -3, 3, 0, 2, 0, 2147484671, 2, 125, 0, 4190109695, 2, 50, -2, 2, 126, 0, 4244635647, 0, 27, 2, 0, 2, 7, 2, 43, 2, 0, 2, 63, -1, 2, 0, 2, 40, -8, 2, 54, 2, 44, 0, 67043329, 2, 127, 2, 45, 0, 8388351, -2, 2, 128, 0, 3028287487, 2, 46, 2, 130, 0, 33259519, 2, 41, -9, 2, 20, -5, 2, 64, -2, 3, 0, 28, 2, 31, -3, 3, 0, 3, 2, 47, 3, 0, 6, 2, 48, -85, 3, 0, 33, 2, 47, -126, 3, 0, 18, 2, 36, -269, 3, 0, 17, 2, 40, 2, 7, 2, 41, -2, 2, 17, 2, 49, 2, 0, 2, 20, 2, 50, 2, 132, 2, 23, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 196635, 3, 0, 191, 2, 51, 3, 0, 38, 2, 29, -1, 2, 33, -279, 3, 0, 8, 2, 7, -1, 2, 133, 2, 52, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 134, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 37, 2, 0, 2, 136, 2, 137, 2, 55, 2, 0, 2, 138, 2, 139, 2, 140, 3, 0, 10, 2, 141, 2, 142, 2, 15, 3, 37, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 88, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -6, 2, 0, 0, 1073684479, 0, 17407, -11, 2, 0, 2, 31, -40, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 42, -37, 2, 55, 2, 144, 2, 145, 2, 146, 2, 147, 2, 148, -105, 2, 24, -32, 3, 0, 1334, 2, 9, -1, 3, 0, 129, 2, 27, 3, 0, 6, 2, 9, 3, 0, 180, 2, 149, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 56, -22381, 3, 0, 7, 2, 23, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 60, 2, 0, 2, 33, -1, 2, 17, 2, 61, -1, 2, 0, 2, 56, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 23, 2, 62, 3, 0, 2, 0, 131135, 2, 95, 0, 70256639, 0, 71303167, 0, 272, 2, 40, 2, 56, -1, 2, 37, 2, 30, -1, 2, 96, 2, 63, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 64, 0, 33554435, 2, 123, 2, 65, 2, 151, 0, 131075, 0, 3594373096, 0, 67094296, 2, 64, -1, 0, 4294828000, 0, 603979263, 2, 160, 0, 3, 0, 4294828001, 0, 602930687, 2, 183, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 66, 2, 36, -1, 2, 4, 0, 917503, 2, 36, -1, 2, 67, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 32, 2, 68, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 14, 2, 15, 3, 0, 10, 2, 69, 2, 0, 2, 70, 2, 71, 2, 72, 2, 0, 2, 73, 2, 0, 2, 11, -1, 2, 23, 3, 0, 2, 2, 12, 2, 4, 3, 0, 18, 2, 74, 2, 5, 3, 0, 2, 2, 75, 0, 253951, 3, 19, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 40, 2, 0, 0, 4294903295, 2, 0, 2, 29, 2, 7, -1, 2, 17, 2, 49, 2, 0, 2, 76, 2, 41, -1, 2, 20, 2, 0, 2, 27, -2, 0, 128, -2, 2, 77, 2, 8, 0, 4064, -1, 2, 119, 0, 4227907585, 2, 0, 2, 118, 2, 0, 2, 48, 2, 173, 2, 9, 2, 38, 2, 10, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 12, 2, 0, 2, 78, 2, 9, 2, 0, 2, 79, 2, 80, 2, 81, -3, 2, 82, 2, 13, -3, 2, 83, 2, 84, 2, 85, 2, 0, 2, 33, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 14, 2, 0, 0, 33023, 2, 20, 3, 86, 2, -17, 2, 87, 0, 524157950, 2, 4, 2, 0, 2, 88, 2, 4, 2, 0, 2, 15, 2, 77, 2, 16, 3, 0, 2, 2, 47, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 655, 2, 18, 3, 0, 36, 2, 68, -1, 2, 17, 2, 9, 3, 0, 8, 2, 89, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 23, 2, 90, 2, 91, 3, 0, 2, 2, 92, 2, 0, 2, 93, 2, 94, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 91, 2, 8, -1, 0, 1761345536, 2, 95, 0, 4294901823, 2, 36, 2, 18, 2, 96, 2, 34, 2, 166, 0, 2080440287, 2, 0, 2, 33, 2, 143, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 15, 2, 21, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 22, 3, 0, 2, 2, 31, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 19, 2, 103, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 45, 2, 0, 2, 30, 2, 104, -3, 2, 105, 3, 0, 3, 2, 18, -1, 3, 5, 2, 2, 26, 2, 0, 2, 7, 2, 106, -1, 2, 107, 2, 108, 2, 109, -1, 3, 0, 3, 2, 11, -2, 2, 0, 2, 27, -8, 2, 18, 2, 0, 2, 35, -1, 2, 0, 2, 62, 2, 28, 2, 29, 2, 9, 2, 0, 2, 110, -1, 3, 0, 4, 2, 9, 2, 17, 2, 111, 2, 6, 2, 0, 2, 112, 2, 0, 2, 48, -4, 3, 0, 9, 2, 20, 2, 29, 2, 30, -4, 2, 113, 2, 114, 2, 29, 2, 20, 2, 7, -2, 2, 115, 2, 29, 2, 31, -2, 2, 0, 2, 116, -2, 0, 4277075969, 2, 29, -1, 3, 18, 2, -1, 2, 32, 2, 117, 2, 0, 3, 29, 2, 2, 34, 2, 19, -3, 3, 0, 2, 2, 33, -1, 2, 0, 2, 34, 2, 0, 2, 34, 2, 0, 2, 48, -10, 2, 0, 0, 197631, -2, 2, 18, 2, 43, 2, 118, -2, 2, 17, 2, 117, 2, 20, 2, 119, 2, 51, -2, 2, 119, 2, 23, 2, 17, 2, 33, 2, 119, 2, 36, 0, 4294901904, 0, 4718591, 2, 119, 2, 34, 0, 335544350, -1, 2, 120, 2, 121, -2, 2, 122, 2, 38, 2, 7, -1, 2, 123, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 27, 0, 2147485568, 0, 3, 2, 0, 2, 23, 0, 176, -5, 2, 0, 2, 47, 2, 186, -1, 2, 0, 2, 23, 2, 197, -1, 2, 0, 0, 16779263, -2, 2, 11, -7, 2, 0, 2, 121, -3, 3, 0, 2, 2, 124, 2, 125, 0, 2147549183, 0, 2, -2, 2, 126, 2, 35, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, -1, 2, 0, 2, 40, -8, 2, 54, 2, 47, 0, 1, 2, 127, 2, 23, -3, 2, 128, 2, 35, 2, 129, 2, 130, 0, 16778239, -10, 2, 34, -5, 2, 64, -2, 3, 0, 28, 2, 31, -3, 3, 0, 3, 2, 47, 3, 0, 6, 2, 48, -85, 3, 0, 33, 2, 47, -126, 3, 0, 18, 2, 36, -269, 3, 0, 17, 2, 40, 2, 7, -3, 2, 17, 2, 131, 2, 0, 2, 23, 2, 48, 2, 132, 2, 23, -21, 3, 0, 2, -4, 3, 0, 2, 0, 67583, -1, 2, 103, -2, 0, 11, 3, 0, 191, 2, 51, 3, 0, 38, 2, 29, -1, 2, 33, -279, 3, 0, 8, 2, 7, -1, 2, 133, 2, 52, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 134, 2, 135, -187, 3, 0, 2, 2, 37, 2, 0, 2, 136, 2, 137, 2, 55, 2, 0, 2, 138, 2, 139, 2, 140, 3, 0, 10, 2, 141, 2, 142, 2, 15, 3, 37, 2, 3, 53, 2, 3, 54, 2, 2, 143, -73, 2, 0, 0, 1065361407, 0, 16384, -11, 2, 0, 2, 121, -40, 3, 0, 6, 2, 117, -1, 3, 0, 2, 0, 2063, -37, 2, 55, 2, 144, 2, 145, 2, 146, 2, 147, 2, 148, -138, 3, 0, 1334, 2, 9, -1, 3, 0, 129, 2, 27, 3, 0, 6, 2, 9, 3, 0, 180, 2, 149, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 56, -28517, 2, 0, 0, 1, -1, 2, 124, 2, 0, 0, 8193, -21, 2, 193, 0, 10255, 0, 4, -11, 2, 64, 2, 171, -1, 0, 71680, -1, 2, 161, 0, 4292900864, 0, 805306431, -5, 2, 150, -1, 2, 157, -1, 0, 6144, -2, 2, 127, -1, 2, 154, -1, 0, 2147532800, 2, 151, 2, 165, 2, 0, 2, 164, 0, 524032, 0, 4, -4, 2, 190, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 152, 0, 4294886464, 0, 33292336, 0, 417809, 2, 152, 0, 1327482464, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 153, 0, 469762560, 0, 4171219488, 0, 8323120, 2, 153, 0, 202375680, 0, 3214918176, 0, 4294508592, 2, 153, -1, 0, 983584, 0, 48, 0, 58720273, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 177, 2, 0, 0, 2089, 0, 3221225552, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 150, 0, 4160757760, 2, 0, -6, 2, 167, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 154, 2, 159, 2, 178, -2, 2, 162, -20, 0, 3758096385, -2, 2, 155, 0, 4292878336, 2, 90, 2, 169, 0, 4294057984, -2, 2, 163, 2, 156, 2, 175, -2, 2, 155, -1, 2, 182, -1, 2, 170, 2, 124, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 158, 0, 939588608, -1, 0, 805306368, -1, 2, 124, 0, 1610612736, 2, 156, 2, 157, 2, 4, 2, 0, -2, 2, 158, 2, 159, -3, 0, 267386880, -1, 2, 160, 0, 7168, -1, 0, 65024, 2, 154, 2, 161, 2, 179, -7, 2, 168, -8, 2, 162, -1, 0, 1426112704, 2, 163, -1, 2, 164, 0, 271581216, 0, 2149777408, 2, 23, 2, 161, 2, 124, 0, 851967, 2, 180, -1, 2, 23, 2, 181, -4, 2, 158, -20, 2, 195, 2, 165, -56, 0, 3145728, 2, 185, -4, 2, 166, 2, 124, -4, 0, 32505856, -1, 2, 167, -1, 0, 2147385088, 2, 90, 1, 2155905152, 2, -3, 2, 103, 2, 0, 2, 168, -2, 2, 169, -6, 2, 170, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 171, -3, 2, 117, 2, 64, -2, 2, 166, -2, 2, 176, 2, 124, -878, 2, 159, -36, 2, 172, -1, 2, 201, -10, 2, 188, -5, 2, 174, -6, 0, 4294965251, 2, 27, -1, 2, 173, -1, 2, 174, -2, 0, 4227874752, -3, 0, 2146435072, 2, 159, -2, 0, 1006649344, 2, 124, -1, 2, 90, 0, 201375744, -3, 0, 134217720, 2, 90, 0, 4286677377, 0, 32896, -1, 2, 158, -3, 2, 175, -349, 2, 176, 0, 1920, 2, 177, 3, 0, 264, -11, 2, 157, -2, 2, 178, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 23, -1, 2, 187, -1, 2, 184, 0, 3221291007, 2, 178, -1, 2, 202, 0, 2158720, -3, 2, 159, 0, 1, -4, 2, 124, 0, 3808625411, 0, 3489628288, 2, 200, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 179, 0, 120, 0, 7340032, -2, 2, 180, 2, 4, 2, 23, 2, 163, 3, 0, 4, 2, 159, -1, 2, 181, 2, 177, -1, 0, 8176, 2, 182, 2, 179, 2, 183, -1, 0, 4290773232, 2, 0, -4, 2, 163, 2, 189, 0, 15728640, 2, 177, -1, 2, 161, -1, 0, 4294934512, 3, 0, 4, -9, 2, 90, 2, 170, 2, 184, 3, 0, 4, 0, 704, 0, 1849688064, 2, 185, -1, 2, 124, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 2, 199, 3, 0, 2, -1, 2, 186, 2, 187, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 192, 0, 16252928, 0, 3791388672, 2, 38, 3, 0, 2, -2, 2, 196, 2, 0, -1, 2, 103, -1, 0, 66584576, -1, 2, 191, 3, 0, 9, 2, 124, -1, 0, 4294755328, 3, 0, 2, -1, 2, 161, 2, 178, 3, 0, 2, 2, 23, 2, 188, 2, 90, -2, 0, 245760, 0, 2147418112, -1, 2, 150, 2, 203, 0, 4227923456, -1, 2, 164, 2, 161, 2, 90, -3, 0, 4292870145, 0, 262144, 2, 124, 3, 0, 2, 0, 1073758848, 2, 189, -1, 0, 4227921920, 2, 190, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 268435456, 2, 91, -2, 2, 191, 3, 0, 5, -1, 2, 192, 2, 163, 2, 0, -2, 0, 4227923936, 2, 62, -1, 2, 155, 2, 95, 2, 0, 2, 154, 2, 158, 3, 0, 6, -1, 2, 177, 3, 0, 3, -2, 0, 2146959360, 0, 9440640, 0, 104857600, 0, 4227923840, 3, 0, 2, 0, 768, 2, 193, 2, 77, -2, 2, 161, -2, 2, 119, -1, 2, 155, 3, 0, 8, 0, 512, 0, 8388608, 2, 194, 2, 172, 2, 187, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 191, 0, 576, 0, 4261707776, 2, 95, 3, 0, 9, 2, 155, 3, 0, 5, 2, 16, -1, 0, 2147221504, -28, 2, 178, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 0, 4294934528, 3, 0, 126, -18, 2, 195, 3, 0, 269, -17, 2, 155, 2, 124, 2, 198, 3, 0, 2, 2, 23, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 179, 3, 0, 3, -2, 0, 30720, -1, 0, 32512, 3, 0, 2, 0, 4294770656, -191, 2, 174, -38, 2, 170, 2, 0, 2, 196, 3, 0, 279, -8, 2, 124, 2, 0, 0, 4294508543, 0, 65295, -11, 2, 177, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 170, -1, 0, 384, -1, 0, 133693440, -3, 2, 196, -2, 2, 26, 3, 0, 4, 2, 169, -2, 2, 90, 2, 155, 3, 0, 4, -2, 2, 164, -1, 2, 150, 0, 335552923, 2, 197, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 6, -1, 0, 3221282816, 2, 198, 3, 0, 11, -1, 2, 199, 3, 0, 40, -6, 0, 4286578784, 2, 0, -2, 0, 1006694400, 3, 0, 24, 2, 35, -1, 2, 94, 3, 0, 2, 0, 1, 2, 163, 3, 0, 6, 2, 197, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 45, 3, 0, 8, -1, 2, 158, -2, 2, 169, 0, 98304, 0, 65537, 2, 170, -5, 0, 4294950912, 2, 0, 2, 118, 0, 65528, 2, 177, 0, 4294770176, 2, 26, 3, 0, 4, -30, 2, 174, 0, 3758153728, -3, 2, 169, -2, 2, 155, 2, 188, 2, 158, -1, 2, 191, -1, 2, 161, 0, 4294754304, 3, 0, 2, -3, 0, 33554432, -2, 2, 200, -3, 2, 169, 0, 4175478784, 2, 201, 0, 4286643712, 0, 4286644216, 2, 0, -4, 2, 202, -1, 2, 165, 0, 4227923967, 3, 0, 32, -1334, 2, 163, 2, 0, -129, 2, 94, -6, 2, 163, -180, 2, 203, -233, 2, 4, 3, 0, 96, -16, 2, 163, 3, 0, 47, -154, 2, 165, 3, 0, 22381, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 4294901760, 536870911, 262143, 8388607, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 127, 4292870143, 4294902271, 4294549487, 33554431, 1023, 67047423, 4294901888, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 67043343, 16777215, 4294902000, 4294934527, 4294966783, 4294967279, 2047, 262083, 20511, 4290772991, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 2044, 4292870144, 4294966272, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 31, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4285526655, 4294966527, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 458752, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 49152, 61440, 3758096384, 117440512, 65280, 3233808384, 3221225472, 2097152, 4294965248, 32768, 57152, 67108864, 4293918720, 4290772992, 25165824, 57344, 4227915776, 4278190080, 4227907584, 65520, 4026531840, 4227858432, 4160749568, 3758129152, 4294836224, 63488, 1073741824, 4294967040, 4194304, 251658240, 196608, 4294963200, 64512, 417808, 4227923712, 12582912, 50331648, 65472, 4294967168, 4294966784, 16, 4294917120, 2080374784, 4096, 65408, 524288, 65532]); + +function advanceChar(parser) { + parser.column++; + return (parser.currentChar = parser.source.charCodeAt(++parser.index)); +} +function consumeMultiUnitCodePoint(parser, hi) { + if ((hi & 0xfc00) !== 55296) + return 0; + const lo = parser.source.charCodeAt(parser.index + 1); + if ((lo & 0xfc00) !== 0xdc00) + return 0; + hi = parser.currentChar = 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff); + if (((unicodeLookup[(hi >>> 5) + 0] >>> hi) & 31 & 1) === 0) { + report(parser, 18, fromCodePoint(hi)); + } + parser.index++; + parser.column++; + return 1; +} +function consumeLineFeed(parser, state) { + parser.currentChar = parser.source.charCodeAt(++parser.index); + parser.flags |= 1; + if ((state & 4) === 0) { + parser.column = 0; + parser.line++; + } +} +function scanNewLine(parser) { + parser.flags |= 1; + parser.currentChar = parser.source.charCodeAt(++parser.index); + parser.column = 0; + parser.line++; +} +function isExoticECMAScriptWhitespace(ch) { + return (ch === 160 || + ch === 65279 || + ch === 133 || + ch === 5760 || + (ch >= 8192 && ch <= 8203) || + ch === 8239 || + ch === 8287 || + ch === 12288 || + ch === 8201 || + ch === 65519); +} +function fromCodePoint(codePoint) { + return codePoint <= 65535 + ? String.fromCharCode(codePoint) + : String.fromCharCode(codePoint >>> 10) + String.fromCharCode(codePoint & 0x3ff); +} +function toHex(code) { + return code < 65 ? code - 48 : (code - 65 + 10) & 0xf; +} +function convertTokenType(t) { + switch (t) { + case 134283266: + return 'NumericLiteral'; + case 134283267: + return 'StringLiteral'; + case 86021: + case 86022: + return 'BooleanLiteral'; + case 86023: + return 'NullLiteral'; + case 65540: + return 'RegularExpression'; + case 67174408: + case 67174409: + case 132: + return 'TemplateLiteral'; + default: + if ((t & 143360) === 143360) + return 'Identifier'; + if ((t & 4096) === 4096) + return 'Keyword'; + return 'Punctuator'; + } +} + +const CharTypes = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8 | 1024, + 0, + 0, + 8 | 2048, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 8192, + 0, + 1 | 2, + 0, + 0, + 8192, + 0, + 0, + 0, + 256, + 0, + 256 | 32768, + 0, + 0, + 2 | 16 | 128 | 32 | 64, + 2 | 16 | 128 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 32 | 64, + 2 | 16 | 512 | 64, + 2 | 16 | 512 | 64, + 0, + 0, + 16384, + 0, + 0, + 0, + 0, + 1 | 2 | 64, + 1 | 2 | 64, + 1 | 2 | 64, + 1 | 2 | 64, + 1 | 2 | 64, + 1 | 2 | 64, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 1 | 2, + 0, + 1, + 0, + 0, + 1 | 2 | 4096, + 0, + 1 | 2 | 4 | 64, + 1 | 2 | 4 | 64, + 1 | 2 | 4 | 64, + 1 | 2 | 4 | 64, + 1 | 2 | 4 | 64, + 1 | 2 | 4 | 64, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 1 | 2 | 4, + 16384, + 0, + 0, + 0, + 0 +]; +const isIdStart = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0 +]; +const isIdPart = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0 +]; +function isIdentifierStart(code) { + return code <= 0x7F + ? isIdStart[code] + : (unicodeLookup[(code >>> 5) + 34816] >>> code) & 31 & 1; +} +function isIdentifierPart(code) { + return code <= 0x7F + ? isIdPart[code] + : (unicodeLookup[(code >>> 5) + 0] >>> code) & 31 & 1 || (code === 8204 || code === 8205); +} + +const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment']; +function skipHashBang(parser) { + const source = parser.source; + if (parser.currentChar === 35 && source.charCodeAt(parser.index + 1) === 33) { + advanceChar(parser); + advanceChar(parser); + skipSingleLineComment(parser, source, 0, 4, parser.tokenPos, parser.linePos, parser.colPos); + } +} +function skipSingleHTMLComment(parser, source, state, context, type, start, line, column) { + if (context & 2048) + report(parser, 0); + return skipSingleLineComment(parser, source, state, type, start, line, column); +} +function skipSingleLineComment(parser, source, state, type, start, line, column) { + const { index } = parser; + parser.tokenPos = parser.index; + parser.linePos = parser.line; + parser.colPos = parser.column; + while (parser.index < parser.end) { + if (CharTypes[parser.currentChar] & 8) { + const isCR = parser.currentChar === 13; + scanNewLine(parser); + if (isCR && parser.index < parser.end && parser.currentChar === 10) + parser.currentChar = source.charCodeAt(++parser.index); + break; + } + else if ((parser.currentChar ^ 8232) <= 1) { + scanNewLine(parser); + break; + } + advanceChar(parser); + parser.tokenPos = parser.index; + parser.linePos = parser.line; + parser.colPos = parser.column; + } + if (parser.onComment) { + const loc = { + start: { + line, + column + }, + end: { + line: parser.linePos, + column: parser.colPos + } + }; + parser.onComment(CommentTypes[type & 0xff], source.slice(index, parser.tokenPos), start, parser.tokenPos, loc); + } + return state | 1; +} +function skipMultiLineComment(parser, source, state) { + const { index } = parser; + while (parser.index < parser.end) { + if (parser.currentChar < 0x2b) { + let skippedOneAsterisk = false; + while (parser.currentChar === 42) { + if (!skippedOneAsterisk) { + state &= ~4; + skippedOneAsterisk = true; + } + if (advanceChar(parser) === 47) { + advanceChar(parser); + if (parser.onComment) { + const loc = { + start: { + line: parser.linePos, + column: parser.colPos + }, + end: { + line: parser.line, + column: parser.column + } + }; + parser.onComment(CommentTypes[1 & 0xff], source.slice(index, parser.index - 2), index - 2, parser.index, loc); + } + parser.tokenPos = parser.index; + parser.linePos = parser.line; + parser.colPos = parser.column; + return state; + } + } + if (skippedOneAsterisk) { + continue; + } + if (CharTypes[parser.currentChar] & 8) { + if (parser.currentChar === 13) { + state |= 1 | 4; + scanNewLine(parser); + } + else { + consumeLineFeed(parser, state); + state = (state & ~4) | 1; + } + } + else { + advanceChar(parser); + } + } + else if ((parser.currentChar ^ 8232) <= 1) { + state = (state & ~4) | 1; + scanNewLine(parser); + } + else { + state &= ~4; + advanceChar(parser); + } + } + report(parser, 16); +} + +function scanRegularExpression(parser, context) { + const bodyStart = parser.index; + let preparseState = 0; + loop: while (true) { + const ch = parser.currentChar; + advanceChar(parser); + if (preparseState & 1) { + preparseState &= ~1; + } + else { + switch (ch) { + case 47: + if (!preparseState) + break loop; + else + break; + case 92: + preparseState |= 1; + break; + case 91: + preparseState |= 2; + break; + case 93: + preparseState &= 1; + break; + case 13: + case 10: + case 8232: + case 8233: + report(parser, 32); + } + } + if (parser.index >= parser.source.length) { + return report(parser, 32); + } + } + const bodyEnd = parser.index - 1; + let mask = 0; + let char = parser.currentChar; + const { index: flagStart } = parser; + while (isIdentifierPart(char)) { + switch (char) { + case 103: + if (mask & 2) + report(parser, 34, 'g'); + mask |= 2; + break; + case 105: + if (mask & 1) + report(parser, 34, 'i'); + mask |= 1; + break; + case 109: + if (mask & 4) + report(parser, 34, 'm'); + mask |= 4; + break; + case 117: + if (mask & 16) + report(parser, 34, 'g'); + mask |= 16; + break; + case 121: + if (mask & 8) + report(parser, 34, 'y'); + mask |= 8; + break; + case 115: + if (mask & 12) + report(parser, 34, 's'); + mask |= 12; + break; + default: + report(parser, 33); + } + char = advanceChar(parser); + } + const flags = parser.source.slice(flagStart, parser.index); + const pattern = parser.source.slice(bodyStart, bodyEnd); + parser.tokenRegExp = { pattern, flags }; + if (context & 512) + parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); + parser.tokenValue = validate(parser, pattern, flags); + return 65540; +} +function validate(parser, pattern, flags) { + try { + return new RegExp(pattern, flags); + } + catch (e) { + report(parser, 32); + } +} + +function scanString(parser, context, quote) { + const { index: start } = parser; + let ret = ''; + let char = advanceChar(parser); + let marker = parser.index; + while ((CharTypes[char] & 8) === 0) { + if (char === quote) { + ret += parser.source.slice(marker, parser.index); + advanceChar(parser); + if (context & 512) + parser.tokenRaw = parser.source.slice(start, parser.index); + parser.tokenValue = ret; + return 134283267; + } + if ((char & 8) === 8 && char === 92) { + ret += parser.source.slice(marker, parser.index); + char = advanceChar(parser); + if (char < 0x7f || char === 8232 || char === 8233) { + const code = parseEscape(parser, context, char); + if (code >= 0) + ret += fromCodePoint(code); + else + handleStringError(parser, code, 0); + } + else { + ret += fromCodePoint(char); + } + marker = parser.index + 1; + } + if (parser.index >= parser.end) + report(parser, 14); + char = advanceChar(parser); + } + report(parser, 14); +} +function parseEscape(parser, context, first) { + switch (first) { + case 98: + return 8; + case 102: + return 12; + case 114: + return 13; + case 110: + return 10; + case 116: + return 9; + case 118: + return 11; + case 13: { + if (parser.index < parser.end) { + const nextChar = parser.source.charCodeAt(parser.index + 1); + if (nextChar === 10) { + parser.index = parser.index + 1; + parser.currentChar = nextChar; + } + } + } + case 10: + case 8232: + case 8233: + parser.column = -1; + parser.line++; + return -1; + case 48: + case 49: + case 50: + case 51: { + let code = first - 48; + let index = parser.index + 1; + let column = parser.column + 1; + if (index < parser.end) { + const next = parser.source.charCodeAt(index); + if ((CharTypes[next] & 32) === 0) { + if ((code !== 0 || CharTypes[next] & 512) && context & 1024) + return -2; + } + else if (context & 1024) { + return -2; + } + else { + parser.currentChar = next; + code = (code << 3) | (next - 48); + index++; + column++; + if (index < parser.end) { + const next = parser.source.charCodeAt(index); + if (CharTypes[next] & 32) { + parser.currentChar = next; + code = (code << 3) | (next - 48); + index++; + column++; + } + } + parser.flags |= 64; + parser.index = index - 1; + parser.column = column - 1; + } + } + return code; + } + case 52: + case 53: + case 54: + case 55: { + if (context & 1024) + return -2; + let code = first - 48; + const index = parser.index + 1; + const column = parser.column + 1; + if (index < parser.end) { + const next = parser.source.charCodeAt(index); + if (CharTypes[next] & 32) { + code = (code << 3) | (next - 48); + parser.currentChar = next; + parser.index = index; + parser.column = column; + } + } + parser.flags |= 64; + return code; + } + case 120: { + const ch1 = advanceChar(parser); + if ((CharTypes[ch1] & 64) === 0) + return -4; + const hi = toHex(ch1); + const ch2 = advanceChar(parser); + if ((CharTypes[ch2] & 64) === 0) + return -4; + const lo = toHex(ch2); + return (hi << 4) | lo; + } + case 117: { + const ch = advanceChar(parser); + if (parser.currentChar === 123) { + let code = 0; + while ((CharTypes[advanceChar(parser)] & 64) !== 0) { + code = (code << 4) | toHex(parser.currentChar); + if (code > 1114111) + return -5; + } + if (parser.currentChar < 1 || parser.currentChar !== 125) { + return -4; + } + return code; + } + else { + if ((CharTypes[ch] & 64) === 0) + return -4; + const ch2 = parser.source.charCodeAt(parser.index + 1); + if ((CharTypes[ch2] & 64) === 0) + return -4; + const ch3 = parser.source.charCodeAt(parser.index + 2); + if ((CharTypes[ch3] & 64) === 0) + return -4; + const ch4 = parser.source.charCodeAt(parser.index + 3); + if ((CharTypes[ch4] & 64) === 0) + return -4; + parser.index += 3; + parser.column += 3; + parser.currentChar = parser.source.charCodeAt(parser.index); + return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4); + } + } + case 56: + case 57: + if ((context & 256) === 0) + return -3; + default: + return first; + } +} +function handleStringError(state, code, isTemplate) { + switch (code) { + case -1: + return; + case -2: + report(state, isTemplate ? 2 : 1); + case -3: + report(state, 13); + case -4: + report(state, 6); + case -5: + report(state, 101); + } +} + +function scanTemplate(parser, context) { + const { index: start } = parser; + let token = 67174409; + let ret = ''; + let char = advanceChar(parser); + while (char !== 96) { + if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) { + advanceChar(parser); + token = 67174408; + break; + } + else if ((char & 8) === 8 && char === 92) { + char = advanceChar(parser); + if (char > 0x7e) { + ret += fromCodePoint(char); + } + else { + const code = parseEscape(parser, context | 1024, char); + if (code >= 0) { + ret += fromCodePoint(code); + } + else if (code !== -1 && context & 65536) { + ret = undefined; + char = scanBadTemplate(parser, char); + if (char < 0) + token = 67174408; + break; + } + else { + handleStringError(parser, code, 1); + } + } + } + else { + if (parser.index < parser.end && + char === 13 && + parser.source.charCodeAt(parser.index) === 10) { + ret += fromCodePoint(char); + parser.currentChar = parser.source.charCodeAt(++parser.index); + } + if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) { + parser.column = -1; + parser.line++; + } + ret += fromCodePoint(char); + } + if (parser.index >= parser.end) + report(parser, 15); + char = advanceChar(parser); + } + advanceChar(parser); + parser.tokenValue = ret; + parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2)); + return token; +} +function scanBadTemplate(parser, ch) { + while (ch !== 96) { + switch (ch) { + case 36: { + const index = parser.index + 1; + if (index < parser.end && parser.source.charCodeAt(index) === 123) { + parser.index = index; + parser.column++; + return -ch; + } + break; + } + case 10: + case 8232: + case 8233: + parser.column = -1; + parser.line++; + } + if (parser.index >= parser.end) + report(parser, 15); + ch = advanceChar(parser); + } + return ch; +} +function scanTemplateTail(parser, context) { + if (parser.index >= parser.end) + report(parser, 0); + parser.index--; + parser.column--; + return scanTemplate(parser, context); +} + +function scanNumber(parser, context, kind) { + let char = parser.currentChar; + let value = 0; + let digit = 9; + let atStart = kind & 64 ? 0 : 1; + let digits = 0; + let allowSeparator = 0; + if (kind & 64) { + value = '.' + scanDecimalDigitsOrSeparator(parser, char); + char = parser.currentChar; + if (char === 110) + report(parser, 11); + } + else { + if (char === 48) { + char = advanceChar(parser); + if ((char | 32) === 120) { + kind = 8 | 128; + char = advanceChar(parser); + while (CharTypes[char] & (64 | 4096)) { + if (char === 95) { + if (!allowSeparator) + report(parser, 146); + allowSeparator = 0; + char = advanceChar(parser); + continue; + } + allowSeparator = 1; + value = value * 0x10 + toHex(char); + digits++; + char = advanceChar(parser); + } + if (digits < 1 || !allowSeparator) { + report(parser, digits < 1 ? 19 : 147); + } + } + else if ((char | 32) === 111) { + kind = 4 | 128; + char = advanceChar(parser); + while (CharTypes[char] & (32 | 4096)) { + if (char === 95) { + if (!allowSeparator) { + report(parser, 146); + } + allowSeparator = 0; + char = advanceChar(parser); + continue; + } + allowSeparator = 1; + value = value * 8 + (char - 48); + digits++; + char = advanceChar(parser); + } + if (digits < 1 || !allowSeparator) { + report(parser, digits < 1 ? 0 : 147); + } + } + else if ((char | 32) === 98) { + kind = 2 | 128; + char = advanceChar(parser); + while (CharTypes[char] & (128 | 4096)) { + if (char === 95) { + if (!allowSeparator) { + report(parser, 146); + } + allowSeparator = 0; + char = advanceChar(parser); + continue; + } + allowSeparator = 1; + value = value * 2 + (char - 48); + digits++; + char = advanceChar(parser); + } + if (digits < 1 || !allowSeparator) { + report(parser, digits < 1 ? 0 : 147); + } + } + else if (CharTypes[char] & 32) { + if (context & 1024) + report(parser, 1); + kind = 1; + while (CharTypes[char] & 16) { + if (CharTypes[char] & 512) { + kind = 32; + atStart = 0; + break; + } + value = value * 8 + (char - 48); + char = advanceChar(parser); + } + } + else if (CharTypes[char] & 512) { + if (context & 1024) + report(parser, 1); + parser.flags |= 64; + kind = 32; + } + else if (char === 95) { + report(parser, 0); + } + } + if (kind & 48) { + if (atStart) { + while (digit >= 0 && CharTypes[char] & (16 | 4096)) { + if (char === 95) { + char = advanceChar(parser); + if (char === 95 || kind & 32) { + reportScannerError(parser.index, parser.line, parser.index + 1, 146); + } + allowSeparator = 1; + continue; + } + allowSeparator = 0; + value = 10 * value + (char - 48); + char = advanceChar(parser); + --digit; + } + if (allowSeparator) { + reportScannerError(parser.index, parser.line, parser.index + 1, 147); + } + if (digit >= 0 && !isIdentifierStart(char) && char !== 46) { + parser.tokenValue = value; + if (context & 512) + parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); + return 134283266; + } + } + value += scanDecimalDigitsOrSeparator(parser, char); + char = parser.currentChar; + if (char === 46) { + if (advanceChar(parser) === 95) + report(parser, 0); + kind = 64; + value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar); + char = parser.currentChar; + } + } + } + const end = parser.index; + let isBigInt = 0; + if (char === 110 && kind & 128) { + isBigInt = 1; + char = advanceChar(parser); + } + else { + if ((char | 32) === 101) { + char = advanceChar(parser); + if (CharTypes[char] & 256) + char = advanceChar(parser); + const { index } = parser; + if ((CharTypes[char] & 16) < 1) + report(parser, 10); + value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char); + char = parser.currentChar; + } + } + if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) { + report(parser, 12); + } + if (isBigInt) { + parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); + parser.tokenValue = BigInt(value); + return 134283389; + } + parser.tokenValue = + kind & (1 | 2 | 8 | 4) + ? value + : kind & 32 + ? parseFloat(parser.source.substring(parser.tokenPos, parser.index)) + : +value; + if (context & 512) + parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); + return 134283266; +} +function scanDecimalDigitsOrSeparator(parser, char) { + let allowSeparator = 0; + let start = parser.index; + let ret = ''; + while (CharTypes[char] & (16 | 4096)) { + if (char === 95) { + const { index } = parser; + char = advanceChar(parser); + if (char === 95) { + reportScannerError(parser.index, parser.line, parser.index + 1, 146); + } + allowSeparator = 1; + ret += parser.source.substring(start, index); + start = parser.index; + continue; + } + allowSeparator = 0; + char = advanceChar(parser); + } + if (allowSeparator) { + reportScannerError(parser.index, parser.line, parser.index + 1, 147); + } + return ret + parser.source.substring(start, parser.index); +} + +const KeywordDescTable = [ + 'end of source', + 'identifier', 'number', 'string', 'regular expression', + 'false', 'true', 'null', + 'template continuation', 'template tail', + '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '', '/>', + '++', '--', + '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=', + '&=', '||=', '&&=', '??=', + 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&', + '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^', + 'var', 'let', 'const', + 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export', + 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch', + 'this', 'throw', 'try', 'while', 'with', + 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield', + 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of', + 'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#', + 'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField', + 'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText' +]; +const descKeywordTable = Object.create(null, { + this: { value: 86113 }, + function: { value: 86106 }, + if: { value: 20571 }, + return: { value: 20574 }, + var: { value: 86090 }, + else: { value: 20565 }, + for: { value: 20569 }, + new: { value: 86109 }, + in: { value: 8738868 }, + typeof: { value: 16863277 }, + while: { value: 20580 }, + case: { value: 20558 }, + break: { value: 20557 }, + try: { value: 20579 }, + catch: { value: 20559 }, + delete: { value: 16863278 }, + throw: { value: 86114 }, + switch: { value: 86112 }, + continue: { value: 20561 }, + default: { value: 20563 }, + instanceof: { value: 8476725 }, + do: { value: 20564 }, + void: { value: 16863279 }, + finally: { value: 20568 }, + async: { value: 209007 }, + await: { value: 209008 }, + class: { value: 86096 }, + const: { value: 86092 }, + constructor: { value: 12401 }, + debugger: { value: 20562 }, + export: { value: 20566 }, + extends: { value: 20567 }, + false: { value: 86021 }, + from: { value: 12404 }, + get: { value: 12402 }, + implements: { value: 36966 }, + import: { value: 86108 }, + interface: { value: 36967 }, + let: { value: 241739 }, + null: { value: 86023 }, + of: { value: 274549 }, + package: { value: 36968 }, + private: { value: 36969 }, + protected: { value: 36970 }, + public: { value: 36971 }, + set: { value: 12403 }, + static: { value: 36972 }, + super: { value: 86111 }, + true: { value: 86022 }, + with: { value: 20581 }, + yield: { value: 241773 }, + enum: { value: 86134 }, + eval: { value: 537079927 }, + as: { value: 77934 }, + arguments: { value: 537079928 }, + target: { value: 143494 }, + meta: { value: 143495 }, +}); + +function scanIdentifier(parser, context, isValidAsKeyword) { + while (isIdPart[advanceChar(parser)]) { } + parser.tokenValue = parser.source.slice(parser.tokenPos, parser.index); + return parser.currentChar !== 92 && parser.currentChar < 0x7e + ? descKeywordTable[parser.tokenValue] || 208897 + : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword); +} +function scanUnicodeIdentifier(parser, context) { + const cookedChar = scanIdentifierUnicodeEscape(parser); + if (!isIdentifierPart(cookedChar)) + report(parser, 4); + parser.tokenValue = fromCodePoint(cookedChar); + return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4); +} +function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) { + let start = parser.index; + while (parser.index < parser.end) { + if (parser.currentChar === 92) { + parser.tokenValue += parser.source.slice(start, parser.index); + hasEscape = 1; + const code = scanIdentifierUnicodeEscape(parser); + if (!isIdentifierPart(code)) + report(parser, 4); + isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4; + parser.tokenValue += fromCodePoint(code); + start = parser.index; + } + else if (isIdentifierPart(parser.currentChar) || consumeMultiUnitCodePoint(parser, parser.currentChar)) { + advanceChar(parser); + } + else { + break; + } + } + if (parser.index <= parser.end) { + parser.tokenValue += parser.source.slice(start, parser.index); + } + const length = parser.tokenValue.length; + if (isValidAsKeyword && length >= 2 && length <= 11) { + const token = descKeywordTable[parser.tokenValue]; + if (token === void 0) + return 208897; + if (!hasEscape) + return token; + if (context & 1024) { + return token === 209008 && (context & (2048 | 4194304)) === 0 + ? token + : token === 36972 + ? 122 + : (token & 36864) === 36864 + ? 122 + : 121; + } + if (context & 1073741824 && + (context & 8192) === 0 && + (token & 20480) === 20480) + return token; + if (token === 241773) { + return context & 1073741824 + ? 143483 + : context & 2097152 + ? 121 + : token; + } + return token === 209007 && context & 1073741824 + ? 143483 + : (token & 36864) === 36864 + ? token + : token === 209008 && (context & 4194304) === 0 + ? token + : 121; + } + return 208897; +} +function scanPrivateIdentifier(parser) { + if (!isIdentifierStart(advanceChar(parser))) + report(parser, 93); + return 131; +} +function scanIdentifierUnicodeEscape(parser) { + if (parser.source.charCodeAt(parser.index + 1) !== 117) { + report(parser, 4); + } + parser.currentChar = parser.source.charCodeAt((parser.index += 2)); + return scanUnicodeEscape(parser); +} +function scanUnicodeEscape(parser) { + let codePoint = 0; + const char = parser.currentChar; + if (char === 123) { + const begin = parser.index - 2; + while (CharTypes[advanceChar(parser)] & 64) { + codePoint = (codePoint << 4) | toHex(parser.currentChar); + if (codePoint > 1114111) + reportScannerError(begin, parser.line, parser.index + 1, 101); + } + if (parser.currentChar !== 125) { + reportScannerError(begin, parser.line, parser.index - 1, 6); + } + advanceChar(parser); + return codePoint; + } + if ((CharTypes[char] & 64) === 0) + report(parser, 6); + const char2 = parser.source.charCodeAt(parser.index + 1); + if ((CharTypes[char2] & 64) === 0) + report(parser, 6); + const char3 = parser.source.charCodeAt(parser.index + 2); + if ((CharTypes[char3] & 64) === 0) + report(parser, 6); + const char4 = parser.source.charCodeAt(parser.index + 3); + if ((CharTypes[char4] & 64) === 0) + report(parser, 6); + codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4); + parser.currentChar = parser.source.charCodeAt((parser.index += 4)); + return codePoint; +} + +const TokenLookup = [ + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 128, + 136, + 128, + 128, + 130, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 128, + 16842800, + 134283267, + 131, + 208897, + 8457015, + 8455751, + 134283267, + 67174411, + 16, + 8457014, + 25233970, + 18, + 25233971, + 67108877, + 8457016, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 134283266, + 21, + 1074790417, + 8456258, + 1077936157, + 8456259, + 22, + 133, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 208897, + 69271571, + 137, + 20, + 8455497, + 208897, + 132, + 4096, + 4096, + 4096, + 4096, + 4096, + 4096, + 4096, + 208897, + 4096, + 208897, + 208897, + 4096, + 208897, + 4096, + 208897, + 4096, + 208897, + 4096, + 4096, + 4096, + 208897, + 4096, + 4096, + 208897, + 4096, + 4096, + 2162700, + 8455240, + 1074790415, + 16842801, + 129 +]; +function nextToken(parser, context) { + parser.flags = (parser.flags | 1) ^ 1; + parser.startPos = parser.index; + parser.startColumn = parser.column; + parser.startLine = parser.line; + parser.token = scanSingleToken(parser, context, 0); + if (parser.onToken && parser.token !== 1048576) { + const loc = { + start: { + line: parser.linePos, + column: parser.colPos + }, + end: { + line: parser.line, + column: parser.column + } + }; + parser.onToken(convertTokenType(parser.token), parser.tokenPos, parser.index, loc); + } +} +function scanSingleToken(parser, context, state) { + const isStartOfLine = parser.index === 0; + const source = parser.source; + let startPos = parser.index; + let startLine = parser.line; + let startColumn = parser.column; + while (parser.index < parser.end) { + parser.tokenPos = parser.index; + parser.colPos = parser.column; + parser.linePos = parser.line; + let char = parser.currentChar; + if (char <= 0x7e) { + const token = TokenLookup[char]; + switch (token) { + case 67174411: + case 16: + case 2162700: + case 1074790415: + case 69271571: + case 20: + case 21: + case 1074790417: + case 18: + case 16842801: + case 133: + case 129: + advanceChar(parser); + return token; + case 208897: + return scanIdentifier(parser, context, 0); + case 4096: + return scanIdentifier(parser, context, 1); + case 134283266: + return scanNumber(parser, context, 16 | 128); + case 134283267: + return scanString(parser, context, char); + case 132: + return scanTemplate(parser, context); + case 137: + return scanUnicodeIdentifier(parser, context); + case 131: + return scanPrivateIdentifier(parser); + case 128: + advanceChar(parser); + break; + case 130: + state |= 1 | 4; + scanNewLine(parser); + break; + case 136: + consumeLineFeed(parser, state); + state = (state & ~4) | 1; + break; + case 8456258: + let ch = advanceChar(parser); + if (parser.index < parser.end) { + if (ch === 60) { + if (parser.index < parser.end && advanceChar(parser) === 61) { + advanceChar(parser); + return 4194334; + } + return 8456516; + } + else if (ch === 61) { + advanceChar(parser); + return 8456000; + } + if (ch === 33) { + const index = parser.index + 1; + if (index + 1 < parser.end && + source.charCodeAt(index) === 45 && + source.charCodeAt(index + 1) == 45) { + parser.column += 3; + parser.currentChar = source.charCodeAt((parser.index += 3)); + state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenPos, parser.linePos, parser.colPos); + startPos = parser.tokenPos; + startLine = parser.linePos; + startColumn = parser.colPos; + continue; + } + return 8456258; + } + if (ch === 47) { + if ((context & 16) < 1) + return 8456258; + const index = parser.index + 1; + if (index < parser.end) { + ch = source.charCodeAt(index); + if (ch === 42 || ch === 47) + break; + } + advanceChar(parser); + return 25; + } + } + return 8456258; + case 1077936157: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 61) { + if (advanceChar(parser) === 61) { + advanceChar(parser); + return 8455996; + } + return 8455998; + } + if (ch === 62) { + advanceChar(parser); + return 10; + } + return 1077936157; + } + case 16842800: + if (advanceChar(parser) !== 61) { + return 16842800; + } + if (advanceChar(parser) !== 61) { + return 8455999; + } + advanceChar(parser); + return 8455997; + case 8457015: + if (advanceChar(parser) !== 61) + return 8457015; + advanceChar(parser); + return 4194342; + case 8457014: { + advanceChar(parser); + if (parser.index >= parser.end) + return 8457014; + const ch = parser.currentChar; + if (ch === 61) { + advanceChar(parser); + return 4194340; + } + if (ch !== 42) + return 8457014; + if (advanceChar(parser) !== 61) + return 8457273; + advanceChar(parser); + return 4194337; + } + case 8455497: + if (advanceChar(parser) !== 61) + return 8455497; + advanceChar(parser); + return 4194343; + case 25233970: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 43) { + advanceChar(parser); + return 33619995; + } + if (ch === 61) { + advanceChar(parser); + return 4194338; + } + return 25233970; + } + case 25233971: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 45) { + advanceChar(parser); + if ((state & 1 || isStartOfLine) && parser.currentChar === 62) { + if ((context & 256) === 0) + report(parser, 108); + advanceChar(parser); + state = skipSingleHTMLComment(parser, source, state, context, 3, startPos, startLine, startColumn); + startPos = parser.tokenPos; + startLine = parser.linePos; + startColumn = parser.colPos; + continue; + } + return 33619996; + } + if (ch === 61) { + advanceChar(parser); + return 4194339; + } + return 25233971; + } + case 8457016: { + advanceChar(parser); + if (parser.index < parser.end) { + const ch = parser.currentChar; + if (ch === 47) { + advanceChar(parser); + state = skipSingleLineComment(parser, source, state, 0, parser.tokenPos, parser.linePos, parser.colPos); + startPos = parser.tokenPos; + startLine = parser.linePos; + startColumn = parser.colPos; + continue; + } + if (ch === 42) { + advanceChar(parser); + state = skipMultiLineComment(parser, source, state); + startPos = parser.tokenPos; + startLine = parser.linePos; + startColumn = parser.colPos; + continue; + } + if (context & 32768) { + return scanRegularExpression(parser, context); + } + if (ch === 61) { + advanceChar(parser); + return 4259877; + } + } + return 8457016; + } + case 67108877: + const next = advanceChar(parser); + if (next >= 48 && next <= 57) + return scanNumber(parser, context, 64 | 16); + if (next === 46) { + const index = parser.index + 1; + if (index < parser.end && source.charCodeAt(index) === 46) { + parser.column += 2; + parser.currentChar = source.charCodeAt((parser.index += 2)); + return 14; + } + } + return 67108877; + case 8455240: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 124) { + advanceChar(parser); + if (parser.currentChar === 61) { + advanceChar(parser); + return 4194346; + } + return 8979003; + } + if (ch === 61) { + advanceChar(parser); + return 4194344; + } + return 8455240; + } + case 8456259: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 61) { + advanceChar(parser); + return 8456001; + } + if (ch !== 62) + return 8456259; + advanceChar(parser); + if (parser.index < parser.end) { + const ch = parser.currentChar; + if (ch === 62) { + if (advanceChar(parser) === 61) { + advanceChar(parser); + return 4194336; + } + return 8456518; + } + if (ch === 61) { + advanceChar(parser); + return 4194335; + } + } + return 8456517; + } + case 8455751: { + advanceChar(parser); + const ch = parser.currentChar; + if (ch === 38) { + advanceChar(parser); + if (parser.currentChar === 61) { + advanceChar(parser); + return 4194347; + } + return 8979258; + } + if (ch === 61) { + advanceChar(parser); + return 4194345; + } + return 8455751; + } + case 22: { + let ch = advanceChar(parser); + if (ch === 63) { + advanceChar(parser); + if (parser.currentChar === 61) { + advanceChar(parser); + return 4194348; + } + return 276889982; + } + if (ch === 46) { + const index = parser.index + 1; + if (index < parser.end) { + ch = source.charCodeAt(index); + if (!(ch >= 48 && ch <= 57)) { + advanceChar(parser); + return 67108991; + } + } + } + return 22; + } + } + } + else { + if ((char ^ 8232) <= 1) { + state = (state & ~4) | 1; + scanNewLine(parser); + continue; + } + if ((char & 0xfc00) === 0xd800 || ((unicodeLookup[(char >>> 5) + 34816] >>> char) & 31 & 1) !== 0) { + if ((char & 0xfc00) === 0xdc00) { + char = ((char & 0x3ff) << 10) | (char & 0x3ff) | 0x10000; + if (((unicodeLookup[(char >>> 5) + 0] >>> char) & 31 & 1) === 0) { + report(parser, 18, fromCodePoint(char)); + } + parser.index++; + parser.currentChar = char; + } + parser.column++; + parser.tokenValue = ''; + return scanIdentifierSlowCase(parser, context, 0, 0); + } + if (isExoticECMAScriptWhitespace(char)) { + advanceChar(parser); + continue; + } + report(parser, 18, fromCodePoint(char)); + } + } + return 1048576; +} + +const entities = { + AElig: '\u00C6', + AMP: '\u0026', + Aacute: '\u00C1', + Abreve: '\u0102', + Acirc: '\u00C2', + Acy: '\u0410', + Afr: '\uD835\uDD04', + Agrave: '\u00C0', + Alpha: '\u0391', + Amacr: '\u0100', + And: '\u2A53', + Aogon: '\u0104', + Aopf: '\uD835\uDD38', + ApplyFunction: '\u2061', + Aring: '\u00C5', + Ascr: '\uD835\uDC9C', + Assign: '\u2254', + Atilde: '\u00C3', + Auml: '\u00C4', + Backslash: '\u2216', + Barv: '\u2AE7', + Barwed: '\u2306', + Bcy: '\u0411', + Because: '\u2235', + Bernoullis: '\u212C', + Beta: '\u0392', + Bfr: '\uD835\uDD05', + Bopf: '\uD835\uDD39', + Breve: '\u02D8', + Bscr: '\u212C', + Bumpeq: '\u224E', + CHcy: '\u0427', + COPY: '\u00A9', + Cacute: '\u0106', + Cap: '\u22D2', + CapitalDifferentialD: '\u2145', + Cayleys: '\u212D', + Ccaron: '\u010C', + Ccedil: '\u00C7', + Ccirc: '\u0108', + Cconint: '\u2230', + Cdot: '\u010A', + Cedilla: '\u00B8', + CenterDot: '\u00B7', + Cfr: '\u212D', + Chi: '\u03A7', + CircleDot: '\u2299', + CircleMinus: '\u2296', + CirclePlus: '\u2295', + CircleTimes: '\u2297', + ClockwiseContourIntegral: '\u2232', + CloseCurlyDoubleQuote: '\u201D', + CloseCurlyQuote: '\u2019', + Colon: '\u2237', + Colone: '\u2A74', + Congruent: '\u2261', + Conint: '\u222F', + ContourIntegral: '\u222E', + Copf: '\u2102', + Coproduct: '\u2210', + CounterClockwiseContourIntegral: '\u2233', + Cross: '\u2A2F', + Cscr: '\uD835\uDC9E', + Cup: '\u22D3', + CupCap: '\u224D', + DD: '\u2145', + DDotrahd: '\u2911', + DJcy: '\u0402', + DScy: '\u0405', + DZcy: '\u040F', + Dagger: '\u2021', + Darr: '\u21A1', + Dashv: '\u2AE4', + Dcaron: '\u010E', + Dcy: '\u0414', + Del: '\u2207', + Delta: '\u0394', + Dfr: '\uD835\uDD07', + DiacriticalAcute: '\u00B4', + DiacriticalDot: '\u02D9', + DiacriticalDoubleAcute: '\u02DD', + DiacriticalGrave: '\u0060', + DiacriticalTilde: '\u02DC', + Diamond: '\u22C4', + DifferentialD: '\u2146', + Dopf: '\uD835\uDD3B', + Dot: '\u00A8', + DotDot: '\u20DC', + DotEqual: '\u2250', + DoubleContourIntegral: '\u222F', + DoubleDot: '\u00A8', + DoubleDownArrow: '\u21D3', + DoubleLeftArrow: '\u21D0', + DoubleLeftRightArrow: '\u21D4', + DoubleLeftTee: '\u2AE4', + DoubleLongLeftArrow: '\u27F8', + DoubleLongLeftRightArrow: '\u27FA', + DoubleLongRightArrow: '\u27F9', + DoubleRightArrow: '\u21D2', + DoubleRightTee: '\u22A8', + DoubleUpArrow: '\u21D1', + DoubleUpDownArrow: '\u21D5', + DoubleVerticalBar: '\u2225', + DownArrow: '\u2193', + DownArrowBar: '\u2913', + DownArrowUpArrow: '\u21F5', + DownBreve: '\u0311', + DownLeftRightVector: '\u2950', + DownLeftTeeVector: '\u295E', + DownLeftVector: '\u21BD', + DownLeftVectorBar: '\u2956', + DownRightTeeVector: '\u295F', + DownRightVector: '\u21C1', + DownRightVectorBar: '\u2957', + DownTee: '\u22A4', + DownTeeArrow: '\u21A7', + Downarrow: '\u21D3', + Dscr: '\uD835\uDC9F', + Dstrok: '\u0110', + ENG: '\u014A', + ETH: '\u00D0', + Eacute: '\u00C9', + Ecaron: '\u011A', + Ecirc: '\u00CA', + Ecy: '\u042D', + Edot: '\u0116', + Efr: '\uD835\uDD08', + Egrave: '\u00C8', + Element: '\u2208', + Emacr: '\u0112', + EmptySmallSquare: '\u25FB', + EmptyVerySmallSquare: '\u25AB', + Eogon: '\u0118', + Eopf: '\uD835\uDD3C', + Epsilon: '\u0395', + Equal: '\u2A75', + EqualTilde: '\u2242', + Equilibrium: '\u21CC', + Escr: '\u2130', + Esim: '\u2A73', + Eta: '\u0397', + Euml: '\u00CB', + Exists: '\u2203', + ExponentialE: '\u2147', + Fcy: '\u0424', + Ffr: '\uD835\uDD09', + FilledSmallSquare: '\u25FC', + FilledVerySmallSquare: '\u25AA', + Fopf: '\uD835\uDD3D', + ForAll: '\u2200', + Fouriertrf: '\u2131', + Fscr: '\u2131', + GJcy: '\u0403', + GT: '\u003E', + Gamma: '\u0393', + Gammad: '\u03DC', + Gbreve: '\u011E', + Gcedil: '\u0122', + Gcirc: '\u011C', + Gcy: '\u0413', + Gdot: '\u0120', + Gfr: '\uD835\uDD0A', + Gg: '\u22D9', + Gopf: '\uD835\uDD3E', + GreaterEqual: '\u2265', + GreaterEqualLess: '\u22DB', + GreaterFullEqual: '\u2267', + GreaterGreater: '\u2AA2', + GreaterLess: '\u2277', + GreaterSlantEqual: '\u2A7E', + GreaterTilde: '\u2273', + Gscr: '\uD835\uDCA2', + Gt: '\u226B', + HARDcy: '\u042A', + Hacek: '\u02C7', + Hat: '\u005E', + Hcirc: '\u0124', + Hfr: '\u210C', + HilbertSpace: '\u210B', + Hopf: '\u210D', + HorizontalLine: '\u2500', + Hscr: '\u210B', + Hstrok: '\u0126', + HumpDownHump: '\u224E', + HumpEqual: '\u224F', + IEcy: '\u0415', + IJlig: '\u0132', + IOcy: '\u0401', + Iacute: '\u00CD', + Icirc: '\u00CE', + Icy: '\u0418', + Idot: '\u0130', + Ifr: '\u2111', + Igrave: '\u00CC', + Im: '\u2111', + Imacr: '\u012A', + ImaginaryI: '\u2148', + Implies: '\u21D2', + Int: '\u222C', + Integral: '\u222B', + Intersection: '\u22C2', + InvisibleComma: '\u2063', + InvisibleTimes: '\u2062', + Iogon: '\u012E', + Iopf: '\uD835\uDD40', + Iota: '\u0399', + Iscr: '\u2110', + Itilde: '\u0128', + Iukcy: '\u0406', + Iuml: '\u00CF', + Jcirc: '\u0134', + Jcy: '\u0419', + Jfr: '\uD835\uDD0D', + Jopf: '\uD835\uDD41', + Jscr: '\uD835\uDCA5', + Jsercy: '\u0408', + Jukcy: '\u0404', + KHcy: '\u0425', + KJcy: '\u040C', + Kappa: '\u039A', + Kcedil: '\u0136', + Kcy: '\u041A', + Kfr: '\uD835\uDD0E', + Kopf: '\uD835\uDD42', + Kscr: '\uD835\uDCA6', + LJcy: '\u0409', + LT: '\u003C', + Lacute: '\u0139', + Lambda: '\u039B', + Lang: '\u27EA', + Laplacetrf: '\u2112', + Larr: '\u219E', + Lcaron: '\u013D', + Lcedil: '\u013B', + Lcy: '\u041B', + LeftAngleBracket: '\u27E8', + LeftArrow: '\u2190', + LeftArrowBar: '\u21E4', + LeftArrowRightArrow: '\u21C6', + LeftCeiling: '\u2308', + LeftDoubleBracket: '\u27E6', + LeftDownTeeVector: '\u2961', + LeftDownVector: '\u21C3', + LeftDownVectorBar: '\u2959', + LeftFloor: '\u230A', + LeftRightArrow: '\u2194', + LeftRightVector: '\u294E', + LeftTee: '\u22A3', + LeftTeeArrow: '\u21A4', + LeftTeeVector: '\u295A', + LeftTriangle: '\u22B2', + LeftTriangleBar: '\u29CF', + LeftTriangleEqual: '\u22B4', + LeftUpDownVector: '\u2951', + LeftUpTeeVector: '\u2960', + LeftUpVector: '\u21BF', + LeftUpVectorBar: '\u2958', + LeftVector: '\u21BC', + LeftVectorBar: '\u2952', + Leftarrow: '\u21D0', + Leftrightarrow: '\u21D4', + LessEqualGreater: '\u22DA', + LessFullEqual: '\u2266', + LessGreater: '\u2276', + LessLess: '\u2AA1', + LessSlantEqual: '\u2A7D', + LessTilde: '\u2272', + Lfr: '\uD835\uDD0F', + Ll: '\u22D8', + Lleftarrow: '\u21DA', + Lmidot: '\u013F', + LongLeftArrow: '\u27F5', + LongLeftRightArrow: '\u27F7', + LongRightArrow: '\u27F6', + Longleftarrow: '\u27F8', + Longleftrightarrow: '\u27FA', + Longrightarrow: '\u27F9', + Lopf: '\uD835\uDD43', + LowerLeftArrow: '\u2199', + LowerRightArrow: '\u2198', + Lscr: '\u2112', + Lsh: '\u21B0', + Lstrok: '\u0141', + Lt: '\u226A', + Map: '\u2905', + Mcy: '\u041C', + MediumSpace: '\u205F', + Mellintrf: '\u2133', + Mfr: '\uD835\uDD10', + MinusPlus: '\u2213', + Mopf: '\uD835\uDD44', + Mscr: '\u2133', + Mu: '\u039C', + NJcy: '\u040A', + Nacute: '\u0143', + Ncaron: '\u0147', + Ncedil: '\u0145', + Ncy: '\u041D', + NegativeMediumSpace: '\u200B', + NegativeThickSpace: '\u200B', + NegativeThinSpace: '\u200B', + NegativeVeryThinSpace: '\u200B', + NestedGreaterGreater: '\u226B', + NestedLessLess: '\u226A', + NewLine: '\u000A', + Nfr: '\uD835\uDD11', + NoBreak: '\u2060', + NonBreakingSpace: '\u00A0', + Nopf: '\u2115', + Not: '\u2AEC', + NotCongruent: '\u2262', + NotCupCap: '\u226D', + NotDoubleVerticalBar: '\u2226', + NotElement: '\u2209', + NotEqual: '\u2260', + NotEqualTilde: '\u2242\u0338', + NotExists: '\u2204', + NotGreater: '\u226F', + NotGreaterEqual: '\u2271', + NotGreaterFullEqual: '\u2267\u0338', + NotGreaterGreater: '\u226B\u0338', + NotGreaterLess: '\u2279', + NotGreaterSlantEqual: '\u2A7E\u0338', + NotGreaterTilde: '\u2275', + NotHumpDownHump: '\u224E\u0338', + NotHumpEqual: '\u224F\u0338', + NotLeftTriangle: '\u22EA', + NotLeftTriangleBar: '\u29CF\u0338', + NotLeftTriangleEqual: '\u22EC', + NotLess: '\u226E', + NotLessEqual: '\u2270', + NotLessGreater: '\u2278', + NotLessLess: '\u226A\u0338', + NotLessSlantEqual: '\u2A7D\u0338', + NotLessTilde: '\u2274', + NotNestedGreaterGreater: '\u2AA2\u0338', + NotNestedLessLess: '\u2AA1\u0338', + NotPrecedes: '\u2280', + NotPrecedesEqual: '\u2AAF\u0338', + NotPrecedesSlantEqual: '\u22E0', + NotReverseElement: '\u220C', + NotRightTriangle: '\u22EB', + NotRightTriangleBar: '\u29D0\u0338', + NotRightTriangleEqual: '\u22ED', + NotSquareSubset: '\u228F\u0338', + NotSquareSubsetEqual: '\u22E2', + NotSquareSuperset: '\u2290\u0338', + NotSquareSupersetEqual: '\u22E3', + NotSubset: '\u2282\u20D2', + NotSubsetEqual: '\u2288', + NotSucceeds: '\u2281', + NotSucceedsEqual: '\u2AB0\u0338', + NotSucceedsSlantEqual: '\u22E1', + NotSucceedsTilde: '\u227F\u0338', + NotSuperset: '\u2283\u20D2', + NotSupersetEqual: '\u2289', + NotTilde: '\u2241', + NotTildeEqual: '\u2244', + NotTildeFullEqual: '\u2247', + NotTildeTilde: '\u2249', + NotVerticalBar: '\u2224', + Nscr: '\uD835\uDCA9', + Ntilde: '\u00D1', + Nu: '\u039D', + OElig: '\u0152', + Oacute: '\u00D3', + Ocirc: '\u00D4', + Ocy: '\u041E', + Odblac: '\u0150', + Ofr: '\uD835\uDD12', + Ograve: '\u00D2', + Omacr: '\u014C', + Omega: '\u03A9', + Omicron: '\u039F', + Oopf: '\uD835\uDD46', + OpenCurlyDoubleQuote: '\u201C', + OpenCurlyQuote: '\u2018', + Or: '\u2A54', + Oscr: '\uD835\uDCAA', + Oslash: '\u00D8', + Otilde: '\u00D5', + Otimes: '\u2A37', + Ouml: '\u00D6', + OverBar: '\u203E', + OverBrace: '\u23DE', + OverBracket: '\u23B4', + OverParenthesis: '\u23DC', + PartialD: '\u2202', + Pcy: '\u041F', + Pfr: '\uD835\uDD13', + Phi: '\u03A6', + Pi: '\u03A0', + PlusMinus: '\u00B1', + Poincareplane: '\u210C', + Popf: '\u2119', + Pr: '\u2ABB', + Precedes: '\u227A', + PrecedesEqual: '\u2AAF', + PrecedesSlantEqual: '\u227C', + PrecedesTilde: '\u227E', + Prime: '\u2033', + Product: '\u220F', + Proportion: '\u2237', + Proportional: '\u221D', + Pscr: '\uD835\uDCAB', + Psi: '\u03A8', + QUOT: '\u0022', + Qfr: '\uD835\uDD14', + Qopf: '\u211A', + Qscr: '\uD835\uDCAC', + RBarr: '\u2910', + REG: '\u00AE', + Racute: '\u0154', + Rang: '\u27EB', + Rarr: '\u21A0', + Rarrtl: '\u2916', + Rcaron: '\u0158', + Rcedil: '\u0156', + Rcy: '\u0420', + Re: '\u211C', + ReverseElement: '\u220B', + ReverseEquilibrium: '\u21CB', + ReverseUpEquilibrium: '\u296F', + Rfr: '\u211C', + Rho: '\u03A1', + RightAngleBracket: '\u27E9', + RightArrow: '\u2192', + RightArrowBar: '\u21E5', + RightArrowLeftArrow: '\u21C4', + RightCeiling: '\u2309', + RightDoubleBracket: '\u27E7', + RightDownTeeVector: '\u295D', + RightDownVector: '\u21C2', + RightDownVectorBar: '\u2955', + RightFloor: '\u230B', + RightTee: '\u22A2', + RightTeeArrow: '\u21A6', + RightTeeVector: '\u295B', + RightTriangle: '\u22B3', + RightTriangleBar: '\u29D0', + RightTriangleEqual: '\u22B5', + RightUpDownVector: '\u294F', + RightUpTeeVector: '\u295C', + RightUpVector: '\u21BE', + RightUpVectorBar: '\u2954', + RightVector: '\u21C0', + RightVectorBar: '\u2953', + Rightarrow: '\u21D2', + Ropf: '\u211D', + RoundImplies: '\u2970', + Rrightarrow: '\u21DB', + Rscr: '\u211B', + Rsh: '\u21B1', + RuleDelayed: '\u29F4', + SHCHcy: '\u0429', + SHcy: '\u0428', + SOFTcy: '\u042C', + Sacute: '\u015A', + Sc: '\u2ABC', + Scaron: '\u0160', + Scedil: '\u015E', + Scirc: '\u015C', + Scy: '\u0421', + Sfr: '\uD835\uDD16', + ShortDownArrow: '\u2193', + ShortLeftArrow: '\u2190', + ShortRightArrow: '\u2192', + ShortUpArrow: '\u2191', + Sigma: '\u03A3', + SmallCircle: '\u2218', + Sopf: '\uD835\uDD4A', + Sqrt: '\u221A', + Square: '\u25A1', + SquareIntersection: '\u2293', + SquareSubset: '\u228F', + SquareSubsetEqual: '\u2291', + SquareSuperset: '\u2290', + SquareSupersetEqual: '\u2292', + SquareUnion: '\u2294', + Sscr: '\uD835\uDCAE', + Star: '\u22C6', + Sub: '\u22D0', + Subset: '\u22D0', + SubsetEqual: '\u2286', + Succeeds: '\u227B', + SucceedsEqual: '\u2AB0', + SucceedsSlantEqual: '\u227D', + SucceedsTilde: '\u227F', + SuchThat: '\u220B', + Sum: '\u2211', + Sup: '\u22D1', + Superset: '\u2283', + SupersetEqual: '\u2287', + Supset: '\u22D1', + THORN: '\u00DE', + TRADE: '\u2122', + TSHcy: '\u040B', + TScy: '\u0426', + Tab: '\u0009', + Tau: '\u03A4', + Tcaron: '\u0164', + Tcedil: '\u0162', + Tcy: '\u0422', + Tfr: '\uD835\uDD17', + Therefore: '\u2234', + Theta: '\u0398', + ThickSpace: '\u205F\u200A', + ThinSpace: '\u2009', + Tilde: '\u223C', + TildeEqual: '\u2243', + TildeFullEqual: '\u2245', + TildeTilde: '\u2248', + Topf: '\uD835\uDD4B', + TripleDot: '\u20DB', + Tscr: '\uD835\uDCAF', + Tstrok: '\u0166', + Uacute: '\u00DA', + Uarr: '\u219F', + Uarrocir: '\u2949', + Ubrcy: '\u040E', + Ubreve: '\u016C', + Ucirc: '\u00DB', + Ucy: '\u0423', + Udblac: '\u0170', + Ufr: '\uD835\uDD18', + Ugrave: '\u00D9', + Umacr: '\u016A', + UnderBar: '\u005F', + UnderBrace: '\u23DF', + UnderBracket: '\u23B5', + UnderParenthesis: '\u23DD', + Union: '\u22C3', + UnionPlus: '\u228E', + Uogon: '\u0172', + Uopf: '\uD835\uDD4C', + UpArrow: '\u2191', + UpArrowBar: '\u2912', + UpArrowDownArrow: '\u21C5', + UpDownArrow: '\u2195', + UpEquilibrium: '\u296E', + UpTee: '\u22A5', + UpTeeArrow: '\u21A5', + Uparrow: '\u21D1', + Updownarrow: '\u21D5', + UpperLeftArrow: '\u2196', + UpperRightArrow: '\u2197', + Upsi: '\u03D2', + Upsilon: '\u03A5', + Uring: '\u016E', + Uscr: '\uD835\uDCB0', + Utilde: '\u0168', + Uuml: '\u00DC', + VDash: '\u22AB', + Vbar: '\u2AEB', + Vcy: '\u0412', + Vdash: '\u22A9', + Vdashl: '\u2AE6', + Vee: '\u22C1', + Verbar: '\u2016', + Vert: '\u2016', + VerticalBar: '\u2223', + VerticalLine: '\u007C', + VerticalSeparator: '\u2758', + VerticalTilde: '\u2240', + VeryThinSpace: '\u200A', + Vfr: '\uD835\uDD19', + Vopf: '\uD835\uDD4D', + Vscr: '\uD835\uDCB1', + Vvdash: '\u22AA', + Wcirc: '\u0174', + Wedge: '\u22C0', + Wfr: '\uD835\uDD1A', + Wopf: '\uD835\uDD4E', + Wscr: '\uD835\uDCB2', + Xfr: '\uD835\uDD1B', + Xi: '\u039E', + Xopf: '\uD835\uDD4F', + Xscr: '\uD835\uDCB3', + YAcy: '\u042F', + YIcy: '\u0407', + YUcy: '\u042E', + Yacute: '\u00DD', + Ycirc: '\u0176', + Ycy: '\u042B', + Yfr: '\uD835\uDD1C', + Yopf: '\uD835\uDD50', + Yscr: '\uD835\uDCB4', + Yuml: '\u0178', + ZHcy: '\u0416', + Zacute: '\u0179', + Zcaron: '\u017D', + Zcy: '\u0417', + Zdot: '\u017B', + ZeroWidthSpace: '\u200B', + Zeta: '\u0396', + Zfr: '\u2128', + Zopf: '\u2124', + Zscr: '\uD835\uDCB5', + aacute: '\u00E1', + abreve: '\u0103', + ac: '\u223E', + acE: '\u223E\u0333', + acd: '\u223F', + acirc: '\u00E2', + acute: '\u00B4', + acy: '\u0430', + aelig: '\u00E6', + af: '\u2061', + afr: '\uD835\uDD1E', + agrave: '\u00E0', + alefsym: '\u2135', + aleph: '\u2135', + alpha: '\u03B1', + amacr: '\u0101', + amalg: '\u2A3F', + amp: '\u0026', + and: '\u2227', + andand: '\u2A55', + andd: '\u2A5C', + andslope: '\u2A58', + andv: '\u2A5A', + ang: '\u2220', + ange: '\u29A4', + angle: '\u2220', + angmsd: '\u2221', + angmsdaa: '\u29A8', + angmsdab: '\u29A9', + angmsdac: '\u29AA', + angmsdad: '\u29AB', + angmsdae: '\u29AC', + angmsdaf: '\u29AD', + angmsdag: '\u29AE', + angmsdah: '\u29AF', + angrt: '\u221F', + angrtvb: '\u22BE', + angrtvbd: '\u299D', + angsph: '\u2222', + angst: '\u00C5', + angzarr: '\u237C', + aogon: '\u0105', + aopf: '\uD835\uDD52', + ap: '\u2248', + apE: '\u2A70', + apacir: '\u2A6F', + ape: '\u224A', + apid: '\u224B', + apos: '\u0027', + approx: '\u2248', + approxeq: '\u224A', + aring: '\u00E5', + ascr: '\uD835\uDCB6', + ast: '\u002A', + asymp: '\u2248', + asympeq: '\u224D', + atilde: '\u00E3', + auml: '\u00E4', + awconint: '\u2233', + awint: '\u2A11', + bNot: '\u2AED', + backcong: '\u224C', + backepsilon: '\u03F6', + backprime: '\u2035', + backsim: '\u223D', + backsimeq: '\u22CD', + barvee: '\u22BD', + barwed: '\u2305', + barwedge: '\u2305', + bbrk: '\u23B5', + bbrktbrk: '\u23B6', + bcong: '\u224C', + bcy: '\u0431', + bdquo: '\u201E', + becaus: '\u2235', + because: '\u2235', + bemptyv: '\u29B0', + bepsi: '\u03F6', + bernou: '\u212C', + beta: '\u03B2', + beth: '\u2136', + between: '\u226C', + bfr: '\uD835\uDD1F', + bigcap: '\u22C2', + bigcirc: '\u25EF', + bigcup: '\u22C3', + bigodot: '\u2A00', + bigoplus: '\u2A01', + bigotimes: '\u2A02', + bigsqcup: '\u2A06', + bigstar: '\u2605', + bigtriangledown: '\u25BD', + bigtriangleup: '\u25B3', + biguplus: '\u2A04', + bigvee: '\u22C1', + bigwedge: '\u22C0', + bkarow: '\u290D', + blacklozenge: '\u29EB', + blacksquare: '\u25AA', + blacktriangle: '\u25B4', + blacktriangledown: '\u25BE', + blacktriangleleft: '\u25C2', + blacktriangleright: '\u25B8', + blank: '\u2423', + blk12: '\u2592', + blk14: '\u2591', + blk34: '\u2593', + block: '\u2588', + bne: '\u003D\u20E5', + bnequiv: '\u2261\u20E5', + bnot: '\u2310', + bopf: '\uD835\uDD53', + bot: '\u22A5', + bottom: '\u22A5', + bowtie: '\u22C8', + boxDL: '\u2557', + boxDR: '\u2554', + boxDl: '\u2556', + boxDr: '\u2553', + boxH: '\u2550', + boxHD: '\u2566', + boxHU: '\u2569', + boxHd: '\u2564', + boxHu: '\u2567', + boxUL: '\u255D', + boxUR: '\u255A', + boxUl: '\u255C', + boxUr: '\u2559', + boxV: '\u2551', + boxVH: '\u256C', + boxVL: '\u2563', + boxVR: '\u2560', + boxVh: '\u256B', + boxVl: '\u2562', + boxVr: '\u255F', + boxbox: '\u29C9', + boxdL: '\u2555', + boxdR: '\u2552', + boxdl: '\u2510', + boxdr: '\u250C', + boxh: '\u2500', + boxhD: '\u2565', + boxhU: '\u2568', + boxhd: '\u252C', + boxhu: '\u2534', + boxminus: '\u229F', + boxplus: '\u229E', + boxtimes: '\u22A0', + boxuL: '\u255B', + boxuR: '\u2558', + boxul: '\u2518', + boxur: '\u2514', + boxv: '\u2502', + boxvH: '\u256A', + boxvL: '\u2561', + boxvR: '\u255E', + boxvh: '\u253C', + boxvl: '\u2524', + boxvr: '\u251C', + bprime: '\u2035', + breve: '\u02D8', + brvbar: '\u00A6', + bscr: '\uD835\uDCB7', + bsemi: '\u204F', + bsim: '\u223D', + bsime: '\u22CD', + bsol: '\u005C', + bsolb: '\u29C5', + bsolhsub: '\u27C8', + bull: '\u2022', + bullet: '\u2022', + bump: '\u224E', + bumpE: '\u2AAE', + bumpe: '\u224F', + bumpeq: '\u224F', + cacute: '\u0107', + cap: '\u2229', + capand: '\u2A44', + capbrcup: '\u2A49', + capcap: '\u2A4B', + capcup: '\u2A47', + capdot: '\u2A40', + caps: '\u2229\uFE00', + caret: '\u2041', + caron: '\u02C7', + ccaps: '\u2A4D', + ccaron: '\u010D', + ccedil: '\u00E7', + ccirc: '\u0109', + ccups: '\u2A4C', + ccupssm: '\u2A50', + cdot: '\u010B', + cedil: '\u00B8', + cemptyv: '\u29B2', + cent: '\u00A2', + centerdot: '\u00B7', + cfr: '\uD835\uDD20', + chcy: '\u0447', + check: '\u2713', + checkmark: '\u2713', + chi: '\u03C7', + cir: '\u25CB', + cirE: '\u29C3', + circ: '\u02C6', + circeq: '\u2257', + circlearrowleft: '\u21BA', + circlearrowright: '\u21BB', + circledR: '\u00AE', + circledS: '\u24C8', + circledast: '\u229B', + circledcirc: '\u229A', + circleddash: '\u229D', + cire: '\u2257', + cirfnint: '\u2A10', + cirmid: '\u2AEF', + cirscir: '\u29C2', + clubs: '\u2663', + clubsuit: '\u2663', + colon: '\u003A', + colone: '\u2254', + coloneq: '\u2254', + comma: '\u002C', + commat: '\u0040', + comp: '\u2201', + compfn: '\u2218', + complement: '\u2201', + complexes: '\u2102', + cong: '\u2245', + congdot: '\u2A6D', + conint: '\u222E', + copf: '\uD835\uDD54', + coprod: '\u2210', + copy: '\u00A9', + copysr: '\u2117', + crarr: '\u21B5', + cross: '\u2717', + cscr: '\uD835\uDCB8', + csub: '\u2ACF', + csube: '\u2AD1', + csup: '\u2AD0', + csupe: '\u2AD2', + ctdot: '\u22EF', + cudarrl: '\u2938', + cudarrr: '\u2935', + cuepr: '\u22DE', + cuesc: '\u22DF', + cularr: '\u21B6', + cularrp: '\u293D', + cup: '\u222A', + cupbrcap: '\u2A48', + cupcap: '\u2A46', + cupcup: '\u2A4A', + cupdot: '\u228D', + cupor: '\u2A45', + cups: '\u222A\uFE00', + curarr: '\u21B7', + curarrm: '\u293C', + curlyeqprec: '\u22DE', + curlyeqsucc: '\u22DF', + curlyvee: '\u22CE', + curlywedge: '\u22CF', + curren: '\u00A4', + curvearrowleft: '\u21B6', + curvearrowright: '\u21B7', + cuvee: '\u22CE', + cuwed: '\u22CF', + cwconint: '\u2232', + cwint: '\u2231', + cylcty: '\u232D', + dArr: '\u21D3', + dHar: '\u2965', + dagger: '\u2020', + daleth: '\u2138', + darr: '\u2193', + dash: '\u2010', + dashv: '\u22A3', + dbkarow: '\u290F', + dblac: '\u02DD', + dcaron: '\u010F', + dcy: '\u0434', + dd: '\u2146', + ddagger: '\u2021', + ddarr: '\u21CA', + ddotseq: '\u2A77', + deg: '\u00B0', + delta: '\u03B4', + demptyv: '\u29B1', + dfisht: '\u297F', + dfr: '\uD835\uDD21', + dharl: '\u21C3', + dharr: '\u21C2', + diam: '\u22C4', + diamond: '\u22C4', + diamondsuit: '\u2666', + diams: '\u2666', + die: '\u00A8', + digamma: '\u03DD', + disin: '\u22F2', + div: '\u00F7', + divide: '\u00F7', + divideontimes: '\u22C7', + divonx: '\u22C7', + djcy: '\u0452', + dlcorn: '\u231E', + dlcrop: '\u230D', + dollar: '\u0024', + dopf: '\uD835\uDD55', + dot: '\u02D9', + doteq: '\u2250', + doteqdot: '\u2251', + dotminus: '\u2238', + dotplus: '\u2214', + dotsquare: '\u22A1', + doublebarwedge: '\u2306', + downarrow: '\u2193', + downdownarrows: '\u21CA', + downharpoonleft: '\u21C3', + downharpoonright: '\u21C2', + drbkarow: '\u2910', + drcorn: '\u231F', + drcrop: '\u230C', + dscr: '\uD835\uDCB9', + dscy: '\u0455', + dsol: '\u29F6', + dstrok: '\u0111', + dtdot: '\u22F1', + dtri: '\u25BF', + dtrif: '\u25BE', + duarr: '\u21F5', + duhar: '\u296F', + dwangle: '\u29A6', + dzcy: '\u045F', + dzigrarr: '\u27FF', + eDDot: '\u2A77', + eDot: '\u2251', + eacute: '\u00E9', + easter: '\u2A6E', + ecaron: '\u011B', + ecir: '\u2256', + ecirc: '\u00EA', + ecolon: '\u2255', + ecy: '\u044D', + edot: '\u0117', + ee: '\u2147', + efDot: '\u2252', + efr: '\uD835\uDD22', + eg: '\u2A9A', + egrave: '\u00E8', + egs: '\u2A96', + egsdot: '\u2A98', + el: '\u2A99', + elinters: '\u23E7', + ell: '\u2113', + els: '\u2A95', + elsdot: '\u2A97', + emacr: '\u0113', + empty: '\u2205', + emptyset: '\u2205', + emptyv: '\u2205', + emsp13: '\u2004', + emsp14: '\u2005', + emsp: '\u2003', + eng: '\u014B', + ensp: '\u2002', + eogon: '\u0119', + eopf: '\uD835\uDD56', + epar: '\u22D5', + eparsl: '\u29E3', + eplus: '\u2A71', + epsi: '\u03B5', + epsilon: '\u03B5', + epsiv: '\u03F5', + eqcirc: '\u2256', + eqcolon: '\u2255', + eqsim: '\u2242', + eqslantgtr: '\u2A96', + eqslantless: '\u2A95', + equals: '\u003D', + equest: '\u225F', + equiv: '\u2261', + equivDD: '\u2A78', + eqvparsl: '\u29E5', + erDot: '\u2253', + erarr: '\u2971', + escr: '\u212F', + esdot: '\u2250', + esim: '\u2242', + eta: '\u03B7', + eth: '\u00F0', + euml: '\u00EB', + euro: '\u20AC', + excl: '\u0021', + exist: '\u2203', + expectation: '\u2130', + exponentiale: '\u2147', + fallingdotseq: '\u2252', + fcy: '\u0444', + female: '\u2640', + ffilig: '\uFB03', + fflig: '\uFB00', + ffllig: '\uFB04', + ffr: '\uD835\uDD23', + filig: '\uFB01', + fjlig: '\u0066\u006A', + flat: '\u266D', + fllig: '\uFB02', + fltns: '\u25B1', + fnof: '\u0192', + fopf: '\uD835\uDD57', + forall: '\u2200', + fork: '\u22D4', + forkv: '\u2AD9', + fpartint: '\u2A0D', + frac12: '\u00BD', + frac13: '\u2153', + frac14: '\u00BC', + frac15: '\u2155', + frac16: '\u2159', + frac18: '\u215B', + frac23: '\u2154', + frac25: '\u2156', + frac34: '\u00BE', + frac35: '\u2157', + frac38: '\u215C', + frac45: '\u2158', + frac56: '\u215A', + frac58: '\u215D', + frac78: '\u215E', + frasl: '\u2044', + frown: '\u2322', + fscr: '\uD835\uDCBB', + gE: '\u2267', + gEl: '\u2A8C', + gacute: '\u01F5', + gamma: '\u03B3', + gammad: '\u03DD', + gap: '\u2A86', + gbreve: '\u011F', + gcirc: '\u011D', + gcy: '\u0433', + gdot: '\u0121', + ge: '\u2265', + gel: '\u22DB', + geq: '\u2265', + geqq: '\u2267', + geqslant: '\u2A7E', + ges: '\u2A7E', + gescc: '\u2AA9', + gesdot: '\u2A80', + gesdoto: '\u2A82', + gesdotol: '\u2A84', + gesl: '\u22DB\uFE00', + gesles: '\u2A94', + gfr: '\uD835\uDD24', + gg: '\u226B', + ggg: '\u22D9', + gimel: '\u2137', + gjcy: '\u0453', + gl: '\u2277', + glE: '\u2A92', + gla: '\u2AA5', + glj: '\u2AA4', + gnE: '\u2269', + gnap: '\u2A8A', + gnapprox: '\u2A8A', + gne: '\u2A88', + gneq: '\u2A88', + gneqq: '\u2269', + gnsim: '\u22E7', + gopf: '\uD835\uDD58', + grave: '\u0060', + gscr: '\u210A', + gsim: '\u2273', + gsime: '\u2A8E', + gsiml: '\u2A90', + gt: '\u003E', + gtcc: '\u2AA7', + gtcir: '\u2A7A', + gtdot: '\u22D7', + gtlPar: '\u2995', + gtquest: '\u2A7C', + gtrapprox: '\u2A86', + gtrarr: '\u2978', + gtrdot: '\u22D7', + gtreqless: '\u22DB', + gtreqqless: '\u2A8C', + gtrless: '\u2277', + gtrsim: '\u2273', + gvertneqq: '\u2269\uFE00', + gvnE: '\u2269\uFE00', + hArr: '\u21D4', + hairsp: '\u200A', + half: '\u00BD', + hamilt: '\u210B', + hardcy: '\u044A', + harr: '\u2194', + harrcir: '\u2948', + harrw: '\u21AD', + hbar: '\u210F', + hcirc: '\u0125', + hearts: '\u2665', + heartsuit: '\u2665', + hellip: '\u2026', + hercon: '\u22B9', + hfr: '\uD835\uDD25', + hksearow: '\u2925', + hkswarow: '\u2926', + hoarr: '\u21FF', + homtht: '\u223B', + hookleftarrow: '\u21A9', + hookrightarrow: '\u21AA', + hopf: '\uD835\uDD59', + horbar: '\u2015', + hscr: '\uD835\uDCBD', + hslash: '\u210F', + hstrok: '\u0127', + hybull: '\u2043', + hyphen: '\u2010', + iacute: '\u00ED', + ic: '\u2063', + icirc: '\u00EE', + icy: '\u0438', + iecy: '\u0435', + iexcl: '\u00A1', + iff: '\u21D4', + ifr: '\uD835\uDD26', + igrave: '\u00EC', + ii: '\u2148', + iiiint: '\u2A0C', + iiint: '\u222D', + iinfin: '\u29DC', + iiota: '\u2129', + ijlig: '\u0133', + imacr: '\u012B', + image: '\u2111', + imagline: '\u2110', + imagpart: '\u2111', + imath: '\u0131', + imof: '\u22B7', + imped: '\u01B5', + in: '\u2208', + incare: '\u2105', + infin: '\u221E', + infintie: '\u29DD', + inodot: '\u0131', + int: '\u222B', + intcal: '\u22BA', + integers: '\u2124', + intercal: '\u22BA', + intlarhk: '\u2A17', + intprod: '\u2A3C', + iocy: '\u0451', + iogon: '\u012F', + iopf: '\uD835\uDD5A', + iota: '\u03B9', + iprod: '\u2A3C', + iquest: '\u00BF', + iscr: '\uD835\uDCBE', + isin: '\u2208', + isinE: '\u22F9', + isindot: '\u22F5', + isins: '\u22F4', + isinsv: '\u22F3', + isinv: '\u2208', + it: '\u2062', + itilde: '\u0129', + iukcy: '\u0456', + iuml: '\u00EF', + jcirc: '\u0135', + jcy: '\u0439', + jfr: '\uD835\uDD27', + jmath: '\u0237', + jopf: '\uD835\uDD5B', + jscr: '\uD835\uDCBF', + jsercy: '\u0458', + jukcy: '\u0454', + kappa: '\u03BA', + kappav: '\u03F0', + kcedil: '\u0137', + kcy: '\u043A', + kfr: '\uD835\uDD28', + kgreen: '\u0138', + khcy: '\u0445', + kjcy: '\u045C', + kopf: '\uD835\uDD5C', + kscr: '\uD835\uDCC0', + lAarr: '\u21DA', + lArr: '\u21D0', + lAtail: '\u291B', + lBarr: '\u290E', + lE: '\u2266', + lEg: '\u2A8B', + lHar: '\u2962', + lacute: '\u013A', + laemptyv: '\u29B4', + lagran: '\u2112', + lambda: '\u03BB', + lang: '\u27E8', + langd: '\u2991', + langle: '\u27E8', + lap: '\u2A85', + laquo: '\u00AB', + larr: '\u2190', + larrb: '\u21E4', + larrbfs: '\u291F', + larrfs: '\u291D', + larrhk: '\u21A9', + larrlp: '\u21AB', + larrpl: '\u2939', + larrsim: '\u2973', + larrtl: '\u21A2', + lat: '\u2AAB', + latail: '\u2919', + late: '\u2AAD', + lates: '\u2AAD\uFE00', + lbarr: '\u290C', + lbbrk: '\u2772', + lbrace: '\u007B', + lbrack: '\u005B', + lbrke: '\u298B', + lbrksld: '\u298F', + lbrkslu: '\u298D', + lcaron: '\u013E', + lcedil: '\u013C', + lceil: '\u2308', + lcub: '\u007B', + lcy: '\u043B', + ldca: '\u2936', + ldquo: '\u201C', + ldquor: '\u201E', + ldrdhar: '\u2967', + ldrushar: '\u294B', + ldsh: '\u21B2', + le: '\u2264', + leftarrow: '\u2190', + leftarrowtail: '\u21A2', + leftharpoondown: '\u21BD', + leftharpoonup: '\u21BC', + leftleftarrows: '\u21C7', + leftrightarrow: '\u2194', + leftrightarrows: '\u21C6', + leftrightharpoons: '\u21CB', + leftrightsquigarrow: '\u21AD', + leftthreetimes: '\u22CB', + leg: '\u22DA', + leq: '\u2264', + leqq: '\u2266', + leqslant: '\u2A7D', + les: '\u2A7D', + lescc: '\u2AA8', + lesdot: '\u2A7F', + lesdoto: '\u2A81', + lesdotor: '\u2A83', + lesg: '\u22DA\uFE00', + lesges: '\u2A93', + lessapprox: '\u2A85', + lessdot: '\u22D6', + lesseqgtr: '\u22DA', + lesseqqgtr: '\u2A8B', + lessgtr: '\u2276', + lesssim: '\u2272', + lfisht: '\u297C', + lfloor: '\u230A', + lfr: '\uD835\uDD29', + lg: '\u2276', + lgE: '\u2A91', + lhard: '\u21BD', + lharu: '\u21BC', + lharul: '\u296A', + lhblk: '\u2584', + ljcy: '\u0459', + ll: '\u226A', + llarr: '\u21C7', + llcorner: '\u231E', + llhard: '\u296B', + lltri: '\u25FA', + lmidot: '\u0140', + lmoust: '\u23B0', + lmoustache: '\u23B0', + lnE: '\u2268', + lnap: '\u2A89', + lnapprox: '\u2A89', + lne: '\u2A87', + lneq: '\u2A87', + lneqq: '\u2268', + lnsim: '\u22E6', + loang: '\u27EC', + loarr: '\u21FD', + lobrk: '\u27E6', + longleftarrow: '\u27F5', + longleftrightarrow: '\u27F7', + longmapsto: '\u27FC', + longrightarrow: '\u27F6', + looparrowleft: '\u21AB', + looparrowright: '\u21AC', + lopar: '\u2985', + lopf: '\uD835\uDD5D', + loplus: '\u2A2D', + lotimes: '\u2A34', + lowast: '\u2217', + lowbar: '\u005F', + loz: '\u25CA', + lozenge: '\u25CA', + lozf: '\u29EB', + lpar: '\u0028', + lparlt: '\u2993', + lrarr: '\u21C6', + lrcorner: '\u231F', + lrhar: '\u21CB', + lrhard: '\u296D', + lrm: '\u200E', + lrtri: '\u22BF', + lsaquo: '\u2039', + lscr: '\uD835\uDCC1', + lsh: '\u21B0', + lsim: '\u2272', + lsime: '\u2A8D', + lsimg: '\u2A8F', + lsqb: '\u005B', + lsquo: '\u2018', + lsquor: '\u201A', + lstrok: '\u0142', + lt: '\u003C', + ltcc: '\u2AA6', + ltcir: '\u2A79', + ltdot: '\u22D6', + lthree: '\u22CB', + ltimes: '\u22C9', + ltlarr: '\u2976', + ltquest: '\u2A7B', + ltrPar: '\u2996', + ltri: '\u25C3', + ltrie: '\u22B4', + ltrif: '\u25C2', + lurdshar: '\u294A', + luruhar: '\u2966', + lvertneqq: '\u2268\uFE00', + lvnE: '\u2268\uFE00', + mDDot: '\u223A', + macr: '\u00AF', + male: '\u2642', + malt: '\u2720', + maltese: '\u2720', + map: '\u21A6', + mapsto: '\u21A6', + mapstodown: '\u21A7', + mapstoleft: '\u21A4', + mapstoup: '\u21A5', + marker: '\u25AE', + mcomma: '\u2A29', + mcy: '\u043C', + mdash: '\u2014', + measuredangle: '\u2221', + mfr: '\uD835\uDD2A', + mho: '\u2127', + micro: '\u00B5', + mid: '\u2223', + midast: '\u002A', + midcir: '\u2AF0', + middot: '\u00B7', + minus: '\u2212', + minusb: '\u229F', + minusd: '\u2238', + minusdu: '\u2A2A', + mlcp: '\u2ADB', + mldr: '\u2026', + mnplus: '\u2213', + models: '\u22A7', + mopf: '\uD835\uDD5E', + mp: '\u2213', + mscr: '\uD835\uDCC2', + mstpos: '\u223E', + mu: '\u03BC', + multimap: '\u22B8', + mumap: '\u22B8', + nGg: '\u22D9\u0338', + nGt: '\u226B\u20D2', + nGtv: '\u226B\u0338', + nLeftarrow: '\u21CD', + nLeftrightarrow: '\u21CE', + nLl: '\u22D8\u0338', + nLt: '\u226A\u20D2', + nLtv: '\u226A\u0338', + nRightarrow: '\u21CF', + nVDash: '\u22AF', + nVdash: '\u22AE', + nabla: '\u2207', + nacute: '\u0144', + nang: '\u2220\u20D2', + nap: '\u2249', + napE: '\u2A70\u0338', + napid: '\u224B\u0338', + napos: '\u0149', + napprox: '\u2249', + natur: '\u266E', + natural: '\u266E', + naturals: '\u2115', + nbsp: '\u00A0', + nbump: '\u224E\u0338', + nbumpe: '\u224F\u0338', + ncap: '\u2A43', + ncaron: '\u0148', + ncedil: '\u0146', + ncong: '\u2247', + ncongdot: '\u2A6D\u0338', + ncup: '\u2A42', + ncy: '\u043D', + ndash: '\u2013', + ne: '\u2260', + neArr: '\u21D7', + nearhk: '\u2924', + nearr: '\u2197', + nearrow: '\u2197', + nedot: '\u2250\u0338', + nequiv: '\u2262', + nesear: '\u2928', + nesim: '\u2242\u0338', + nexist: '\u2204', + nexists: '\u2204', + nfr: '\uD835\uDD2B', + ngE: '\u2267\u0338', + nge: '\u2271', + ngeq: '\u2271', + ngeqq: '\u2267\u0338', + ngeqslant: '\u2A7E\u0338', + nges: '\u2A7E\u0338', + ngsim: '\u2275', + ngt: '\u226F', + ngtr: '\u226F', + nhArr: '\u21CE', + nharr: '\u21AE', + nhpar: '\u2AF2', + ni: '\u220B', + nis: '\u22FC', + nisd: '\u22FA', + niv: '\u220B', + njcy: '\u045A', + nlArr: '\u21CD', + nlE: '\u2266\u0338', + nlarr: '\u219A', + nldr: '\u2025', + nle: '\u2270', + nleftarrow: '\u219A', + nleftrightarrow: '\u21AE', + nleq: '\u2270', + nleqq: '\u2266\u0338', + nleqslant: '\u2A7D\u0338', + nles: '\u2A7D\u0338', + nless: '\u226E', + nlsim: '\u2274', + nlt: '\u226E', + nltri: '\u22EA', + nltrie: '\u22EC', + nmid: '\u2224', + nopf: '\uD835\uDD5F', + not: '\u00AC', + notin: '\u2209', + notinE: '\u22F9\u0338', + notindot: '\u22F5\u0338', + notinva: '\u2209', + notinvb: '\u22F7', + notinvc: '\u22F6', + notni: '\u220C', + notniva: '\u220C', + notnivb: '\u22FE', + notnivc: '\u22FD', + npar: '\u2226', + nparallel: '\u2226', + nparsl: '\u2AFD\u20E5', + npart: '\u2202\u0338', + npolint: '\u2A14', + npr: '\u2280', + nprcue: '\u22E0', + npre: '\u2AAF\u0338', + nprec: '\u2280', + npreceq: '\u2AAF\u0338', + nrArr: '\u21CF', + nrarr: '\u219B', + nrarrc: '\u2933\u0338', + nrarrw: '\u219D\u0338', + nrightarrow: '\u219B', + nrtri: '\u22EB', + nrtrie: '\u22ED', + nsc: '\u2281', + nsccue: '\u22E1', + nsce: '\u2AB0\u0338', + nscr: '\uD835\uDCC3', + nshortmid: '\u2224', + nshortparallel: '\u2226', + nsim: '\u2241', + nsime: '\u2244', + nsimeq: '\u2244', + nsmid: '\u2224', + nspar: '\u2226', + nsqsube: '\u22E2', + nsqsupe: '\u22E3', + nsub: '\u2284', + nsubE: '\u2AC5\u0338', + nsube: '\u2288', + nsubset: '\u2282\u20D2', + nsubseteq: '\u2288', + nsubseteqq: '\u2AC5\u0338', + nsucc: '\u2281', + nsucceq: '\u2AB0\u0338', + nsup: '\u2285', + nsupE: '\u2AC6\u0338', + nsupe: '\u2289', + nsupset: '\u2283\u20D2', + nsupseteq: '\u2289', + nsupseteqq: '\u2AC6\u0338', + ntgl: '\u2279', + ntilde: '\u00F1', + ntlg: '\u2278', + ntriangleleft: '\u22EA', + ntrianglelefteq: '\u22EC', + ntriangleright: '\u22EB', + ntrianglerighteq: '\u22ED', + nu: '\u03BD', + num: '\u0023', + numero: '\u2116', + numsp: '\u2007', + nvDash: '\u22AD', + nvHarr: '\u2904', + nvap: '\u224D\u20D2', + nvdash: '\u22AC', + nvge: '\u2265\u20D2', + nvgt: '\u003E\u20D2', + nvinfin: '\u29DE', + nvlArr: '\u2902', + nvle: '\u2264\u20D2', + nvlt: '\u003C\u20D2', + nvltrie: '\u22B4\u20D2', + nvrArr: '\u2903', + nvrtrie: '\u22B5\u20D2', + nvsim: '\u223C\u20D2', + nwArr: '\u21D6', + nwarhk: '\u2923', + nwarr: '\u2196', + nwarrow: '\u2196', + nwnear: '\u2927', + oS: '\u24C8', + oacute: '\u00F3', + oast: '\u229B', + ocir: '\u229A', + ocirc: '\u00F4', + ocy: '\u043E', + odash: '\u229D', + odblac: '\u0151', + odiv: '\u2A38', + odot: '\u2299', + odsold: '\u29BC', + oelig: '\u0153', + ofcir: '\u29BF', + ofr: '\uD835\uDD2C', + ogon: '\u02DB', + ograve: '\u00F2', + ogt: '\u29C1', + ohbar: '\u29B5', + ohm: '\u03A9', + oint: '\u222E', + olarr: '\u21BA', + olcir: '\u29BE', + olcross: '\u29BB', + oline: '\u203E', + olt: '\u29C0', + omacr: '\u014D', + omega: '\u03C9', + omicron: '\u03BF', + omid: '\u29B6', + ominus: '\u2296', + oopf: '\uD835\uDD60', + opar: '\u29B7', + operp: '\u29B9', + oplus: '\u2295', + or: '\u2228', + orarr: '\u21BB', + ord: '\u2A5D', + order: '\u2134', + orderof: '\u2134', + ordf: '\u00AA', + ordm: '\u00BA', + origof: '\u22B6', + oror: '\u2A56', + orslope: '\u2A57', + orv: '\u2A5B', + oscr: '\u2134', + oslash: '\u00F8', + osol: '\u2298', + otilde: '\u00F5', + otimes: '\u2297', + otimesas: '\u2A36', + ouml: '\u00F6', + ovbar: '\u233D', + par: '\u2225', + para: '\u00B6', + parallel: '\u2225', + parsim: '\u2AF3', + parsl: '\u2AFD', + part: '\u2202', + pcy: '\u043F', + percnt: '\u0025', + period: '\u002E', + permil: '\u2030', + perp: '\u22A5', + pertenk: '\u2031', + pfr: '\uD835\uDD2D', + phi: '\u03C6', + phiv: '\u03D5', + phmmat: '\u2133', + phone: '\u260E', + pi: '\u03C0', + pitchfork: '\u22D4', + piv: '\u03D6', + planck: '\u210F', + planckh: '\u210E', + plankv: '\u210F', + plus: '\u002B', + plusacir: '\u2A23', + plusb: '\u229E', + pluscir: '\u2A22', + plusdo: '\u2214', + plusdu: '\u2A25', + pluse: '\u2A72', + plusmn: '\u00B1', + plussim: '\u2A26', + plustwo: '\u2A27', + pm: '\u00B1', + pointint: '\u2A15', + popf: '\uD835\uDD61', + pound: '\u00A3', + pr: '\u227A', + prE: '\u2AB3', + prap: '\u2AB7', + prcue: '\u227C', + pre: '\u2AAF', + prec: '\u227A', + precapprox: '\u2AB7', + preccurlyeq: '\u227C', + preceq: '\u2AAF', + precnapprox: '\u2AB9', + precneqq: '\u2AB5', + precnsim: '\u22E8', + precsim: '\u227E', + prime: '\u2032', + primes: '\u2119', + prnE: '\u2AB5', + prnap: '\u2AB9', + prnsim: '\u22E8', + prod: '\u220F', + profalar: '\u232E', + profline: '\u2312', + profsurf: '\u2313', + prop: '\u221D', + propto: '\u221D', + prsim: '\u227E', + prurel: '\u22B0', + pscr: '\uD835\uDCC5', + psi: '\u03C8', + puncsp: '\u2008', + qfr: '\uD835\uDD2E', + qint: '\u2A0C', + qopf: '\uD835\uDD62', + qprime: '\u2057', + qscr: '\uD835\uDCC6', + quaternions: '\u210D', + quatint: '\u2A16', + quest: '\u003F', + questeq: '\u225F', + quot: '\u0022', + rAarr: '\u21DB', + rArr: '\u21D2', + rAtail: '\u291C', + rBarr: '\u290F', + rHar: '\u2964', + race: '\u223D\u0331', + racute: '\u0155', + radic: '\u221A', + raemptyv: '\u29B3', + rang: '\u27E9', + rangd: '\u2992', + range: '\u29A5', + rangle: '\u27E9', + raquo: '\u00BB', + rarr: '\u2192', + rarrap: '\u2975', + rarrb: '\u21E5', + rarrbfs: '\u2920', + rarrc: '\u2933', + rarrfs: '\u291E', + rarrhk: '\u21AA', + rarrlp: '\u21AC', + rarrpl: '\u2945', + rarrsim: '\u2974', + rarrtl: '\u21A3', + rarrw: '\u219D', + ratail: '\u291A', + ratio: '\u2236', + rationals: '\u211A', + rbarr: '\u290D', + rbbrk: '\u2773', + rbrace: '\u007D', + rbrack: '\u005D', + rbrke: '\u298C', + rbrksld: '\u298E', + rbrkslu: '\u2990', + rcaron: '\u0159', + rcedil: '\u0157', + rceil: '\u2309', + rcub: '\u007D', + rcy: '\u0440', + rdca: '\u2937', + rdldhar: '\u2969', + rdquo: '\u201D', + rdquor: '\u201D', + rdsh: '\u21B3', + real: '\u211C', + realine: '\u211B', + realpart: '\u211C', + reals: '\u211D', + rect: '\u25AD', + reg: '\u00AE', + rfisht: '\u297D', + rfloor: '\u230B', + rfr: '\uD835\uDD2F', + rhard: '\u21C1', + rharu: '\u21C0', + rharul: '\u296C', + rho: '\u03C1', + rhov: '\u03F1', + rightarrow: '\u2192', + rightarrowtail: '\u21A3', + rightharpoondown: '\u21C1', + rightharpoonup: '\u21C0', + rightleftarrows: '\u21C4', + rightleftharpoons: '\u21CC', + rightrightarrows: '\u21C9', + rightsquigarrow: '\u219D', + rightthreetimes: '\u22CC', + ring: '\u02DA', + risingdotseq: '\u2253', + rlarr: '\u21C4', + rlhar: '\u21CC', + rlm: '\u200F', + rmoust: '\u23B1', + rmoustache: '\u23B1', + rnmid: '\u2AEE', + roang: '\u27ED', + roarr: '\u21FE', + robrk: '\u27E7', + ropar: '\u2986', + ropf: '\uD835\uDD63', + roplus: '\u2A2E', + rotimes: '\u2A35', + rpar: '\u0029', + rpargt: '\u2994', + rppolint: '\u2A12', + rrarr: '\u21C9', + rsaquo: '\u203A', + rscr: '\uD835\uDCC7', + rsh: '\u21B1', + rsqb: '\u005D', + rsquo: '\u2019', + rsquor: '\u2019', + rthree: '\u22CC', + rtimes: '\u22CA', + rtri: '\u25B9', + rtrie: '\u22B5', + rtrif: '\u25B8', + rtriltri: '\u29CE', + ruluhar: '\u2968', + rx: '\u211E', + sacute: '\u015B', + sbquo: '\u201A', + sc: '\u227B', + scE: '\u2AB4', + scap: '\u2AB8', + scaron: '\u0161', + sccue: '\u227D', + sce: '\u2AB0', + scedil: '\u015F', + scirc: '\u015D', + scnE: '\u2AB6', + scnap: '\u2ABA', + scnsim: '\u22E9', + scpolint: '\u2A13', + scsim: '\u227F', + scy: '\u0441', + sdot: '\u22C5', + sdotb: '\u22A1', + sdote: '\u2A66', + seArr: '\u21D8', + searhk: '\u2925', + searr: '\u2198', + searrow: '\u2198', + sect: '\u00A7', + semi: '\u003B', + seswar: '\u2929', + setminus: '\u2216', + setmn: '\u2216', + sext: '\u2736', + sfr: '\uD835\uDD30', + sfrown: '\u2322', + sharp: '\u266F', + shchcy: '\u0449', + shcy: '\u0448', + shortmid: '\u2223', + shortparallel: '\u2225', + shy: '\u00AD', + sigma: '\u03C3', + sigmaf: '\u03C2', + sigmav: '\u03C2', + sim: '\u223C', + simdot: '\u2A6A', + sime: '\u2243', + simeq: '\u2243', + simg: '\u2A9E', + simgE: '\u2AA0', + siml: '\u2A9D', + simlE: '\u2A9F', + simne: '\u2246', + simplus: '\u2A24', + simrarr: '\u2972', + slarr: '\u2190', + smallsetminus: '\u2216', + smashp: '\u2A33', + smeparsl: '\u29E4', + smid: '\u2223', + smile: '\u2323', + smt: '\u2AAA', + smte: '\u2AAC', + smtes: '\u2AAC\uFE00', + softcy: '\u044C', + sol: '\u002F', + solb: '\u29C4', + solbar: '\u233F', + sopf: '\uD835\uDD64', + spades: '\u2660', + spadesuit: '\u2660', + spar: '\u2225', + sqcap: '\u2293', + sqcaps: '\u2293\uFE00', + sqcup: '\u2294', + sqcups: '\u2294\uFE00', + sqsub: '\u228F', + sqsube: '\u2291', + sqsubset: '\u228F', + sqsubseteq: '\u2291', + sqsup: '\u2290', + sqsupe: '\u2292', + sqsupset: '\u2290', + sqsupseteq: '\u2292', + squ: '\u25A1', + square: '\u25A1', + squarf: '\u25AA', + squf: '\u25AA', + srarr: '\u2192', + sscr: '\uD835\uDCC8', + ssetmn: '\u2216', + ssmile: '\u2323', + sstarf: '\u22C6', + star: '\u2606', + starf: '\u2605', + straightepsilon: '\u03F5', + straightphi: '\u03D5', + strns: '\u00AF', + sub: '\u2282', + subE: '\u2AC5', + subdot: '\u2ABD', + sube: '\u2286', + subedot: '\u2AC3', + submult: '\u2AC1', + subnE: '\u2ACB', + subne: '\u228A', + subplus: '\u2ABF', + subrarr: '\u2979', + subset: '\u2282', + subseteq: '\u2286', + subseteqq: '\u2AC5', + subsetneq: '\u228A', + subsetneqq: '\u2ACB', + subsim: '\u2AC7', + subsub: '\u2AD5', + subsup: '\u2AD3', + succ: '\u227B', + succapprox: '\u2AB8', + succcurlyeq: '\u227D', + succeq: '\u2AB0', + succnapprox: '\u2ABA', + succneqq: '\u2AB6', + succnsim: '\u22E9', + succsim: '\u227F', + sum: '\u2211', + sung: '\u266A', + sup1: '\u00B9', + sup2: '\u00B2', + sup3: '\u00B3', + sup: '\u2283', + supE: '\u2AC6', + supdot: '\u2ABE', + supdsub: '\u2AD8', + supe: '\u2287', + supedot: '\u2AC4', + suphsol: '\u27C9', + suphsub: '\u2AD7', + suplarr: '\u297B', + supmult: '\u2AC2', + supnE: '\u2ACC', + supne: '\u228B', + supplus: '\u2AC0', + supset: '\u2283', + supseteq: '\u2287', + supseteqq: '\u2AC6', + supsetneq: '\u228B', + supsetneqq: '\u2ACC', + supsim: '\u2AC8', + supsub: '\u2AD4', + supsup: '\u2AD6', + swArr: '\u21D9', + swarhk: '\u2926', + swarr: '\u2199', + swarrow: '\u2199', + swnwar: '\u292A', + szlig: '\u00DF', + target: '\u2316', + tau: '\u03C4', + tbrk: '\u23B4', + tcaron: '\u0165', + tcedil: '\u0163', + tcy: '\u0442', + tdot: '\u20DB', + telrec: '\u2315', + tfr: '\uD835\uDD31', + there4: '\u2234', + therefore: '\u2234', + theta: '\u03B8', + thetasym: '\u03D1', + thetav: '\u03D1', + thickapprox: '\u2248', + thicksim: '\u223C', + thinsp: '\u2009', + thkap: '\u2248', + thksim: '\u223C', + thorn: '\u00FE', + tilde: '\u02DC', + times: '\u00D7', + timesb: '\u22A0', + timesbar: '\u2A31', + timesd: '\u2A30', + tint: '\u222D', + toea: '\u2928', + top: '\u22A4', + topbot: '\u2336', + topcir: '\u2AF1', + topf: '\uD835\uDD65', + topfork: '\u2ADA', + tosa: '\u2929', + tprime: '\u2034', + trade: '\u2122', + triangle: '\u25B5', + triangledown: '\u25BF', + triangleleft: '\u25C3', + trianglelefteq: '\u22B4', + triangleq: '\u225C', + triangleright: '\u25B9', + trianglerighteq: '\u22B5', + tridot: '\u25EC', + trie: '\u225C', + triminus: '\u2A3A', + triplus: '\u2A39', + trisb: '\u29CD', + tritime: '\u2A3B', + trpezium: '\u23E2', + tscr: '\uD835\uDCC9', + tscy: '\u0446', + tshcy: '\u045B', + tstrok: '\u0167', + twixt: '\u226C', + twoheadleftarrow: '\u219E', + twoheadrightarrow: '\u21A0', + uArr: '\u21D1', + uHar: '\u2963', + uacute: '\u00FA', + uarr: '\u2191', + ubrcy: '\u045E', + ubreve: '\u016D', + ucirc: '\u00FB', + ucy: '\u0443', + udarr: '\u21C5', + udblac: '\u0171', + udhar: '\u296E', + ufisht: '\u297E', + ufr: '\uD835\uDD32', + ugrave: '\u00F9', + uharl: '\u21BF', + uharr: '\u21BE', + uhblk: '\u2580', + ulcorn: '\u231C', + ulcorner: '\u231C', + ulcrop: '\u230F', + ultri: '\u25F8', + umacr: '\u016B', + uml: '\u00A8', + uogon: '\u0173', + uopf: '\uD835\uDD66', + uparrow: '\u2191', + updownarrow: '\u2195', + upharpoonleft: '\u21BF', + upharpoonright: '\u21BE', + uplus: '\u228E', + upsi: '\u03C5', + upsih: '\u03D2', + upsilon: '\u03C5', + upuparrows: '\u21C8', + urcorn: '\u231D', + urcorner: '\u231D', + urcrop: '\u230E', + uring: '\u016F', + urtri: '\u25F9', + uscr: '\uD835\uDCCA', + utdot: '\u22F0', + utilde: '\u0169', + utri: '\u25B5', + utrif: '\u25B4', + uuarr: '\u21C8', + uuml: '\u00FC', + uwangle: '\u29A7', + vArr: '\u21D5', + vBar: '\u2AE8', + vBarv: '\u2AE9', + vDash: '\u22A8', + vangrt: '\u299C', + varepsilon: '\u03F5', + varkappa: '\u03F0', + varnothing: '\u2205', + varphi: '\u03D5', + varpi: '\u03D6', + varpropto: '\u221D', + varr: '\u2195', + varrho: '\u03F1', + varsigma: '\u03C2', + varsubsetneq: '\u228A\uFE00', + varsubsetneqq: '\u2ACB\uFE00', + varsupsetneq: '\u228B\uFE00', + varsupsetneqq: '\u2ACC\uFE00', + vartheta: '\u03D1', + vartriangleleft: '\u22B2', + vartriangleright: '\u22B3', + vcy: '\u0432', + vdash: '\u22A2', + vee: '\u2228', + veebar: '\u22BB', + veeeq: '\u225A', + vellip: '\u22EE', + verbar: '\u007C', + vert: '\u007C', + vfr: '\uD835\uDD33', + vltri: '\u22B2', + vnsub: '\u2282\u20D2', + vnsup: '\u2283\u20D2', + vopf: '\uD835\uDD67', + vprop: '\u221D', + vrtri: '\u22B3', + vscr: '\uD835\uDCCB', + vsubnE: '\u2ACB\uFE00', + vsubne: '\u228A\uFE00', + vsupnE: '\u2ACC\uFE00', + vsupne: '\u228B\uFE00', + vzigzag: '\u299A', + wcirc: '\u0175', + wedbar: '\u2A5F', + wedge: '\u2227', + wedgeq: '\u2259', + weierp: '\u2118', + wfr: '\uD835\uDD34', + wopf: '\uD835\uDD68', + wp: '\u2118', + wr: '\u2240', + wreath: '\u2240', + wscr: '\uD835\uDCCC', + xcap: '\u22C2', + xcirc: '\u25EF', + xcup: '\u22C3', + xdtri: '\u25BD', + xfr: '\uD835\uDD35', + xhArr: '\u27FA', + xharr: '\u27F7', + xi: '\u03BE', + xlArr: '\u27F8', + xlarr: '\u27F5', + xmap: '\u27FC', + xnis: '\u22FB', + xodot: '\u2A00', + xopf: '\uD835\uDD69', + xoplus: '\u2A01', + xotime: '\u2A02', + xrArr: '\u27F9', + xrarr: '\u27F6', + xscr: '\uD835\uDCCD', + xsqcup: '\u2A06', + xuplus: '\u2A04', + xutri: '\u25B3', + xvee: '\u22C1', + xwedge: '\u22C0', + yacute: '\u00FD', + yacy: '\u044F', + ycirc: '\u0177', + ycy: '\u044B', + yen: '\u00A5', + yfr: '\uD835\uDD36', + yicy: '\u0457', + yopf: '\uD835\uDD6A', + yscr: '\uD835\uDCCE', + yucy: '\u044E', + yuml: '\u00FF', + zacute: '\u017A', + zcaron: '\u017E', + zcy: '\u0437', + zdot: '\u017C', + zeetrf: '\u2128', + zeta: '\u03B6', + zfr: '\uD835\uDD37', + zhcy: '\u0436', + zigrarr: '\u21DD', + zopf: '\uD835\uDD6B', + zscr: '\uD835\uDCCF', + zwj: '\u200D', + zwnj: '\u200C' +}; +const decodeMap = { + '0': 65533, + '128': 8364, + '130': 8218, + '131': 402, + '132': 8222, + '133': 8230, + '134': 8224, + '135': 8225, + '136': 710, + '137': 8240, + '138': 352, + '139': 8249, + '140': 338, + '142': 381, + '145': 8216, + '146': 8217, + '147': 8220, + '148': 8221, + '149': 8226, + '150': 8211, + '151': 8212, + '152': 732, + '153': 8482, + '154': 353, + '155': 8250, + '156': 339, + '158': 382, + '159': 376 +}; +function decodeHTMLStrict(text) { + return text.replace(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => { + if (key.charAt(1) === '#') { + const secondChar = key.charAt(2); + const codePoint = secondChar === 'X' || secondChar === 'x' + ? parseInt(key.slice(3), 16) + : parseInt(key.slice(2), 10); + return decodeCodePoint(codePoint); + } + return entities[key.slice(1, -1)] || key; + }); +} +function decodeCodePoint(codePoint) { + if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { + return '\uFFFD'; + } + if (codePoint in decodeMap) { + codePoint = decodeMap[codePoint]; + } + return String.fromCodePoint(codePoint); +} + +function scanJSXAttributeValue(parser, context) { + parser.startPos = parser.tokenPos = parser.index; + parser.startColumn = parser.colPos = parser.column; + parser.startLine = parser.linePos = parser.line; + parser.token = + CharTypes[parser.currentChar] & 8192 + ? scanJSXString(parser, context) + : scanSingleToken(parser, context, 0); + return parser.token; +} +function scanJSXString(parser, context) { + const quote = parser.currentChar; + let char = advanceChar(parser); + const start = parser.index; + while (char !== quote) { + if (parser.index >= parser.end) + report(parser, 14); + char = advanceChar(parser); + } + if (char !== quote) + report(parser, 14); + parser.tokenValue = parser.source.slice(start, parser.index); + advanceChar(parser); + if (context & 512) + parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); + return 134283267; +} +function scanJSXToken(parser, context) { + parser.startPos = parser.tokenPos = parser.index; + parser.startColumn = parser.colPos = parser.column; + parser.startLine = parser.linePos = parser.line; + if (parser.index >= parser.end) + return (parser.token = 1048576); + const token = TokenLookup[parser.source.charCodeAt(parser.index)]; + switch (token) { + case 8456258: { + advanceChar(parser); + if (parser.currentChar === 47) { + advanceChar(parser); + parser.token = 25; + } + else { + parser.token = 8456258; + } + break; + } + case 2162700: { + advanceChar(parser); + parser.token = 2162700; + break; + } + default: { + let state = 0; + while (parser.index < parser.end) { + const type = CharTypes[parser.source.charCodeAt(parser.index)]; + if (type & 1024) { + state |= 1 | 4; + scanNewLine(parser); + } + else if (type & 2048) { + consumeLineFeed(parser, state); + state = (state & ~4) | 1; + } + else { + advanceChar(parser); + } + if (CharTypes[parser.currentChar] & 16384) + break; + } + const raw = parser.source.slice(parser.tokenPos, parser.index); + if (context & 512) + parser.tokenRaw = raw; + parser.tokenValue = decodeHTMLStrict(raw); + parser.token = 138; + } + } + return parser.token; +} +function scanJSXIdentifier(parser) { + if ((parser.token & 143360) === 143360) { + const { index } = parser; + let char = parser.currentChar; + while (CharTypes[char] & (32768 | 2)) { + char = advanceChar(parser); + } + parser.tokenValue += parser.source.slice(index, parser.index); + } + parser.token = 208897; + return parser.token; +} + +function matchOrInsertSemicolon(parser, context, specDeviation) { + if ((parser.flags & 1) === 0 && + (parser.token & 1048576) !== 1048576 && + !specDeviation) { + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + consumeOpt(parser, context, 1074790417); +} +function isValidStrictMode(parser, index, tokenPos, tokenValue) { + if (index - tokenPos < 13 && tokenValue === 'use strict') { + if ((parser.token & 1048576) === 1048576 || parser.flags & 1) { + return 1; + } + } + return 0; +} +function optionalBit(parser, context, t) { + if (parser.token !== t) + return 0; + nextToken(parser, context); + return 1; +} +function consumeOpt(parser, context, t) { + if (parser.token !== t) + return false; + nextToken(parser, context); + return true; +} +function consume(parser, context, t) { + if (parser.token !== t) + report(parser, 23, KeywordDescTable[t & 255]); + nextToken(parser, context); +} +function reinterpretToPattern(state, node) { + switch (node.type) { + case 'ArrayExpression': + node.type = 'ArrayPattern'; + const elements = node.elements; + for (let i = 0, n = elements.length; i < n; ++i) { + const element = elements[i]; + if (element) + reinterpretToPattern(state, element); + } + return; + case 'ObjectExpression': + node.type = 'ObjectPattern'; + const properties = node.properties; + for (let i = 0, n = properties.length; i < n; ++i) { + reinterpretToPattern(state, properties[i]); + } + return; + case 'AssignmentExpression': + node.type = 'AssignmentPattern'; + if (node.operator !== '=') + report(state, 68); + delete node.operator; + reinterpretToPattern(state, node.left); + return; + case 'Property': + reinterpretToPattern(state, node.value); + return; + case 'SpreadElement': + node.type = 'RestElement'; + reinterpretToPattern(state, node.argument); + } +} +function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) { + if (context & 1024) { + if ((t & 36864) === 36864) { + report(parser, 114); + } + if (!skipEvalArgCheck && (t & 537079808) === 537079808) { + report(parser, 115); + } + } + if ((t & 20480) === 20480) { + report(parser, 99); + } + if (kind & (8 | 16) && t === 241739) { + report(parser, 97); + } + if (context & (4194304 | 2048) && t === 209008) { + report(parser, 95); + } + if (context & (2097152 | 1024) && t === 241773) { + report(parser, 94, 'yield'); + } +} +function validateFunctionName(parser, context, t) { + if (context & 1024) { + if ((t & 36864) === 36864) { + report(parser, 114); + } + if ((t & 537079808) === 537079808) { + report(parser, 115); + } + if (t === 122) { + report(parser, 92); + } + if (t === 121) { + report(parser, 92); + } + } + if ((t & 20480) === 20480) { + report(parser, 99); + } + if (context & (4194304 | 2048) && t === 209008) { + report(parser, 95); + } + if (context & (2097152 | 1024) && t === 241773) { + report(parser, 94, 'yield'); + } +} +function isStrictReservedWord(parser, context, t) { + if (t === 209008) { + if (context & (4194304 | 2048)) + report(parser, 95); + parser.destructible |= 128; + } + if (t === 241773 && context & 2097152) + report(parser, 94, 'yield'); + return ((t & 20480) === 20480 || + (t & 36864) === 36864 || + t == 122); +} +function isPropertyWithPrivateFieldKey(expr) { + return !expr.property ? false : expr.property.type === 'PrivateIdentifier'; +} +function isValidLabel(parser, labels, name, isIterationStatement) { + while (labels) { + if (labels['$' + name]) { + if (isIterationStatement) + report(parser, 133); + return 1; + } + if (isIterationStatement && labels.loop) + isIterationStatement = 0; + labels = labels['$']; + } + return 0; +} +function validateAndDeclareLabel(parser, labels, name) { + let set = labels; + while (set) { + if (set['$' + name]) + report(parser, 132, name); + set = set['$']; + } + labels['$' + name] = 1; +} +function finishNode(parser, context, start, line, column, node) { + if (context & 2) { + node.start = start; + node.end = parser.startPos; + node.range = [start, parser.startPos]; + } + if (context & 4) { + node.loc = { + start: { + line, + column + }, + end: { + line: parser.startLine, + column: parser.startColumn + } + }; + if (parser.sourceFile) { + node.loc.source = parser.sourceFile; + } + } + return node; +} +function isEqualTagName(elementName) { + switch (elementName.type) { + case 'JSXIdentifier': + return elementName.name; + case 'JSXNamespacedName': + return elementName.namespace + ':' + elementName.name; + case 'JSXMemberExpression': + return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property); + } +} +function createArrowHeadParsingScope(parser, context, value) { + const scope = addChildScope(createScope(), 1024); + addBlockName(parser, context, scope, value, 1, 0); + return scope; +} +function recordScopeError(parser, type, ...params) { + const { index, line, column } = parser; + return { + type, + params, + index, + line, + column + }; +} +function createScope() { + return { + parent: void 0, + type: 2 + }; +} +function addChildScope(parent, type) { + return { + parent, + type, + scopeError: void 0 + }; +} +function addVarOrBlock(parser, context, scope, name, kind, origin) { + if (kind & 4) { + addVarName(parser, context, scope, name, kind); + } + else { + addBlockName(parser, context, scope, name, kind, origin); + } + if (origin & 64) { + declareUnboundVariable(parser, name); + } +} +function addBlockName(parser, context, scope, name, kind, origin) { + const value = scope['#' + name]; + if (value && (value & 2) === 0) { + if (kind & 1) { + scope.scopeError = recordScopeError(parser, 140, name); + } + else if (context & 256 && + value & 64 && + origin & 2) ; + else { + report(parser, 140, name); + } + } + if (scope.type & 128 && + (scope.parent['#' + name] && (scope.parent['#' + name] & 2) === 0)) { + report(parser, 140, name); + } + if (scope.type & 1024 && value && (value & 2) === 0) { + if (kind & 1) { + scope.scopeError = recordScopeError(parser, 140, name); + } + } + if (scope.type & 64) { + if (scope.parent['#' + name] & 768) + report(parser, 153, name); + } + scope['#' + name] = kind; +} +function addVarName(parser, context, scope, name, kind) { + let currentScope = scope; + while (currentScope && (currentScope.type & 256) === 0) { + const value = currentScope['#' + name]; + if (value & 248) { + if (context & 256 && + (context & 1024) === 0 && + ((kind & 128 && value & 68) || + (value & 128 && kind & 68))) ; + else { + report(parser, 140, name); + } + } + if (currentScope === scope) { + if (value & 1 && kind & 1) { + currentScope.scopeError = recordScopeError(parser, 140, name); + } + } + if (value & (512 | 256)) { + if ((value & 512) === 0 || + (context & 256) === 0 || + context & 1024) { + report(parser, 140, name); + } + } + currentScope['#' + name] = kind; + currentScope = currentScope.parent; + } +} +function declareUnboundVariable(parser, name) { + if (parser.exportedNames !== void 0 && name !== '') { + if (parser.exportedNames['#' + name]) { + report(parser, 141, name); + } + parser.exportedNames['#' + name] = 1; + } +} +function addBindingToExports(parser, name) { + if (parser.exportedBindings !== void 0 && name !== '') { + parser.exportedBindings['#' + name] = 1; + } +} +function pushComment(context, array) { + return function (type, value, start, end, loc) { + const comment = { + type, + value + }; + if (context & 2) { + comment.start = start; + comment.end = end; + comment.range = [start, end]; + } + if (context & 4) { + comment.loc = loc; + } + array.push(comment); + }; +} +function pushToken(context, array) { + return function (token, start, end, loc) { + const tokens = { + token + }; + if (context & 2) { + tokens.start = start; + tokens.end = end; + tokens.range = [start, end]; + } + if (context & 4) { + tokens.loc = loc; + } + array.push(tokens); + }; +} +function isValidIdentifier(context, t) { + if (context & (1024 | 2097152)) { + if (context & 2048 && t === 209008) + return false; + if (context & 2097152 && t === 241773) + return false; + return (t & 143360) === 143360 || (t & 12288) === 12288; + } + return ((t & 143360) === 143360 || + (t & 12288) === 12288 || + (t & 36864) === 36864); +} +function classifyIdentifier(parser, context, t, isArrow) { + if ((t & 537079808) === 537079808) { + if (context & 1024) + report(parser, 115); + if (isArrow) + parser.flags |= 512; + } + if (!isValidIdentifier(context, t)) + report(parser, 0); +} + +function create(source, sourceFile, onComment, onToken) { + return { + source, + flags: 0, + index: 0, + line: 1, + column: 0, + startPos: 0, + end: source.length, + tokenPos: 0, + startColumn: 0, + colPos: 0, + linePos: 1, + startLine: 1, + sourceFile, + tokenValue: '', + token: 1048576, + tokenRaw: '', + tokenRegExp: void 0, + currentChar: source.charCodeAt(0), + exportedNames: [], + exportedBindings: [], + assignable: 1, + destructible: 0, + onComment, + onToken, + leadingDecorators: [] + }; +} +function parseSource(source, options, context) { + let sourceFile = ''; + let onComment; + let onToken; + if (options != null) { + if (options.module) + context |= 2048 | 1024; + if (options.next) + context |= 1; + if (options.loc) + context |= 4; + if (options.ranges) + context |= 2; + if (options.uniqueKeyInPattern) + context |= -2147483648; + if (options.lexical) + context |= 64; + if (options.webcompat) + context |= 256; + if (options.directives) + context |= 8 | 512; + if (options.globalReturn) + context |= 32; + if (options.raw) + context |= 512; + if (options.preserveParens) + context |= 128; + if (options.impliedStrict) + context |= 1024; + if (options.jsx) + context |= 16; + if (options.identifierPattern) + context |= 268435456; + if (options.specDeviation) + context |= 536870912; + if (options.source) + sourceFile = options.source; + if (options.onComment != null) { + onComment = Array.isArray(options.onComment) ? pushComment(context, options.onComment) : options.onComment; + } + if (options.onToken != null) { + onToken = Array.isArray(options.onToken) ? pushToken(context, options.onToken) : options.onToken; + } + } + const parser = create(source, sourceFile, onComment, onToken); + if (context & 1) + skipHashBang(parser); + const scope = context & 64 ? createScope() : void 0; + let body = []; + let sourceType = 'script'; + if (context & 2048) { + sourceType = 'module'; + body = parseModuleItemList(parser, context | 8192, scope); + if (scope) { + for (const key in parser.exportedBindings) { + if (key[0] === '#' && !scope[key]) + report(parser, 142, key.slice(1)); + } + } + } + else { + body = parseStatementList(parser, context | 8192, scope); + } + const node = { + type: 'Program', + sourceType, + body + }; + if (context & 2) { + node.start = 0; + node.end = source.length; + node.range = [0, source.length]; + } + if (context & 4) { + node.loc = { + start: { line: 1, column: 0 }, + end: { line: parser.line, column: parser.column } + }; + if (parser.sourceFile) + node.loc.source = sourceFile; + } + return node; +} +function parseStatementList(parser, context, scope) { + nextToken(parser, context | 32768 | 1073741824); + const statements = []; + while (parser.token === 134283267) { + const { index, tokenPos, tokenValue, linePos, colPos, token } = parser; + const expr = parseLiteral(parser, context); + if (isValidStrictMode(parser, index, tokenPos, tokenValue)) + context |= 1024; + statements.push(parseDirective(parser, context, expr, token, tokenPos, linePos, colPos)); + } + while (parser.token !== 1048576) { + statements.push(parseStatementListItem(parser, context, scope, 4, {})); + } + return statements; +} +function parseModuleItemList(parser, context, scope) { + nextToken(parser, context | 32768); + const statements = []; + if (context & 8) { + while (parser.token === 134283267) { + const { tokenPos, linePos, colPos, token } = parser; + statements.push(parseDirective(parser, context, parseLiteral(parser, context), token, tokenPos, linePos, colPos)); + } + } + while (parser.token !== 1048576) { + statements.push(parseModuleItem(parser, context, scope)); + } + return statements; +} +function parseModuleItem(parser, context, scope) { + parser.leadingDecorators = parseDecorators(parser, context); + let moduleItem; + switch (parser.token) { + case 20566: + moduleItem = parseExportDeclaration(parser, context, scope); + break; + case 86108: + moduleItem = parseImportDeclaration(parser, context, scope); + break; + default: + moduleItem = parseStatementListItem(parser, context, scope, 4, {}); + } + if (parser.leadingDecorators.length) { + report(parser, 164); + } + return moduleItem; +} +function parseStatementListItem(parser, context, scope, origin, labels) { + const start = parser.tokenPos; + const line = parser.linePos; + const column = parser.colPos; + switch (parser.token) { + case 86106: + return parseFunctionDeclaration(parser, context, scope, origin, 1, 0, 0, start, line, column); + case 133: + case 86096: + return parseClassDeclaration(parser, context, scope, 0, start, line, column); + case 86092: + return parseLexicalDeclaration(parser, context, scope, 16, 0, start, line, column); + case 241739: + return parseLetIdentOrVarDeclarationStatement(parser, context, scope, origin, start, line, column); + case 20566: + report(parser, 100, 'export'); + case 86108: + nextToken(parser, context); + switch (parser.token) { + case 67174411: + return parseImportCallDeclaration(parser, context, start, line, column); + case 67108877: + return parseImportMetaDeclaration(parser, context, start, line, column); + default: + report(parser, 100, 'import'); + } + case 209007: + return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, 1, start, line, column); + default: + return parseStatement(parser, context, scope, origin, labels, 1, start, line, column); + } +} +function parseStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { + switch (parser.token) { + case 86090: + return parseVariableStatement(parser, context, scope, 0, start, line, column); + case 20574: + return parseReturnStatement(parser, context, start, line, column); + case 20571: + return parseIfStatement(parser, context, scope, labels, start, line, column); + case 20569: + return parseForStatement(parser, context, scope, labels, start, line, column); + case 20564: + return parseDoWhileStatement(parser, context, scope, labels, start, line, column); + case 20580: + return parseWhileStatement(parser, context, scope, labels, start, line, column); + case 86112: + return parseSwitchStatement(parser, context, scope, labels, start, line, column); + case 1074790417: + return parseEmptyStatement(parser, context, start, line, column); + case 2162700: + return parseBlock(parser, context, scope ? addChildScope(scope, 2) : scope, labels, start, line, column); + case 86114: + return parseThrowStatement(parser, context, start, line, column); + case 20557: + return parseBreakStatement(parser, context, labels, start, line, column); + case 20561: + return parseContinueStatement(parser, context, labels, start, line, column); + case 20579: + return parseTryStatement(parser, context, scope, labels, start, line, column); + case 20581: + return parseWithStatement(parser, context, scope, labels, start, line, column); + case 20562: + return parseDebuggerStatement(parser, context, start, line, column); + case 209007: + return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, 0, start, line, column); + case 20559: + report(parser, 156); + case 20568: + report(parser, 157); + case 86106: + report(parser, context & 1024 + ? 73 + : (context & 256) < 1 + ? 75 + : 74); + case 86096: + report(parser, 76); + default: + return parseExpressionOrLabelledStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column); + } +} +function parseExpressionOrLabelledStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { + const { tokenValue, token } = parser; + let expr; + switch (token) { + case 241739: + expr = parseIdentifier(parser, context, 0); + if (context & 1024) + report(parser, 82); + if (parser.token === 69271571) + report(parser, 81); + break; + default: + expr = parsePrimaryExpression(parser, context, 2, 0, 1, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + } + if (token & 143360 && parser.token === 21) { + return parseLabelledStatement(parser, context, scope, origin, labels, tokenValue, expr, token, allowFuncDecl, start, line, column); + } + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); + expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); + if (parser.token === 18) { + expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); + } + return parseExpressionStatement(parser, context, expr, start, line, column); +} +function parseBlock(parser, context, scope, labels, start, line, column) { + const body = []; + consume(parser, context | 32768, 2162700); + while (parser.token !== 1074790415) { + body.push(parseStatementListItem(parser, context, scope, 2, { $: labels })); + } + consume(parser, context | 32768, 1074790415); + return finishNode(parser, context, start, line, column, { + type: 'BlockStatement', + body + }); +} +function parseReturnStatement(parser, context, start, line, column) { + if ((context & 32) < 1 && context & 8192) + report(parser, 89); + nextToken(parser, context | 32768); + const argument = parser.flags & 1 || parser.token & 1048576 + ? null + : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.line, parser.column); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ReturnStatement', + argument + }); +} +function parseExpressionStatement(parser, context, expression, start, line, column) { + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ExpressionStatement', + expression + }); +} +function parseLabelledStatement(parser, context, scope, origin, labels, value, expr, token, allowFuncDecl, start, line, column) { + validateBindingIdentifier(parser, context, 0, token, 1); + validateAndDeclareLabel(parser, labels, value); + nextToken(parser, context | 32768); + const body = allowFuncDecl && + (context & 1024) < 1 && + context & 256 && + parser.token === 86106 + ? parseFunctionDeclaration(parser, context, addChildScope(scope, 2), origin, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos) + : parseStatement(parser, context, scope, origin, labels, allowFuncDecl, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, { + type: 'LabeledStatement', + label: expr, + body + }); +} +function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { + const { token, tokenValue } = parser; + let expr = parseIdentifier(parser, context, 0); + if (parser.token === 21) { + return parseLabelledStatement(parser, context, scope, origin, labels, tokenValue, expr, token, 1, start, line, column); + } + const asyncNewLine = parser.flags & 1; + if (!asyncNewLine) { + if (parser.token === 86106) { + if (!allowFuncDecl) + report(parser, 119); + return parseFunctionDeclaration(parser, context, scope, origin, 1, 0, 1, start, line, column); + } + if ((parser.token & 143360) === 143360) { + expr = parseAsyncArrowAfterIdent(parser, context, 1, start, line, column); + if (parser.token === 18) + expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); + return parseExpressionStatement(parser, context, expr, start, line, column); + } + } + if (parser.token === 67174411) { + expr = parseAsyncArrowOrCallExpression(parser, context, expr, 1, 1, 0, asyncNewLine, start, line, column); + } + else { + if (parser.token === 10) { + classifyIdentifier(parser, context, token, 1); + expr = parseArrowFromIdentifier(parser, context, parser.tokenValue, expr, 0, 1, 0, start, line, column); + } + parser.assignable = 1; + } + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); + if (parser.token === 18) + expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); + expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); + parser.assignable = 1; + return parseExpressionStatement(parser, context, expr, start, line, column); +} +function parseDirective(parser, context, expression, token, start, line, column) { + if (token !== 1074790417) { + parser.assignable = 2; + expression = parseMemberOrUpdateExpression(parser, context, expression, 0, 0, start, line, column); + if (parser.token !== 1074790417) { + expression = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expression); + if (parser.token === 18) { + expression = parseSequenceExpression(parser, context, 0, start, line, column, expression); + } + } + matchOrInsertSemicolon(parser, context | 32768); + } + return context & 8 && expression.type === 'Literal' && typeof expression.value === 'string' + ? finishNode(parser, context, start, line, column, { + type: 'ExpressionStatement', + expression, + directive: expression.raw.slice(1, -1) + }) + : finishNode(parser, context, start, line, column, { + type: 'ExpressionStatement', + expression + }); +} +function parseEmptyStatement(parser, context, start, line, column) { + nextToken(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'EmptyStatement' + }); +} +function parseThrowStatement(parser, context, start, line, column) { + nextToken(parser, context | 32768); + if (parser.flags & 1) + report(parser, 87); + const argument = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ThrowStatement', + argument + }); +} +function parseIfStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context); + consume(parser, context | 32768, 67174411); + parser.assignable = 1; + const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.line, parser.colPos); + consume(parser, context | 32768, 16); + const consequent = parseConsequentOrAlternative(parser, context, scope, labels, parser.tokenPos, parser.linePos, parser.colPos); + let alternate = null; + if (parser.token === 20565) { + nextToken(parser, context | 32768); + alternate = parseConsequentOrAlternative(parser, context, scope, labels, parser.tokenPos, parser.linePos, parser.colPos); + } + return finishNode(parser, context, start, line, column, { + type: 'IfStatement', + test, + consequent, + alternate + }); +} +function parseConsequentOrAlternative(parser, context, scope, labels, start, line, column) { + return context & 1024 || + (context & 256) < 1 || + parser.token !== 86106 + ? parseStatement(parser, context, scope, 0, { $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos) + : parseFunctionDeclaration(parser, context, addChildScope(scope, 2), 0, 0, 0, 0, start, line, column); +} +function parseSwitchStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context); + consume(parser, context | 32768, 67174411); + const discriminant = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context, 16); + consume(parser, context, 2162700); + const cases = []; + let seenDefault = 0; + if (scope) + scope = addChildScope(scope, 8); + while (parser.token !== 1074790415) { + const { tokenPos, linePos, colPos } = parser; + let test = null; + const consequent = []; + if (consumeOpt(parser, context | 32768, 20558)) { + test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + consume(parser, context | 32768, 20563); + if (seenDefault) + report(parser, 86); + seenDefault = 1; + } + consume(parser, context | 32768, 21); + while (parser.token !== 20558 && + parser.token !== 1074790415 && + parser.token !== 20563) { + consequent.push(parseStatementListItem(parser, context | 4096, scope, 2, { + $: labels + })); + } + cases.push(finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'SwitchCase', + test, + consequent + })); + } + consume(parser, context | 32768, 1074790415); + return finishNode(parser, context, start, line, column, { + type: 'SwitchStatement', + discriminant, + cases + }); +} +function parseWhileStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context); + consume(parser, context | 32768, 67174411); + const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + const body = parseIterationStatementBody(parser, context, scope, labels); + return finishNode(parser, context, start, line, column, { + type: 'WhileStatement', + test, + body + }); +} +function parseIterationStatementBody(parser, context, scope, labels) { + return parseStatement(parser, ((context | 134217728) ^ 134217728) | 131072, scope, 0, { loop: 1, $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos); +} +function parseContinueStatement(parser, context, labels, start, line, column) { + if ((context & 131072) < 1) + report(parser, 65); + nextToken(parser, context); + let label = null; + if ((parser.flags & 1) < 1 && parser.token & 143360) { + const { tokenValue } = parser; + label = parseIdentifier(parser, context | 32768, 0); + if (!isValidLabel(parser, labels, tokenValue, 1)) + report(parser, 134, tokenValue); + } + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ContinueStatement', + label + }); +} +function parseBreakStatement(parser, context, labels, start, line, column) { + nextToken(parser, context | 32768); + let label = null; + if ((parser.flags & 1) < 1 && parser.token & 143360) { + const { tokenValue } = parser; + label = parseIdentifier(parser, context | 32768, 0); + if (!isValidLabel(parser, labels, tokenValue, 0)) + report(parser, 134, tokenValue); + } + else if ((context & (4096 | 131072)) < 1) { + report(parser, 66); + } + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'BreakStatement', + label + }); +} +function parseWithStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context); + if (context & 1024) + report(parser, 88); + consume(parser, context | 32768, 67174411); + const object = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + const body = parseStatement(parser, context, scope, 2, labels, 0, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, { + type: 'WithStatement', + object, + body + }); +} +function parseDebuggerStatement(parser, context, start, line, column) { + nextToken(parser, context | 32768); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'DebuggerStatement' + }); +} +function parseTryStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context | 32768); + const firstScope = scope ? addChildScope(scope, 32) : void 0; + const block = parseBlock(parser, context, firstScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); + const { tokenPos, linePos, colPos } = parser; + const handler = consumeOpt(parser, context | 32768, 20559) + ? parseCatchBlock(parser, context, scope, labels, tokenPos, linePos, colPos) + : null; + let finalizer = null; + if (parser.token === 20568) { + nextToken(parser, context | 32768); + const finalizerScope = firstScope ? addChildScope(scope, 4) : void 0; + finalizer = parseBlock(parser, context, finalizerScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); + } + if (!handler && !finalizer) { + report(parser, 85); + } + return finishNode(parser, context, start, line, column, { + type: 'TryStatement', + block, + handler, + finalizer + }); +} +function parseCatchBlock(parser, context, scope, labels, start, line, column) { + let param = null; + let additionalScope = scope; + if (consumeOpt(parser, context, 67174411)) { + if (scope) + scope = addChildScope(scope, 4); + param = parseBindingPattern(parser, context, scope, (parser.token & 2097152) === 2097152 + ? 256 + : 512, 0, parser.tokenPos, parser.linePos, parser.colPos); + if (parser.token === 18) { + report(parser, 83); + } + else if (parser.token === 1077936157) { + report(parser, 84); + } + consume(parser, context | 32768, 16); + if (scope) + additionalScope = addChildScope(scope, 64); + } + const body = parseBlock(parser, context, additionalScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, { + type: 'CatchClause', + param, + body + }); +} +function parseDoWhileStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context | 32768); + const body = parseIterationStatementBody(parser, context, scope, labels); + consume(parser, context, 20580); + consume(parser, context | 32768, 67174411); + const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + consumeOpt(parser, context, 1074790417); + return finishNode(parser, context, start, line, column, { + type: 'DoWhileStatement', + body, + test + }); +} +function parseLetIdentOrVarDeclarationStatement(parser, context, scope, origin, start, line, column) { + const { token, tokenValue } = parser; + let expr = parseIdentifier(parser, context, 0); + if (parser.token & (143360 | 2097152)) { + const declarations = parseVariableDeclarationList(parser, context, scope, 8, 0); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'VariableDeclaration', + kind: 'let', + declarations + }); + } + parser.assignable = 1; + if (context & 1024) + report(parser, 82); + if (parser.token === 21) { + return parseLabelledStatement(parser, context, scope, origin, {}, tokenValue, expr, token, 0, start, line, column); + } + if (parser.token === 10) { + let scope = void 0; + if (context & 64) + scope = createArrowHeadParsingScope(parser, context, tokenValue); + parser.flags = (parser.flags | 128) ^ 128; + expr = parseArrowFunctionExpression(parser, context, scope, [expr], 0, start, line, column); + } + else { + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); + expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); + } + if (parser.token === 18) { + expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); + } + return parseExpressionStatement(parser, context, expr, start, line, column); +} +function parseLexicalDeclaration(parser, context, scope, kind, origin, start, line, column) { + nextToken(parser, context); + const declarations = parseVariableDeclarationList(parser, context, scope, kind, origin); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'VariableDeclaration', + kind: kind & 8 ? 'let' : 'const', + declarations + }); +} +function parseVariableStatement(parser, context, scope, origin, start, line, column) { + nextToken(parser, context); + const declarations = parseVariableDeclarationList(parser, context, scope, 4, origin); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'VariableDeclaration', + kind: 'var', + declarations + }); +} +function parseVariableDeclarationList(parser, context, scope, kind, origin) { + let bindingCount = 1; + const list = [parseVariableDeclaration(parser, context, scope, kind, origin)]; + while (consumeOpt(parser, context, 18)) { + bindingCount++; + list.push(parseVariableDeclaration(parser, context, scope, kind, origin)); + } + if (bindingCount > 1 && origin & 32 && parser.token & 262144) { + report(parser, 58, KeywordDescTable[parser.token & 255]); + } + return list; +} +function parseVariableDeclaration(parser, context, scope, kind, origin) { + const { token, tokenPos, linePos, colPos } = parser; + let init = null; + const id = parseBindingPattern(parser, context, scope, kind, origin, tokenPos, linePos, colPos); + if (parser.token === 1077936157) { + nextToken(parser, context | 32768); + init = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + if (origin & 32 || (token & 2097152) < 1) { + if (parser.token === 274549 || + (parser.token === 8738868 && + (token & 2097152 || (kind & 4) < 1 || context & 1024))) { + reportMessageAt(tokenPos, parser.line, parser.index - 3, 57, parser.token === 274549 ? 'of' : 'in'); + } + } + } + else if ((kind & 16 || (token & 2097152) > 0) && + (parser.token & 262144) !== 262144) { + report(parser, 56, kind & 16 ? 'const' : 'destructuring'); + } + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'VariableDeclarator', + id, + init + }); +} +function parseForStatement(parser, context, scope, labels, start, line, column) { + nextToken(parser, context); + const forAwait = (context & 4194304) > 0 && consumeOpt(parser, context, 209008); + consume(parser, context | 32768, 67174411); + if (scope) + scope = addChildScope(scope, 1); + let test = null; + let update = null; + let destructible = 0; + let init = null; + let isVarDecl = parser.token === 86090 || parser.token === 241739 || parser.token === 86092; + let right; + const { token, tokenPos, linePos, colPos } = parser; + if (isVarDecl) { + if (token === 241739) { + init = parseIdentifier(parser, context, 0); + if (parser.token & (143360 | 2097152)) { + if (parser.token === 8738868) { + if (context & 1024) + report(parser, 64); + } + else { + init = finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'VariableDeclaration', + kind: 'let', + declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 8, 32) + }); + } + parser.assignable = 1; + } + else if (context & 1024) { + report(parser, 64); + } + else { + isVarDecl = false; + parser.assignable = 1; + init = parseMemberOrUpdateExpression(parser, context, init, 0, 0, tokenPos, linePos, colPos); + if (parser.token === 274549) + report(parser, 111); + } + } + else { + nextToken(parser, context); + init = finishNode(parser, context, tokenPos, linePos, colPos, token === 86090 + ? { + type: 'VariableDeclaration', + kind: 'var', + declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 4, 32) + } + : { + type: 'VariableDeclaration', + kind: 'const', + declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 16, 32) + }); + parser.assignable = 1; + } + } + else if (token === 1074790417) { + if (forAwait) + report(parser, 79); + } + else if ((token & 2097152) === 2097152) { + init = + token === 2162700 + ? parseObjectLiteralOrPattern(parser, context, void 0, 1, 0, 0, 2, 32, tokenPos, linePos, colPos) + : parseArrayExpressionOrPattern(parser, context, void 0, 1, 0, 0, 2, 32, tokenPos, linePos, colPos); + destructible = parser.destructible; + if (context & 256 && destructible & 64) { + report(parser, 60); + } + parser.assignable = + destructible & 16 ? 2 : 1; + init = parseMemberOrUpdateExpression(parser, context | 134217728, init, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + init = parseLeftHandSideExpression(parser, context | 134217728, 1, 0, 1, tokenPos, linePos, colPos); + } + if ((parser.token & 262144) === 262144) { + if (parser.token === 274549) { + if (parser.assignable & 2) + report(parser, 77, forAwait ? 'await' : 'of'); + reinterpretToPattern(parser, init); + nextToken(parser, context | 32768); + right = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + const body = parseIterationStatementBody(parser, context, scope, labels); + return finishNode(parser, context, start, line, column, { + type: 'ForOfStatement', + left: init, + right, + body, + await: forAwait + }); + } + if (parser.assignable & 2) + report(parser, 77, 'in'); + reinterpretToPattern(parser, init); + nextToken(parser, context | 32768); + if (forAwait) + report(parser, 79); + right = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + const body = parseIterationStatementBody(parser, context, scope, labels); + return finishNode(parser, context, start, line, column, { + type: 'ForInStatement', + body, + left: init, + right + }); + } + if (forAwait) + report(parser, 79); + if (!isVarDecl) { + if (destructible & 8 && parser.token !== 1077936157) { + report(parser, 77, 'loop'); + } + init = parseAssignmentExpression(parser, context | 134217728, 0, 0, tokenPos, linePos, colPos, init); + } + if (parser.token === 18) + init = parseSequenceExpression(parser, context, 0, parser.tokenPos, parser.linePos, parser.colPos, init); + consume(parser, context | 32768, 1074790417); + if (parser.token !== 1074790417) + test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 1074790417); + if (parser.token !== 16) + update = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 16); + const body = parseIterationStatementBody(parser, context, scope, labels); + return finishNode(parser, context, start, line, column, { + type: 'ForStatement', + init, + test, + update, + body + }); +} +function parseRestrictedIdentifier(parser, context, scope) { + if (!isValidIdentifier(context, parser.token)) + report(parser, 114); + if ((parser.token & 537079808) === 537079808) + report(parser, 115); + if (scope) + addBlockName(parser, context, scope, parser.tokenValue, 8, 0); + return parseIdentifier(parser, context, 0); +} +function parseImportDeclaration(parser, context, scope) { + const start = parser.tokenPos; + const line = parser.linePos; + const column = parser.colPos; + nextToken(parser, context); + let source = null; + const { tokenPos, linePos, colPos } = parser; + let specifiers = []; + if (parser.token === 134283267) { + source = parseLiteral(parser, context); + } + else { + if (parser.token & 143360) { + const local = parseRestrictedIdentifier(parser, context, scope); + specifiers = [ + finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ImportDefaultSpecifier', + local + }) + ]; + if (consumeOpt(parser, context, 18)) { + switch (parser.token) { + case 8457014: + specifiers.push(parseImportNamespaceSpecifier(parser, context, scope)); + break; + case 2162700: + parseImportSpecifierOrNamedImports(parser, context, scope, specifiers); + break; + default: + report(parser, 104); + } + } + } + else { + switch (parser.token) { + case 8457014: + specifiers = [parseImportNamespaceSpecifier(parser, context, scope)]; + break; + case 2162700: + parseImportSpecifierOrNamedImports(parser, context, scope, specifiers); + break; + case 67174411: + return parseImportCallDeclaration(parser, context, start, line, column); + case 67108877: + return parseImportMetaDeclaration(parser, context, start, line, column); + default: + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + } + source = parseModuleSpecifier(parser, context); + } + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ImportDeclaration', + specifiers, + source + }); +} +function parseImportNamespaceSpecifier(parser, context, scope) { + const { tokenPos, linePos, colPos } = parser; + nextToken(parser, context); + consume(parser, context, 77934); + if ((parser.token & 134217728) === 134217728) { + reportMessageAt(tokenPos, parser.line, parser.index, 28, KeywordDescTable[parser.token & 255]); + } + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ImportNamespaceSpecifier', + local: parseRestrictedIdentifier(parser, context, scope) + }); +} +function parseModuleSpecifier(parser, context) { + consumeOpt(parser, context, 12404); + if (parser.token !== 134283267) + report(parser, 102, 'Import'); + return parseLiteral(parser, context); +} +function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers) { + nextToken(parser, context); + while (parser.token & 143360) { + let { token, tokenValue, tokenPos, linePos, colPos } = parser; + const imported = parseIdentifier(parser, context, 0); + let local; + if (consumeOpt(parser, context, 77934)) { + if ((parser.token & 134217728) === 134217728 || parser.token === 18) { + report(parser, 103); + } + else { + validateBindingIdentifier(parser, context, 16, parser.token, 0); + } + tokenValue = parser.tokenValue; + local = parseIdentifier(parser, context, 0); + } + else { + validateBindingIdentifier(parser, context, 16, token, 0); + local = imported; + } + if (scope) + addBlockName(parser, context, scope, tokenValue, 8, 0); + specifiers.push(finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ImportSpecifier', + local, + imported + })); + if (parser.token !== 1074790415) + consume(parser, context, 18); + } + consume(parser, context, 1074790415); + return specifiers; +} +function parseImportMetaDeclaration(parser, context, start, line, column) { + let expr = parseImportMetaExpression(parser, context, finishNode(parser, context, start, line, column, { + type: 'Identifier', + name: 'import' + }), start, line, column); + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); + expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); + return parseExpressionStatement(parser, context, expr, start, line, column); +} +function parseImportCallDeclaration(parser, context, start, line, column) { + let expr = parseImportExpression(parser, context, 0, start, line, column); + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); + return parseExpressionStatement(parser, context, expr, start, line, column); +} +function parseExportDeclaration(parser, context, scope) { + const start = parser.tokenPos; + const line = parser.linePos; + const column = parser.colPos; + nextToken(parser, context | 32768); + const specifiers = []; + let declaration = null; + let source = null; + let key; + if (consumeOpt(parser, context | 32768, 20563)) { + switch (parser.token) { + case 86106: { + declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 0, parser.tokenPos, parser.linePos, parser.colPos); + break; + } + case 133: + case 86096: + declaration = parseClassDeclaration(parser, context, scope, 1, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 209007: + const { tokenPos, linePos, colPos } = parser; + declaration = parseIdentifier(parser, context, 0); + const { flags } = parser; + if ((flags & 1) < 1) { + if (parser.token === 86106) { + declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 1, tokenPos, linePos, colPos); + } + else { + if (parser.token === 67174411) { + declaration = parseAsyncArrowOrCallExpression(parser, context, declaration, 1, 1, 0, flags, tokenPos, linePos, colPos); + declaration = parseMemberOrUpdateExpression(parser, context, declaration, 0, 0, tokenPos, linePos, colPos); + declaration = parseAssignmentExpression(parser, context, 0, 0, tokenPos, linePos, colPos, declaration); + } + else if (parser.token & 143360) { + if (scope) + scope = createArrowHeadParsingScope(parser, context, parser.tokenValue); + declaration = parseIdentifier(parser, context, 0); + declaration = parseArrowFunctionExpression(parser, context, scope, [declaration], 1, tokenPos, linePos, colPos); + } + } + } + break; + default: + declaration = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + matchOrInsertSemicolon(parser, context | 32768); + } + if (scope) + declareUnboundVariable(parser, 'default'); + return finishNode(parser, context, start, line, column, { + type: 'ExportDefaultDeclaration', + declaration + }); + } + switch (parser.token) { + case 8457014: { + nextToken(parser, context); + let exported = null; + const isNamedDeclaration = consumeOpt(parser, context, 77934); + if (isNamedDeclaration) { + if (scope) + declareUnboundVariable(parser, parser.tokenValue); + exported = parseIdentifier(parser, context, 0); + } + consume(parser, context, 12404); + if (parser.token !== 134283267) + report(parser, 102, 'Export'); + source = parseLiteral(parser, context); + matchOrInsertSemicolon(parser, context | 32768); + return finishNode(parser, context, start, line, column, { + type: 'ExportAllDeclaration', + source, + exported + }); + } + case 2162700: { + nextToken(parser, context); + const tmpExportedNames = []; + const tmpExportedBindings = []; + while (parser.token & 143360) { + const { tokenPos, tokenValue, linePos, colPos } = parser; + const local = parseIdentifier(parser, context, 0); + let exported; + if (parser.token === 77934) { + nextToken(parser, context); + if ((parser.token & 134217728) === 134217728) { + report(parser, 103); + } + if (scope) { + tmpExportedNames.push(parser.tokenValue); + tmpExportedBindings.push(tokenValue); + } + exported = parseIdentifier(parser, context, 0); + } + else { + if (scope) { + tmpExportedNames.push(parser.tokenValue); + tmpExportedBindings.push(parser.tokenValue); + } + exported = local; + } + specifiers.push(finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ExportSpecifier', + local, + exported + })); + if (parser.token !== 1074790415) + consume(parser, context, 18); + } + consume(parser, context, 1074790415); + if (consumeOpt(parser, context, 12404)) { + if (parser.token !== 134283267) + report(parser, 102, 'Export'); + source = parseLiteral(parser, context); + } + else if (scope) { + let i = 0; + let iMax = tmpExportedNames.length; + for (; i < iMax; i++) { + declareUnboundVariable(parser, tmpExportedNames[i]); + } + i = 0; + iMax = tmpExportedBindings.length; + for (; i < iMax; i++) { + addBindingToExports(parser, tmpExportedBindings[i]); + } + } + matchOrInsertSemicolon(parser, context | 32768); + break; + } + case 86096: + declaration = parseClassDeclaration(parser, context, scope, 2, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 86106: + declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 0, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 241739: + declaration = parseLexicalDeclaration(parser, context, scope, 8, 64, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 86092: + declaration = parseLexicalDeclaration(parser, context, scope, 16, 64, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 86090: + declaration = parseVariableStatement(parser, context, scope, 64, parser.tokenPos, parser.linePos, parser.colPos); + break; + case 209007: + const { tokenPos, linePos, colPos } = parser; + nextToken(parser, context); + if ((parser.flags & 1) < 1 && parser.token === 86106) { + declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 1, tokenPos, linePos, colPos); + if (scope) { + key = declaration.id ? declaration.id.name : ''; + declareUnboundVariable(parser, key); + } + break; + } + default: + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + return finishNode(parser, context, start, line, column, { + type: 'ExportNamedDeclaration', + declaration, + specifiers, + source + }); +} +function parseExpression(parser, context, canAssign, isPattern, inGroup, start, line, column) { + let expr = parsePrimaryExpression(parser, context, 2, 0, canAssign, isPattern, inGroup, 1, start, line, column); + expr = parseMemberOrUpdateExpression(parser, context, expr, inGroup, 0, start, line, column); + return parseAssignmentExpression(parser, context, inGroup, 0, start, line, column, expr); +} +function parseSequenceExpression(parser, context, inGroup, start, line, column, expr) { + const expressions = [expr]; + while (consumeOpt(parser, context | 32768, 18)) { + expressions.push(parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); + } + return finishNode(parser, context, start, line, column, { + type: 'SequenceExpression', + expressions + }); +} +function parseExpressions(parser, context, inGroup, canAssign, start, line, column) { + const expr = parseExpression(parser, context, canAssign, 0, inGroup, start, line, column); + return parser.token === 18 + ? parseSequenceExpression(parser, context, inGroup, start, line, column, expr) + : expr; +} +function parseAssignmentExpression(parser, context, inGroup, isPattern, start, line, column, left) { + const { token } = parser; + if ((token & 4194304) === 4194304) { + if (parser.assignable & 2) + report(parser, 24); + if ((!isPattern && token === 1077936157 && left.type === 'ArrayExpression') || + left.type === 'ObjectExpression') { + reinterpretToPattern(parser, left); + } + nextToken(parser, context | 32768); + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, isPattern + ? { + type: 'AssignmentPattern', + left, + right + } + : { + type: 'AssignmentExpression', + left, + operator: KeywordDescTable[token & 255], + right + }); + } + if ((token & 8454144) === 8454144) { + left = parseBinaryExpression(parser, context, inGroup, start, line, column, 4, token, left); + } + if (consumeOpt(parser, context | 32768, 22)) { + left = parseConditionalExpression(parser, context, left, start, line, column); + } + return left; +} +function parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, start, line, column, left) { + const { token } = parser; + nextToken(parser, context | 32768); + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + left = finishNode(parser, context, start, line, column, isPattern + ? { + type: 'AssignmentPattern', + left, + right + } + : { + type: 'AssignmentExpression', + left, + operator: KeywordDescTable[token & 255], + right + }); + parser.assignable = 2; + return left; +} +function parseConditionalExpression(parser, context, test, start, line, column) { + const consequent = parseExpression(parser, (context | 134217728) ^ 134217728, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context | 32768, 21); + parser.assignable = 1; + const alternate = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'ConditionalExpression', + test, + consequent, + alternate + }); +} +function parseBinaryExpression(parser, context, inGroup, start, line, column, minPrec, operator, left) { + const bit = -((context & 134217728) > 0) & 8738868; + let t; + let prec; + parser.assignable = 2; + while (parser.token & 8454144) { + t = parser.token; + prec = t & 3840; + if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) { + report(parser, 159); + } + if (prec + ((t === 8457273) << 8) - ((bit === t) << 12) <= minPrec) + break; + nextToken(parser, context | 32768); + left = finishNode(parser, context, start, line, column, { + type: t & 524288 || t & 268435456 ? 'LogicalExpression' : 'BinaryExpression', + left, + right: parseBinaryExpression(parser, context, inGroup, parser.tokenPos, parser.linePos, parser.colPos, prec, t, parseLeftHandSideExpression(parser, context, 0, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos)), + operator: KeywordDescTable[t & 255] + }); + } + if (parser.token === 1077936157) + report(parser, 24); + return left; +} +function parseUnaryExpression(parser, context, isLHS, start, line, column, inGroup) { + if (!isLHS) + report(parser, 0); + const unaryOperator = parser.token; + nextToken(parser, context | 32768); + const arg = parseLeftHandSideExpression(parser, context, 0, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos); + if (parser.token === 8457273) + report(parser, 31); + if (context & 1024 && unaryOperator === 16863278) { + if (arg.type === 'Identifier') { + report(parser, 117); + } + else if (isPropertyWithPrivateFieldKey(arg)) { + report(parser, 123); + } + } + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'UnaryExpression', + operator: KeywordDescTable[unaryOperator & 255], + argument: arg, + prefix: true + }); +} +function parseAsyncExpression(parser, context, inGroup, isLHS, canAssign, isPattern, inNew, start, line, column) { + const { token } = parser; + const expr = parseIdentifier(parser, context, isPattern); + const { flags } = parser; + if ((flags & 1) < 1) { + if (parser.token === 86106) { + return parseFunctionExpression(parser, context, 1, inGroup, start, line, column); + } + if ((parser.token & 143360) === 143360) { + if (!isLHS) + report(parser, 0); + return parseAsyncArrowAfterIdent(parser, context, canAssign, start, line, column); + } + } + if (!inNew && parser.token === 67174411) { + return parseAsyncArrowOrCallExpression(parser, context, expr, canAssign, 1, 0, flags, start, line, column); + } + if (parser.token === 10) { + classifyIdentifier(parser, context, token, 1); + if (inNew) + report(parser, 48); + return parseArrowFromIdentifier(parser, context, parser.tokenValue, expr, inNew, canAssign, 0, start, line, column); + } + return expr; +} +function parseYieldExpression(parser, context, inGroup, canAssign, start, line, column) { + if (inGroup) + parser.destructible |= 256; + if (context & 2097152) { + nextToken(parser, context | 32768); + if (context & 8388608) + report(parser, 30); + if (!canAssign) + report(parser, 24); + if (parser.token === 22) + report(parser, 120); + let argument = null; + let delegate = false; + if ((parser.flags & 1) < 1) { + delegate = consumeOpt(parser, context | 32768, 8457014); + if (parser.token & (12288 | 65536) || delegate) { + argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + } + } + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'YieldExpression', + argument, + delegate + }); + } + if (context & 1024) + report(parser, 94, 'yield'); + return parseIdentifierOrArrow(parser, context, start, line, column); +} +function parseAwaitExpression(parser, context, inNew, inGroup, start, line, column) { + if (inGroup) + parser.destructible |= 128; + if (context & 4194304 || (context & 2048 && context & 8192)) { + if (inNew) + report(parser, 0); + if (context & 8388608) { + reportMessageAt(parser.index, parser.line, parser.index, 29); + } + nextToken(parser, context | 32768); + const argument = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + if (parser.token === 8457273) + report(parser, 31); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'AwaitExpression', + argument + }); + } + if (context & 2048) + report(parser, 95); + return parseIdentifierOrArrow(parser, context, start, line, column); +} +function parseFunctionBody(parser, context, scope, origin, firstRestricted, scopeError) { + const { tokenPos, linePos, colPos } = parser; + consume(parser, context | 32768, 2162700); + const body = []; + const prevContext = context; + if (parser.token !== 1074790415) { + while (parser.token === 134283267) { + const { index, tokenPos, tokenValue, token } = parser; + const expr = parseLiteral(parser, context); + if (isValidStrictMode(parser, index, tokenPos, tokenValue)) { + context |= 1024; + if (parser.flags & 128) { + reportMessageAt(parser.index, parser.line, parser.tokenPos, 63); + } + if (parser.flags & 64) { + reportMessageAt(parser.index, parser.line, parser.tokenPos, 8); + } + } + body.push(parseDirective(parser, context, expr, token, tokenPos, parser.linePos, parser.colPos)); + } + if (context & 1024) { + if (firstRestricted) { + if ((firstRestricted & 537079808) === 537079808) { + report(parser, 115); + } + if ((firstRestricted & 36864) === 36864) { + report(parser, 38); + } + } + if (parser.flags & 512) + report(parser, 115); + if (parser.flags & 256) + report(parser, 114); + } + if (context & 64 && + scope && + scopeError !== void 0 && + (prevContext & 1024) < 1 && + (context & 8192) < 1) { + reportScopeError(scopeError); + } + } + parser.flags = + (parser.flags | 512 | 256 | 64) ^ + (512 | 256 | 64); + parser.destructible = (parser.destructible | 256) ^ 256; + while (parser.token !== 1074790415) { + body.push(parseStatementListItem(parser, context, scope, 4, {})); + } + consume(parser, origin & (16 | 8) ? context | 32768 : context, 1074790415); + parser.flags &= ~(128 | 64); + if (parser.token === 1077936157) + report(parser, 24); + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'BlockStatement', + body + }); +} +function parseSuperExpression(parser, context, start, line, column) { + nextToken(parser, context); + switch (parser.token) { + case 67108991: + report(parser, 161); + case 67174411: { + if ((context & 524288) < 1) + report(parser, 26); + if (context & 16384) + report(parser, 143); + parser.assignable = 2; + break; + } + case 69271571: + case 67108877: { + if ((context & 262144) < 1) + report(parser, 27); + if (context & 16384) + report(parser, 143); + parser.assignable = 1; + break; + } + default: + report(parser, 28, 'super'); + } + return finishNode(parser, context, start, line, column, { type: 'Super' }); +} +function parseLeftHandSideExpression(parser, context, canAssign, inGroup, isLHS, start, line, column) { + const expression = parsePrimaryExpression(parser, context, 2, 0, canAssign, 0, inGroup, isLHS, start, line, column); + return parseMemberOrUpdateExpression(parser, context, expression, inGroup, 0, start, line, column); +} +function parseUpdateExpression(parser, context, expr, start, line, column) { + if (parser.assignable & 2) + report(parser, 52); + const { token } = parser; + nextToken(parser, context); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'UpdateExpression', + argument: expr, + operator: KeywordDescTable[token & 255], + prefix: false + }); +} +function parseMemberOrUpdateExpression(parser, context, expr, inGroup, inChain, start, line, column) { + if ((parser.token & 33619968) === 33619968 && (parser.flags & 1) < 1) { + expr = parseUpdateExpression(parser, context, expr, start, line, column); + } + else if ((parser.token & 67108864) === 67108864) { + context = (context | 134217728 | 8192) ^ (134217728 | 8192); + switch (parser.token) { + case 67108877: { + nextToken(parser, context | 1073741824); + parser.assignable = 1; + const property = parsePropertyOrPrivatePropertyName(parser, context); + expr = finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: false, + property + }); + break; + } + case 69271571: { + let restoreHasOptionalChaining = false; + if ((parser.flags & 2048) === 2048) { + restoreHasOptionalChaining = true; + parser.flags = (parser.flags | 2048) ^ 2048; + } + nextToken(parser, context | 32768); + const { tokenPos, linePos, colPos } = parser; + const property = parseExpressions(parser, context, inGroup, 1, tokenPos, linePos, colPos); + consume(parser, context, 20); + parser.assignable = 1; + expr = finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: true, + property + }); + if (restoreHasOptionalChaining) { + parser.flags |= 2048; + } + break; + } + case 67174411: { + if ((parser.flags & 1024) === 1024) { + parser.flags = (parser.flags | 1024) ^ 1024; + return expr; + } + let restoreHasOptionalChaining = false; + if ((parser.flags & 2048) === 2048) { + restoreHasOptionalChaining = true; + parser.flags = (parser.flags | 2048) ^ 2048; + } + const args = parseArguments(parser, context, inGroup); + parser.assignable = 2; + expr = finishNode(parser, context, start, line, column, { + type: 'CallExpression', + callee: expr, + arguments: args + }); + if (restoreHasOptionalChaining) { + parser.flags |= 2048; + } + break; + } + case 67108991: { + nextToken(parser, context); + parser.flags |= 2048; + parser.assignable = 2; + expr = parseOptionalChain(parser, context, expr, start, line, column); + break; + } + default: + if ((parser.flags & 2048) === 2048) { + report(parser, 160); + } + parser.assignable = 2; + expr = finishNode(parser, context, start, line, column, { + type: 'TaggedTemplateExpression', + tag: expr, + quasi: parser.token === 67174408 + ? parseTemplate(parser, context | 65536) + : parseTemplateLiteral(parser, context, parser.tokenPos, parser.linePos, parser.colPos) + }); + } + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 1, start, line, column); + } + if (inChain === 0 && (parser.flags & 2048) === 2048) { + parser.flags = (parser.flags | 2048) ^ 2048; + expr = finishNode(parser, context, start, line, column, { + type: 'ChainExpression', + expression: expr + }); + } + return expr; +} +function parseOptionalChain(parser, context, expr, start, line, column) { + let restoreHasOptionalChaining = false; + let node; + if (parser.token === 69271571 || parser.token === 67174411) { + if ((parser.flags & 2048) === 2048) { + restoreHasOptionalChaining = true; + parser.flags = (parser.flags | 2048) ^ 2048; + } + } + if (parser.token === 69271571) { + nextToken(parser, context | 32768); + const { tokenPos, linePos, colPos } = parser; + const property = parseExpressions(parser, context, 0, 1, tokenPos, linePos, colPos); + consume(parser, context, 20); + parser.assignable = 2; + node = finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: true, + optional: true, + property + }); + } + else if (parser.token === 67174411) { + const args = parseArguments(parser, context, 0); + parser.assignable = 2; + node = finishNode(parser, context, start, line, column, { + type: 'CallExpression', + callee: expr, + arguments: args, + optional: true + }); + } + else { + if ((parser.token & (143360 | 4096)) < 1) + report(parser, 154); + const property = parseIdentifier(parser, context, 0); + parser.assignable = 2; + node = finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: false, + optional: true, + property + }); + } + if (restoreHasOptionalChaining) { + parser.flags |= 2048; + } + return node; +} +function parsePropertyOrPrivatePropertyName(parser, context) { + if ((parser.token & (143360 | 4096)) < 1 && parser.token !== 131) { + report(parser, 154); + } + return context & 1 && parser.token === 131 + ? parsePrivateIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos) + : parseIdentifier(parser, context, 0); +} +function parseUpdateExpressionPrefixed(parser, context, inNew, isLHS, start, line, column) { + if (inNew) + report(parser, 53); + if (!isLHS) + report(parser, 0); + const { token } = parser; + nextToken(parser, context | 32768); + const arg = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); + if (parser.assignable & 2) { + report(parser, 52); + } + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'UpdateExpression', + argument: arg, + operator: KeywordDescTable[token & 255], + prefix: true + }); +} +function parsePrimaryExpression(parser, context, kind, inNew, canAssign, isPattern, inGroup, isLHS, start, line, column) { + if ((parser.token & 143360) === 143360) { + switch (parser.token) { + case 209008: + return parseAwaitExpression(parser, context, inNew, inGroup, start, line, column); + case 241773: + return parseYieldExpression(parser, context, inGroup, canAssign, start, line, column); + case 209007: + return parseAsyncExpression(parser, context, inGroup, isLHS, canAssign, isPattern, inNew, start, line, column); + } + const { token, tokenValue } = parser; + const expr = parseIdentifier(parser, context | 65536, isPattern); + if (parser.token === 10) { + if (!isLHS) + report(parser, 0); + classifyIdentifier(parser, context, token, 1); + return parseArrowFromIdentifier(parser, context, tokenValue, expr, inNew, canAssign, 0, start, line, column); + } + if (context & 16384 && token === 537079928) + report(parser, 126); + if (token === 241739) { + if (context & 1024) + report(parser, 109); + if (kind & (8 | 16)) + report(parser, 97); + } + parser.assignable = + context & 1024 && (token & 537079808) === 537079808 + ? 2 + : 1; + return expr; + } + if ((parser.token & 134217728) === 134217728) { + return parseLiteral(parser, context); + } + switch (parser.token) { + case 33619995: + case 33619996: + return parseUpdateExpressionPrefixed(parser, context, inNew, isLHS, start, line, column); + case 16863278: + case 16842800: + case 16842801: + case 25233970: + case 25233971: + case 16863277: + case 16863279: + return parseUnaryExpression(parser, context, isLHS, start, line, column, inGroup); + case 86106: + return parseFunctionExpression(parser, context, 0, inGroup, start, line, column); + case 2162700: + return parseObjectLiteral(parser, context, canAssign ? 0 : 1, inGroup, start, line, column); + case 69271571: + return parseArrayLiteral(parser, context, canAssign ? 0 : 1, inGroup, start, line, column); + case 67174411: + return parseParenthesizedExpression(parser, context, canAssign, 1, 0, start, line, column); + case 86021: + case 86022: + case 86023: + return parseNullOrTrueOrFalseLiteral(parser, context, start, line, column); + case 86113: + return parseThisExpression(parser, context); + case 65540: + return parseRegExpLiteral(parser, context, start, line, column); + case 133: + case 86096: + return parseClassExpression(parser, context, inGroup, start, line, column); + case 86111: + return parseSuperExpression(parser, context, start, line, column); + case 67174409: + return parseTemplateLiteral(parser, context, start, line, column); + case 67174408: + return parseTemplate(parser, context); + case 86109: + return parseNewExpression(parser, context, inGroup, start, line, column); + case 134283389: + return parseBigIntLiteral(parser, context, start, line, column); + case 131: + return parsePrivateIdentifier(parser, context, start, line, column); + case 86108: + return parseImportCallOrMetaExpression(parser, context, inNew, inGroup, start, line, column); + case 8456258: + if (context & 16) + return parseJSXRootElementOrFragment(parser, context, 1, start, line, column); + default: + if (isValidIdentifier(context, parser.token)) + return parseIdentifierOrArrow(parser, context, start, line, column); + report(parser, 28, KeywordDescTable[parser.token & 255]); + } +} +function parseImportCallOrMetaExpression(parser, context, inNew, inGroup, start, line, column) { + let expr = parseIdentifier(parser, context, 0); + if (parser.token === 67108877) { + return parseImportMetaExpression(parser, context, expr, start, line, column); + } + if (inNew) + report(parser, 137); + expr = parseImportExpression(parser, context, inGroup, start, line, column); + parser.assignable = 2; + return parseMemberOrUpdateExpression(parser, context, expr, inGroup, 0, start, line, column); +} +function parseImportMetaExpression(parser, context, meta, start, line, column) { + if ((context & 2048) === 0) + report(parser, 163); + nextToken(parser, context); + if (parser.token !== 143495 && parser.tokenValue !== 'meta') + report(parser, 28, KeywordDescTable[parser.token & 255]); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'MetaProperty', + meta, + property: parseIdentifier(parser, context, 0) + }); +} +function parseImportExpression(parser, context, inGroup, start, line, column) { + consume(parser, context | 32768, 67174411); + if (parser.token === 14) + report(parser, 138); + const source = parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context, 16); + return finishNode(parser, context, start, line, column, { + type: 'ImportExpression', + source + }); +} +function parseBigIntLiteral(parser, context, start, line, column) { + const { tokenRaw, tokenValue } = parser; + nextToken(parser, context); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, context & 512 + ? { + type: 'Literal', + value: tokenValue, + bigint: tokenRaw.slice(0, -1), + raw: tokenRaw + } + : { + type: 'Literal', + value: tokenValue, + bigint: tokenRaw.slice(0, -1) + }); +} +function parseTemplateLiteral(parser, context, start, line, column) { + parser.assignable = 2; + const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; + consume(parser, context, 67174409); + const quasis = [parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, true)]; + return finishNode(parser, context, start, line, column, { + type: 'TemplateLiteral', + expressions: [], + quasis + }); +} +function parseTemplate(parser, context) { + context = (context | 134217728) ^ 134217728; + const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; + consume(parser, context | 32768, 67174408); + const quasis = [ + parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, false) + ]; + const expressions = [parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)]; + if (parser.token !== 1074790415) + report(parser, 80); + while ((parser.token = scanTemplateTail(parser, context)) !== 67174409) { + const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; + consume(parser, context | 32768, 67174408); + quasis.push(parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, false)); + expressions.push(parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)); + if (parser.token !== 1074790415) + report(parser, 80); + } + { + const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; + consume(parser, context, 67174409); + quasis.push(parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, true)); + } + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'TemplateLiteral', + expressions, + quasis + }); +} +function parseTemplateElement(parser, context, cooked, raw, start, line, col, tail) { + const node = finishNode(parser, context, start, line, col, { + type: 'TemplateElement', + value: { + cooked, + raw + }, + tail + }); + const tailSize = tail ? 1 : 2; + if (context & 2) { + node.start += 1; + node.range[0] += 1; + node.end -= tailSize; + node.range[1] -= tailSize; + } + if (context & 4) { + node.loc.start.column += 1; + node.loc.end.column -= tailSize; + } + return node; +} +function parseSpreadElement(parser, context, start, line, column) { + context = (context | 134217728) ^ 134217728; + consume(parser, context | 32768, 14); + const argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + parser.assignable = 1; + return finishNode(parser, context, start, line, column, { + type: 'SpreadElement', + argument + }); +} +function parseArguments(parser, context, inGroup) { + nextToken(parser, context | 32768); + const args = []; + if (parser.token === 16) { + nextToken(parser, context); + return args; + } + while (parser.token !== 16) { + if (parser.token === 14) { + args.push(parseSpreadElement(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); + } + else { + args.push(parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); + } + if (parser.token !== 18) + break; + nextToken(parser, context | 32768); + if (parser.token === 16) + break; + } + consume(parser, context, 16); + return args; +} +function parseIdentifier(parser, context, isPattern) { + const { tokenValue, tokenPos, linePos, colPos } = parser; + nextToken(parser, context); + return finishNode(parser, context, tokenPos, linePos, colPos, context & 268435456 + ? { + type: 'Identifier', + name: tokenValue, + pattern: isPattern === 1 + } + : { + type: 'Identifier', + name: tokenValue + }); +} +function parseLiteral(parser, context) { + const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; + if (parser.token === 134283389) { + return parseBigIntLiteral(parser, context, tokenPos, linePos, colPos); + } + nextToken(parser, context); + parser.assignable = 2; + return finishNode(parser, context, tokenPos, linePos, colPos, context & 512 + ? { + type: 'Literal', + value: tokenValue, + raw: tokenRaw + } + : { + type: 'Literal', + value: tokenValue + }); +} +function parseNullOrTrueOrFalseLiteral(parser, context, start, line, column) { + const raw = KeywordDescTable[parser.token & 255]; + const value = parser.token === 86023 ? null : raw === 'true'; + nextToken(parser, context); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, context & 512 + ? { + type: 'Literal', + value, + raw + } + : { + type: 'Literal', + value + }); +} +function parseThisExpression(parser, context) { + const { tokenPos, linePos, colPos } = parser; + nextToken(parser, context); + parser.assignable = 2; + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ThisExpression' + }); +} +function parseFunctionDeclaration(parser, context, scope, origin, allowGen, flags, isAsync, start, line, column) { + nextToken(parser, context | 32768); + const isGenerator = allowGen ? optionalBit(parser, context, 8457014) : 0; + let id = null; + let firstRestricted; + let functionScope = scope ? createScope() : void 0; + if (parser.token === 67174411) { + if ((flags & 1) < 1) + report(parser, 37, 'Function'); + } + else { + const kind = origin & 4 && ((context & 8192) < 1 || (context & 2048) < 1) + ? 4 + : 64; + validateFunctionName(parser, context | ((context & 3072) << 11), parser.token); + if (scope) { + if (kind & 4) { + addVarName(parser, context, scope, parser.tokenValue, kind); + } + else { + addBlockName(parser, context, scope, parser.tokenValue, kind, origin); + } + functionScope = addChildScope(functionScope, 256); + if (flags) { + if (flags & 2) { + declareUnboundVariable(parser, parser.tokenValue); + } + } + } + firstRestricted = parser.token; + if (parser.token & 143360) { + id = parseIdentifier(parser, context, 0); + } + else { + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + } + context = + ((context | 32243712) ^ 32243712) | + 67108864 | + ((isAsync * 2 + isGenerator) << 21) | + (isGenerator ? 0 : 1073741824); + if (scope) + functionScope = addChildScope(functionScope, 512); + const params = parseFormalParametersOrFormalList(parser, context | 8388608, functionScope, 0, 1); + const body = parseFunctionBody(parser, (context | 8192 | 4096 | 131072) ^ + (8192 | 4096 | 131072), scope ? addChildScope(functionScope, 128) : functionScope, 8, firstRestricted, scope ? functionScope.scopeError : void 0); + return finishNode(parser, context, start, line, column, { + type: 'FunctionDeclaration', + id, + params, + body, + async: isAsync === 1, + generator: isGenerator === 1 + }); +} +function parseFunctionExpression(parser, context, isAsync, inGroup, start, line, column) { + nextToken(parser, context | 32768); + const isGenerator = optionalBit(parser, context, 8457014); + const generatorAndAsyncFlags = (isAsync * 2 + isGenerator) << 21; + let id = null; + let firstRestricted; + let scope = context & 64 ? createScope() : void 0; + if ((parser.token & (143360 | 4096 | 36864)) > 0) { + validateFunctionName(parser, ((context | 0x1ec0000) ^ 0x1ec0000) | generatorAndAsyncFlags, parser.token); + if (scope) + scope = addChildScope(scope, 256); + firstRestricted = parser.token; + id = parseIdentifier(parser, context, 0); + } + context = + ((context | 32243712) ^ 32243712) | + 67108864 | + generatorAndAsyncFlags | + (isGenerator ? 0 : 1073741824); + if (scope) + scope = addChildScope(scope, 512); + const params = parseFormalParametersOrFormalList(parser, context | 8388608, scope, inGroup, 1); + const body = parseFunctionBody(parser, context & ~(0x8001000 | 8192 | 4096 | 131072 | 16384), scope ? addChildScope(scope, 128) : scope, 0, firstRestricted, void 0); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'FunctionExpression', + id, + params, + body, + async: isAsync === 1, + generator: isGenerator === 1 + }); +} +function parseArrayLiteral(parser, context, skipInitializer, inGroup, start, line, column) { + const expr = parseArrayExpressionOrPattern(parser, context, void 0, skipInitializer, inGroup, 0, 2, 0, start, line, column); + if (context & 256 && parser.destructible & 64) { + report(parser, 60); + } + if (parser.destructible & 8) { + report(parser, 59); + } + return expr; +} +function parseArrayExpressionOrPattern(parser, context, scope, skipInitializer, inGroup, isPattern, kind, origin, start, line, column) { + nextToken(parser, context | 32768); + const elements = []; + let destructible = 0; + context = (context | 134217728) ^ 134217728; + while (parser.token !== 20) { + if (consumeOpt(parser, context | 32768, 18)) { + elements.push(null); + } + else { + let left; + const { token, tokenPos, linePos, colPos, tokenValue } = parser; + if (token & 143360) { + left = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); + if (parser.token === 1077936157) { + if (parser.assignable & 2) + report(parser, 24); + nextToken(parser, context | 32768); + if (scope) + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + left = finishNode(parser, context, tokenPos, linePos, colPos, isPattern + ? { + type: 'AssignmentPattern', + left, + right + } + : { + type: 'AssignmentExpression', + operator: '=', + left, + right + }); + destructible |= + parser.destructible & 256 + ? 256 + : 0 | (parser.destructible & 128) + ? 128 + : 0; + } + else if (parser.token === 18 || parser.token === 20) { + if (parser.assignable & 2) { + destructible |= 16; + } + else if (scope) { + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + } + destructible |= + parser.destructible & 256 + ? 256 + : 0 | (parser.destructible & 128) + ? 128 + : 0; + } + else { + destructible |= + kind & 1 + ? 32 + : (kind & 2) < 1 + ? 16 + : 0; + left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos); + if (parser.token !== 18 && parser.token !== 20) { + if (parser.token !== 1077936157) + destructible |= 16; + left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); + } + else if (parser.token !== 1077936157) { + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + } + else if (token & 2097152) { + left = + parser.token === 2162700 + ? parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) + : parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); + destructible |= parser.destructible; + parser.assignable = + parser.destructible & 16 + ? 2 + : 1; + if (parser.token === 18 || parser.token === 20) { + if (parser.assignable & 2) { + destructible |= 16; + } + } + else if (parser.destructible & 8) { + report(parser, 68); + } + else { + left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 2 ? 16 : 0; + if (parser.token !== 18 && parser.token !== 20) { + left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); + } + else if (parser.token !== 1077936157) { + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + } + else if (token === 14) { + left = parseSpreadOrRestElement(parser, context, scope, 20, kind, origin, 0, inGroup, isPattern, tokenPos, linePos, colPos); + destructible |= parser.destructible; + if (parser.token !== 18 && parser.token !== 20) + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + else { + left = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); + if (parser.token !== 18 && parser.token !== 20) { + left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); + if ((kind & (2 | 1)) < 1 && token === 67174411) + destructible |= 16; + } + else if (parser.assignable & 2) { + destructible |= 16; + } + else if (token === 67174411) { + destructible |= + parser.assignable & 1 && kind & (2 | 1) + ? 32 + : 16; + } + } + elements.push(left); + if (consumeOpt(parser, context | 32768, 18)) { + if (parser.token === 20) + break; + } + else + break; + } + } + consume(parser, context, 20); + const node = finishNode(parser, context, start, line, column, { + type: isPattern ? 'ArrayPattern' : 'ArrayExpression', + elements + }); + if (!skipInitializer && parser.token & 4194304) { + return parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node); + } + parser.destructible = destructible; + return node; +} +function parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node) { + if (parser.token !== 1077936157) + report(parser, 24); + nextToken(parser, context | 32768); + if (destructible & 16) + report(parser, 24); + if (!isPattern) + reinterpretToPattern(parser, node); + const { tokenPos, linePos, colPos } = parser; + const right = parseExpression(parser, context, 1, 1, inGroup, tokenPos, linePos, colPos); + parser.destructible = + ((destructible | 64 | 8) ^ + (8 | 64)) | + (parser.destructible & 128 ? 128 : 0) | + (parser.destructible & 256 ? 256 : 0); + return finishNode(parser, context, start, line, column, isPattern + ? { + type: 'AssignmentPattern', + left: node, + right + } + : { + type: 'AssignmentExpression', + left: node, + operator: '=', + right + }); +} +function parseSpreadOrRestElement(parser, context, scope, closingToken, kind, origin, isAsync, inGroup, isPattern, start, line, column) { + nextToken(parser, context | 32768); + let argument = null; + let destructible = 0; + let { token, tokenValue, tokenPos, linePos, colPos } = parser; + if (token & (4096 | 143360)) { + parser.assignable = 1; + argument = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); + token = parser.token; + argument = parseMemberOrUpdateExpression(parser, context, argument, inGroup, 0, tokenPos, linePos, colPos); + if (parser.token !== 18 && parser.token !== closingToken) { + if (parser.assignable & 2 && parser.token === 1077936157) + report(parser, 68); + destructible |= 16; + argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); + } + if (parser.assignable & 2) { + destructible |= 16; + } + else if (token === closingToken || token === 18) { + if (scope) + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + } + else { + destructible |= 32; + } + destructible |= parser.destructible & 128 ? 128 : 0; + } + else if (token === closingToken) { + report(parser, 39); + } + else if (token & 2097152) { + argument = + parser.token === 2162700 + ? parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) + : parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); + token = parser.token; + if (token !== 1077936157 && token !== closingToken && token !== 18) { + if (parser.destructible & 8) + report(parser, 68); + argument = parseMemberOrUpdateExpression(parser, context, argument, inGroup, 0, tokenPos, linePos, colPos); + destructible |= parser.assignable & 2 ? 16 : 0; + if ((parser.token & 4194304) === 4194304) { + if (parser.token !== 1077936157) + destructible |= 16; + argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); + } + else { + if ((parser.token & 8454144) === 8454144) { + argument = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, argument); + } + if (consumeOpt(parser, context | 32768, 22)) { + argument = parseConditionalExpression(parser, context, argument, tokenPos, linePos, colPos); + } + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + else { + destructible |= + closingToken === 1074790415 && token !== 1077936157 + ? 16 + : parser.destructible; + } + } + else { + destructible |= 32; + argument = parseLeftHandSideExpression(parser, context, 1, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos); + const { token, tokenPos, linePos, colPos } = parser; + if (token === 1077936157 && token !== closingToken && token !== 18) { + if (parser.assignable & 2) + report(parser, 24); + argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); + destructible |= 16; + } + else { + if (token === 18) { + destructible |= 16; + } + else if (token !== closingToken) { + argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); + } + destructible |= + parser.assignable & 1 ? 32 : 16; + } + parser.destructible = destructible; + if (parser.token !== closingToken && parser.token !== 18) + report(parser, 155); + return finishNode(parser, context, start, line, column, { + type: isPattern ? 'RestElement' : 'SpreadElement', + argument: argument + }); + } + if (parser.token !== closingToken) { + if (kind & 1) + destructible |= isAsync ? 16 : 32; + if (consumeOpt(parser, context | 32768, 1077936157)) { + if (destructible & 16) + report(parser, 24); + reinterpretToPattern(parser, argument); + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + argument = finishNode(parser, context, tokenPos, linePos, colPos, isPattern + ? { + type: 'AssignmentPattern', + left: argument, + right + } + : { + type: 'AssignmentExpression', + left: argument, + operator: '=', + right + }); + destructible = 16; + } + else { + destructible |= 16; + } + } + parser.destructible = destructible; + return finishNode(parser, context, start, line, column, { + type: isPattern ? 'RestElement' : 'SpreadElement', + argument: argument + }); +} +function parseMethodDefinition(parser, context, kind, inGroup, start, line, column) { + const modifierFlags = (kind & 64) < 1 ? 31981568 : 14680064; + context = + ((context | modifierFlags) ^ modifierFlags) | + ((kind & 88) << 18) | + 100925440; + let scope = context & 64 ? addChildScope(createScope(), 512) : void 0; + const params = parseMethodFormals(parser, context | 8388608, scope, kind, 1, inGroup); + if (scope) + scope = addChildScope(scope, 128); + const body = parseFunctionBody(parser, context & ~(0x8001000 | 8192), scope, 0, void 0, void 0); + return finishNode(parser, context, start, line, column, { + type: 'FunctionExpression', + params, + body, + async: (kind & 16) > 0, + generator: (kind & 8) > 0, + id: null + }); +} +function parseObjectLiteral(parser, context, skipInitializer, inGroup, start, line, column) { + const expr = parseObjectLiteralOrPattern(parser, context, void 0, skipInitializer, inGroup, 0, 2, 0, start, line, column); + if (context & 256 && parser.destructible & 64) { + report(parser, 60); + } + if (parser.destructible & 8) { + report(parser, 59); + } + return expr; +} +function parseObjectLiteralOrPattern(parser, context, scope, skipInitializer, inGroup, isPattern, kind, origin, start, line, column) { + nextToken(parser, context); + const properties = []; + let destructible = 0; + let prototypeCount = 0; + context = (context | 134217728) ^ 134217728; + while (parser.token !== 1074790415) { + const { token, tokenValue, linePos, colPos, tokenPos } = parser; + if (token === 14) { + properties.push(parseSpreadOrRestElement(parser, context, scope, 1074790415, kind, origin, 0, inGroup, isPattern, tokenPos, linePos, colPos)); + } + else { + let state = 0; + let key = null; + let value; + const t = parser.token; + if (parser.token & (143360 | 4096) || parser.token === 121) { + key = parseIdentifier(parser, context, 0); + if (parser.token === 18 || parser.token === 1074790415 || parser.token === 1077936157) { + state |= 4; + if (context & 1024 && (token & 537079808) === 537079808) { + destructible |= 16; + } + else { + validateBindingIdentifier(parser, context, kind, token, 0); + } + if (scope) + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + if (consumeOpt(parser, context | 32768, 1077936157)) { + destructible |= 8; + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + destructible |= + parser.destructible & 256 + ? 256 + : 0 | (parser.destructible & 128) + ? 128 + : 0; + value = finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'AssignmentPattern', + left: context & -2147483648 ? Object.assign({}, key) : key, + right + }); + } + else { + destructible |= + (token === 209008 ? 128 : 0) | + (token === 121 ? 16 : 0); + value = context & -2147483648 ? Object.assign({}, key) : key; + } + } + else if (consumeOpt(parser, context | 32768, 21)) { + const { tokenPos, linePos, colPos } = parser; + if (tokenValue === '__proto__') + prototypeCount++; + if (parser.token & 143360) { + const tokenAfterColon = parser.token; + const valueAfterColon = parser.tokenValue; + destructible |= t === 121 ? 16 : 0; + value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); + const { token } = parser; + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + if (parser.token === 18 || parser.token === 1074790415) { + if (token === 1077936157 || token === 1074790415 || token === 18) { + destructible |= parser.destructible & 128 ? 128 : 0; + if (parser.assignable & 2) { + destructible |= 16; + } + else if (scope && (tokenAfterColon & 143360) === 143360) { + addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); + } + } + else { + destructible |= + parser.assignable & 1 + ? 32 + : 16; + } + } + else if ((parser.token & 4194304) === 4194304) { + if (parser.assignable & 2) { + destructible |= 16; + } + else if (token !== 1077936157) { + destructible |= 32; + } + else if (scope) { + addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); + } + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else { + destructible |= 16; + if ((parser.token & 8454144) === 8454144) { + value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); + } + if (consumeOpt(parser, context | 32768, 22)) { + value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); + } + } + } + else if ((parser.token & 2097152) === 2097152) { + value = + parser.token === 69271571 + ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) + : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); + destructible = parser.destructible; + parser.assignable = + destructible & 16 ? 2 : 1; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) + destructible |= 16; + } + else if (parser.destructible & 8) { + report(parser, 68); + } + else { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 2 ? 16 : 0; + if ((parser.token & 4194304) === 4194304) { + value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else { + if ((parser.token & 8454144) === 8454144) { + value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); + } + if (consumeOpt(parser, context | 32768, 22)) { + value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); + } + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + } + else { + value = parseLeftHandSideExpression(parser, context, 1, inGroup, 1, tokenPos, linePos, colPos); + destructible |= + parser.assignable & 1 + ? 32 + : 16; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) + destructible |= 16; + } + else { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 2 ? 16 : 0; + if (parser.token !== 18 && token !== 1074790415) { + if (parser.token !== 1077936157) + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + } + } + } + else if (parser.token === 69271571) { + destructible |= 16; + if (token === 209007) + state |= 16; + state |= + (token === 12402 + ? 256 + : token === 12403 + ? 512 + : 1) | 2; + key = parseComputedPropertyName(parser, context, inGroup); + destructible |= parser.assignable; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else if (parser.token & (143360 | 4096)) { + destructible |= 16; + if (token === 121) + report(parser, 92); + if (token === 209007) { + if (parser.flags & 1) + report(parser, 128); + state |= 16; + } + key = parseIdentifier(parser, context, 0); + state |= + token === 12402 + ? 256 + : token === 12403 + ? 512 + : 1; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else if (parser.token === 67174411) { + destructible |= 16; + state |= 1; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else if (parser.token === 8457014) { + destructible |= 16; + if (token === 12402 || token === 12403) { + report(parser, 40); + } + else if (token === 143483) { + report(parser, 92); + } + nextToken(parser, context); + state |= + 8 | 1 | (token === 209007 ? 16 : 0); + if (parser.token & 143360) { + key = parseIdentifier(parser, context, 0); + } + else if ((parser.token & 134217728) === 134217728) { + key = parseLiteral(parser, context); + } + else if (parser.token === 69271571) { + state |= 2; + key = parseComputedPropertyName(parser, context, inGroup); + destructible |= parser.assignable; + } + else { + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else if ((parser.token & 134217728) === 134217728) { + if (token === 209007) + state |= 16; + state |= + token === 12402 + ? 256 + : token === 12403 + ? 512 + : 1; + destructible |= 16; + key = parseLiteral(parser, context); + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + report(parser, 129); + } + } + else if ((parser.token & 134217728) === 134217728) { + key = parseLiteral(parser, context); + if (parser.token === 21) { + consume(parser, context | 32768, 21); + const { tokenPos, linePos, colPos } = parser; + if (tokenValue === '__proto__') + prototypeCount++; + if (parser.token & 143360) { + value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); + const { token, tokenValue: valueAfterColon } = parser; + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + if (parser.token === 18 || parser.token === 1074790415) { + if (token === 1077936157 || token === 1074790415 || token === 18) { + if (parser.assignable & 2) { + destructible |= 16; + } + else if (scope) { + addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); + } + } + else { + destructible |= + parser.assignable & 1 + ? 32 + : 16; + } + } + else if (parser.token === 1077936157) { + if (parser.assignable & 2) + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else { + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + } + else if ((parser.token & 2097152) === 2097152) { + value = + parser.token === 69271571 + ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) + : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); + destructible = parser.destructible; + parser.assignable = + destructible & 16 ? 2 : 1; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) { + destructible |= 16; + } + } + else if ((parser.destructible & 8) !== 8) { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 2 ? 16 : 0; + if ((parser.token & 4194304) === 4194304) { + value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else { + if ((parser.token & 8454144) === 8454144) { + value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); + } + if (consumeOpt(parser, context | 32768, 22)) { + value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); + } + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + } + else { + value = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); + destructible |= + parser.assignable & 1 + ? 32 + : 16; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) { + destructible |= 16; + } + } + else { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 1 ? 0 : 16; + if (parser.token !== 18 && parser.token !== 1074790415) { + if (parser.token !== 1077936157) + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + } + } + } + else if (parser.token === 67174411) { + state |= 1; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + destructible = parser.assignable | 16; + } + else { + report(parser, 130); + } + } + else if (parser.token === 69271571) { + key = parseComputedPropertyName(parser, context, inGroup); + destructible |= parser.destructible & 256 ? 256 : 0; + state |= 2; + if (parser.token === 21) { + nextToken(parser, context | 32768); + const { tokenPos, linePos, colPos, tokenValue, token: tokenAfterColon } = parser; + if (parser.token & 143360) { + value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); + const { token } = parser; + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + if ((parser.token & 4194304) === 4194304) { + destructible |= + parser.assignable & 2 + ? 16 + : token === 1077936157 + ? 0 + : 32; + value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else if (parser.token === 18 || parser.token === 1074790415) { + if (token === 1077936157 || token === 1074790415 || token === 18) { + if (parser.assignable & 2) { + destructible |= 16; + } + else if (scope && (tokenAfterColon & 143360) === 143360) { + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + } + } + else { + destructible |= + parser.assignable & 1 + ? 32 + : 16; + } + } + else { + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + } + else if ((parser.token & 2097152) === 2097152) { + value = + parser.token === 69271571 + ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) + : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); + destructible = parser.destructible; + parser.assignable = + destructible & 16 ? 2 : 1; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) + destructible |= 16; + } + else if (destructible & 8) { + report(parser, 59); + } + else { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = + parser.assignable & 2 ? destructible | 16 : 0; + if ((parser.token & 4194304) === 4194304) { + if (parser.token !== 1077936157) + destructible |= 16; + value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + else { + if ((parser.token & 8454144) === 8454144) { + value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); + } + if (consumeOpt(parser, context | 32768, 22)) { + value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); + } + destructible |= + parser.assignable & 2 + ? 16 + : 32; + } + } + } + else { + value = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); + destructible |= + parser.assignable & 1 + ? 32 + : 16; + if (parser.token === 18 || parser.token === 1074790415) { + if (parser.assignable & 2) + destructible |= 16; + } + else { + value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); + destructible = parser.assignable & 1 ? 0 : 16; + if (parser.token !== 18 && parser.token !== 1074790415) { + if (parser.token !== 1077936157) + destructible |= 16; + value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); + } + } + } + } + else if (parser.token === 67174411) { + state |= 1; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, linePos, colPos); + destructible = 16; + } + else { + report(parser, 41); + } + } + else if (token === 8457014) { + consume(parser, context | 32768, 8457014); + state |= 8; + if (parser.token & 143360) { + const { token, line, index } = parser; + key = parseIdentifier(parser, context, 0); + state |= 1; + if (parser.token === 67174411) { + destructible |= 16; + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + reportMessageAt(index, line, index, token === 209007 + ? 43 + : token === 12402 || parser.token === 12403 + ? 42 + : 44, KeywordDescTable[token & 255]); + } + } + else if ((parser.token & 134217728) === 134217728) { + destructible |= 16; + key = parseLiteral(parser, context); + state |= 1; + value = parseMethodDefinition(parser, context, state, inGroup, tokenPos, linePos, colPos); + } + else if (parser.token === 69271571) { + destructible |= 16; + state |= 2 | 1; + key = parseComputedPropertyName(parser, context, inGroup); + value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + report(parser, 122); + } + } + else { + report(parser, 28, KeywordDescTable[token & 255]); + } + destructible |= parser.destructible & 128 ? 128 : 0; + parser.destructible = destructible; + properties.push(finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'Property', + key: key, + value, + kind: !(state & 768) ? 'init' : state & 512 ? 'set' : 'get', + computed: (state & 2) > 0, + method: (state & 1) > 0, + shorthand: (state & 4) > 0 + })); + } + destructible |= parser.destructible; + if (parser.token !== 18) + break; + nextToken(parser, context); + } + consume(parser, context, 1074790415); + if (prototypeCount > 1) + destructible |= 64; + const node = finishNode(parser, context, start, line, column, { + type: isPattern ? 'ObjectPattern' : 'ObjectExpression', + properties + }); + if (!skipInitializer && parser.token & 4194304) { + return parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node); + } + parser.destructible = destructible; + return node; +} +function parseMethodFormals(parser, context, scope, kind, type, inGroup) { + consume(parser, context, 67174411); + const params = []; + parser.flags = (parser.flags | 128) ^ 128; + if (parser.token === 16) { + if (kind & 512) { + report(parser, 35, 'Setter', 'one', ''); + } + nextToken(parser, context); + return params; + } + if (kind & 256) { + report(parser, 35, 'Getter', 'no', 's'); + } + if (kind & 512 && parser.token === 14) { + report(parser, 36); + } + context = (context | 134217728) ^ 134217728; + let setterArgs = 0; + let isSimpleParameterList = 0; + while (parser.token !== 18) { + let left = null; + const { tokenPos, linePos, colPos } = parser; + if (parser.token & 143360) { + if ((context & 1024) < 1) { + if ((parser.token & 36864) === 36864) { + parser.flags |= 256; + } + if ((parser.token & 537079808) === 537079808) { + parser.flags |= 512; + } + } + left = parseAndClassifyIdentifier(parser, context, scope, kind | 1, 0, tokenPos, linePos, colPos); + } + else { + if (parser.token === 2162700) { + left = parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, 1, type, 0, tokenPos, linePos, colPos); + } + else if (parser.token === 69271571) { + left = parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, 1, type, 0, tokenPos, linePos, colPos); + } + else if (parser.token === 14) { + left = parseSpreadOrRestElement(parser, context, scope, 16, type, 0, 0, inGroup, 1, tokenPos, linePos, colPos); + } + isSimpleParameterList = 1; + if (parser.destructible & (32 | 16)) + report(parser, 47); + } + if (parser.token === 1077936157) { + nextToken(parser, context | 32768); + isSimpleParameterList = 1; + const right = parseExpression(parser, context, 1, 1, 0, parser.tokenPos, parser.linePos, parser.colPos); + left = finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'AssignmentPattern', + left: left, + right + }); + } + setterArgs++; + params.push(left); + if (!consumeOpt(parser, context, 18)) + break; + if (parser.token === 16) { + break; + } + } + if (kind & 512 && setterArgs !== 1) { + report(parser, 35, 'Setter', 'one', ''); + } + if (scope && scope.scopeError !== void 0) + reportScopeError(scope.scopeError); + if (isSimpleParameterList) + parser.flags |= 128; + consume(parser, context, 16); + return params; +} +function parseComputedPropertyName(parser, context, inGroup) { + nextToken(parser, context | 32768); + const key = parseExpression(parser, (context | 134217728) ^ 134217728, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context, 20); + return key; +} +function parseParenthesizedExpression(parser, context, canAssign, kind, origin, start, line, column) { + parser.flags = (parser.flags | 128) ^ 128; + const { tokenPos: piStart, linePos: plStart, colPos: pcStart } = parser; + nextToken(parser, context | 32768 | 1073741824); + const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0; + context = (context | 134217728) ^ 134217728; + if (consumeOpt(parser, context, 16)) { + return parseParenthesizedArrow(parser, context, scope, [], canAssign, 0, start, line, column); + } + let destructible = 0; + parser.destructible &= ~(256 | 128); + let expr; + let expressions = []; + let isSequence = 0; + let isSimpleParameterList = 0; + const { tokenPos: iStart, linePos: lStart, colPos: cStart } = parser; + parser.assignable = 1; + while (parser.token !== 16) { + const { token, tokenPos, linePos, colPos } = parser; + if (token & (143360 | 4096)) { + if (scope) + addBlockName(parser, context, scope, parser.tokenValue, 1, 0); + expr = parsePrimaryExpression(parser, context, kind, 0, 1, 0, 1, 1, tokenPos, linePos, colPos); + if (parser.token === 16 || parser.token === 18) { + if (parser.assignable & 2) { + destructible |= 16; + isSimpleParameterList = 1; + } + else if ((token & 537079808) === 537079808 || + (token & 36864) === 36864) { + isSimpleParameterList = 1; + } + } + else { + if (parser.token === 1077936157) { + isSimpleParameterList = 1; + } + else { + destructible |= 16; + } + expr = parseMemberOrUpdateExpression(parser, context, expr, 1, 0, tokenPos, linePos, colPos); + if (parser.token !== 16 && parser.token !== 18) { + expr = parseAssignmentExpression(parser, context, 1, 0, tokenPos, linePos, colPos, expr); + } + } + } + else if ((token & 2097152) === 2097152) { + expr = + token === 2162700 + ? parseObjectLiteralOrPattern(parser, context | 1073741824, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos) + : parseArrayExpressionOrPattern(parser, context | 1073741824, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos); + destructible |= parser.destructible; + isSimpleParameterList = 1; + parser.assignable = 2; + if (parser.token !== 16 && parser.token !== 18) { + if (destructible & 8) + report(parser, 118); + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, tokenPos, linePos, colPos); + destructible |= 16; + if (parser.token !== 16 && parser.token !== 18) { + expr = parseAssignmentExpression(parser, context, 0, 0, tokenPos, linePos, colPos, expr); + } + } + } + else if (token === 14) { + expr = parseSpreadOrRestElement(parser, context, scope, 16, kind, origin, 0, 1, 0, tokenPos, linePos, colPos); + if (parser.destructible & 16) + report(parser, 71); + isSimpleParameterList = 1; + if (isSequence && (parser.token === 16 || parser.token === 18)) { + expressions.push(expr); + } + destructible |= 8; + break; + } + else { + destructible |= 16; + expr = parseExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); + if (isSequence && (parser.token === 16 || parser.token === 18)) { + expressions.push(expr); + } + if (parser.token === 18) { + if (!isSequence) { + isSequence = 1; + expressions = [expr]; + } + } + if (isSequence) { + while (consumeOpt(parser, context | 32768, 18)) { + expressions.push(parseExpression(parser, context, 1, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)); + } + parser.assignable = 2; + expr = finishNode(parser, context, iStart, lStart, cStart, { + type: 'SequenceExpression', + expressions + }); + } + consume(parser, context, 16); + parser.destructible = destructible; + return expr; + } + if (isSequence && (parser.token === 16 || parser.token === 18)) { + expressions.push(expr); + } + if (!consumeOpt(parser, context | 32768, 18)) + break; + if (!isSequence) { + isSequence = 1; + expressions = [expr]; + } + if (parser.token === 16) { + destructible |= 8; + break; + } + } + if (isSequence) { + parser.assignable = 2; + expr = finishNode(parser, context, iStart, lStart, cStart, { + type: 'SequenceExpression', + expressions + }); + } + consume(parser, context, 16); + if (destructible & 16 && destructible & 8) + report(parser, 145); + destructible |= + parser.destructible & 256 + ? 256 + : 0 | (parser.destructible & 128) + ? 128 + : 0; + if (parser.token === 10) { + if (destructible & (32 | 16)) + report(parser, 46); + if (context & (4194304 | 2048) && destructible & 128) + report(parser, 29); + if (context & (1024 | 2097152) && destructible & 256) { + report(parser, 30); + } + if (isSimpleParameterList) + parser.flags |= 128; + return parseParenthesizedArrow(parser, context, scope, isSequence ? expressions : [expr], canAssign, 0, start, line, column); + } + else if (destructible & 8) { + report(parser, 139); + } + parser.destructible = ((parser.destructible | 256) ^ 256) | destructible; + return context & 128 + ? finishNode(parser, context, piStart, plStart, pcStart, { + type: 'ParenthesizedExpression', + expression: expr + }) + : expr; +} +function parseIdentifierOrArrow(parser, context, start, line, column) { + const { tokenValue } = parser; + const expr = parseIdentifier(parser, context, 0); + parser.assignable = 1; + if (parser.token === 10) { + let scope = void 0; + if (context & 64) + scope = createArrowHeadParsingScope(parser, context, tokenValue); + parser.flags = (parser.flags | 128) ^ 128; + return parseArrowFunctionExpression(parser, context, scope, [expr], 0, start, line, column); + } + return expr; +} +function parseArrowFromIdentifier(parser, context, value, expr, inNew, canAssign, isAsync, start, line, column) { + if (!canAssign) + report(parser, 54); + if (inNew) + report(parser, 48); + parser.flags &= ~128; + const scope = context & 64 ? createArrowHeadParsingScope(parser, context, value) : void 0; + return parseArrowFunctionExpression(parser, context, scope, [expr], isAsync, start, line, column); +} +function parseParenthesizedArrow(parser, context, scope, params, canAssign, isAsync, start, line, column) { + if (!canAssign) + report(parser, 54); + for (let i = 0; i < params.length; ++i) + reinterpretToPattern(parser, params[i]); + return parseArrowFunctionExpression(parser, context, scope, params, isAsync, start, line, column); +} +function parseArrowFunctionExpression(parser, context, scope, params, isAsync, start, line, column) { + if (parser.flags & 1) + report(parser, 45); + consume(parser, context | 32768, 10); + context = ((context | 15728640) ^ 15728640) | (isAsync << 22); + const expression = parser.token !== 2162700; + let body; + if (scope && scope.scopeError !== void 0) { + reportScopeError(scope.scopeError); + } + if (expression) { + body = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + } + else { + if (scope) + scope = addChildScope(scope, 128); + body = parseFunctionBody(parser, (context | 134221824 | 8192 | 16384) ^ + (134221824 | 8192 | 16384), scope, 16, void 0, void 0); + switch (parser.token) { + case 69271571: + if ((parser.flags & 1) < 1) { + report(parser, 112); + } + break; + case 67108877: + case 67174409: + case 22: + report(parser, 113); + case 67174411: + if ((parser.flags & 1) < 1) { + report(parser, 112); + } + parser.flags |= 1024; + break; + } + if ((parser.token & 8454144) === 8454144 && (parser.flags & 1) < 1) + report(parser, 28, KeywordDescTable[parser.token & 255]); + if ((parser.token & 33619968) === 33619968) + report(parser, 121); + } + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'ArrowFunctionExpression', + params, + body, + async: isAsync === 1, + expression + }); +} +function parseFormalParametersOrFormalList(parser, context, scope, inGroup, kind) { + consume(parser, context, 67174411); + parser.flags = (parser.flags | 128) ^ 128; + const params = []; + if (consumeOpt(parser, context, 16)) + return params; + context = (context | 134217728) ^ 134217728; + let isSimpleParameterList = 0; + while (parser.token !== 18) { + let left; + const { tokenPos, linePos, colPos } = parser; + if (parser.token & 143360) { + if ((context & 1024) < 1) { + if ((parser.token & 36864) === 36864) { + parser.flags |= 256; + } + if ((parser.token & 537079808) === 537079808) { + parser.flags |= 512; + } + } + left = parseAndClassifyIdentifier(parser, context, scope, kind | 1, 0, tokenPos, linePos, colPos); + } + else { + if (parser.token === 2162700) { + left = parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, 1, kind, 0, tokenPos, linePos, colPos); + } + else if (parser.token === 69271571) { + left = parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, 1, kind, 0, tokenPos, linePos, colPos); + } + else if (parser.token === 14) { + left = parseSpreadOrRestElement(parser, context, scope, 16, kind, 0, 0, inGroup, 1, tokenPos, linePos, colPos); + } + else { + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + isSimpleParameterList = 1; + if (parser.destructible & (32 | 16)) { + report(parser, 47); + } + } + if (parser.token === 1077936157) { + nextToken(parser, context | 32768); + isSimpleParameterList = 1; + const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + left = finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'AssignmentPattern', + left, + right + }); + } + params.push(left); + if (!consumeOpt(parser, context, 18)) + break; + if (parser.token === 16) { + break; + } + } + if (isSimpleParameterList) + parser.flags |= 128; + if (scope && (isSimpleParameterList || context & 1024) && scope.scopeError !== void 0) { + reportScopeError(scope.scopeError); + } + consume(parser, context, 16); + return params; +} +function parseMembeExpressionNoCall(parser, context, expr, inGroup, start, line, column) { + const { token } = parser; + if (token & 67108864) { + if (token === 67108877) { + nextToken(parser, context | 1073741824); + parser.assignable = 1; + const property = parsePropertyOrPrivatePropertyName(parser, context); + return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: false, + property + }), 0, start, line, column); + } + else if (token === 69271571) { + nextToken(parser, context | 32768); + const { tokenPos, linePos, colPos } = parser; + const property = parseExpressions(parser, context, inGroup, 1, tokenPos, linePos, colPos); + consume(parser, context, 20); + parser.assignable = 1; + return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { + type: 'MemberExpression', + object: expr, + computed: true, + property + }), 0, start, line, column); + } + else if (token === 67174408 || token === 67174409) { + parser.assignable = 2; + return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { + type: 'TaggedTemplateExpression', + tag: expr, + quasi: parser.token === 67174408 + ? parseTemplate(parser, context | 65536) + : parseTemplateLiteral(parser, context, parser.tokenPos, parser.linePos, parser.colPos) + }), 0, start, line, column); + } + } + return expr; +} +function parseNewExpression(parser, context, inGroup, start, line, column) { + const id = parseIdentifier(parser, context | 32768, 0); + const { tokenPos, linePos, colPos } = parser; + if (consumeOpt(parser, context, 67108877)) { + if (context & 67108864 && parser.token === 143494) { + parser.assignable = 2; + return parseMetaProperty(parser, context, id, start, line, column); + } + report(parser, 91); + } + parser.assignable = 2; + if ((parser.token & 16842752) === 16842752) { + report(parser, 62, KeywordDescTable[parser.token & 255]); + } + const expr = parsePrimaryExpression(parser, context, 2, 1, 0, 0, inGroup, 1, tokenPos, linePos, colPos); + context = (context | 134217728) ^ 134217728; + if (parser.token === 67108991) + report(parser, 162); + const callee = parseMembeExpressionNoCall(parser, context, expr, inGroup, tokenPos, linePos, colPos); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'NewExpression', + callee, + arguments: parser.token === 67174411 ? parseArguments(parser, context, inGroup) : [] + }); +} +function parseMetaProperty(parser, context, meta, start, line, column) { + const property = parseIdentifier(parser, context, 0); + return finishNode(parser, context, start, line, column, { + type: 'MetaProperty', + meta, + property + }); +} +function parseAsyncArrowAfterIdent(parser, context, canAssign, start, line, column) { + if (parser.token === 209008) + report(parser, 29); + if (context & (1024 | 2097152) && parser.token === 241773) { + report(parser, 30); + } + if ((parser.token & 537079808) === 537079808) { + parser.flags |= 512; + } + return parseArrowFromIdentifier(parser, context, parser.tokenValue, parseIdentifier(parser, context, 0), 0, canAssign, 1, start, line, column); +} +function parseAsyncArrowOrCallExpression(parser, context, callee, canAssign, kind, origin, flags, start, line, column) { + nextToken(parser, context | 32768); + const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0; + context = (context | 134217728) ^ 134217728; + if (consumeOpt(parser, context, 16)) { + if (parser.token === 10) { + if (flags & 1) + report(parser, 45); + return parseParenthesizedArrow(parser, context, scope, [], canAssign, 1, start, line, column); + } + return finishNode(parser, context, start, line, column, { + type: 'CallExpression', + callee, + arguments: [] + }); + } + let destructible = 0; + let expr = null; + let isSimpleParameterList = 0; + parser.destructible = + (parser.destructible | 256 | 128) ^ + (256 | 128); + const params = []; + while (parser.token !== 16) { + const { token, tokenPos, linePos, colPos } = parser; + if (token & (143360 | 4096)) { + if (scope) + addBlockName(parser, context, scope, parser.tokenValue, kind, 0); + expr = parsePrimaryExpression(parser, context, kind, 0, 1, 0, 1, 1, tokenPos, linePos, colPos); + if (parser.token === 16 || parser.token === 18) { + if (parser.assignable & 2) { + destructible |= 16; + isSimpleParameterList = 1; + } + else if ((token & 537079808) === 537079808) { + parser.flags |= 512; + } + else if ((token & 36864) === 36864) { + parser.flags |= 256; + } + } + else { + if (parser.token === 1077936157) { + isSimpleParameterList = 1; + } + else { + destructible |= 16; + } + expr = parseMemberOrUpdateExpression(parser, context, expr, 1, 0, tokenPos, linePos, colPos); + if (parser.token !== 16 && parser.token !== 18) { + expr = parseAssignmentExpression(parser, context, 1, 0, tokenPos, linePos, colPos, expr); + } + } + } + else if (token & 2097152) { + expr = + token === 2162700 + ? parseObjectLiteralOrPattern(parser, context, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos) + : parseArrayExpressionOrPattern(parser, context, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos); + destructible |= parser.destructible; + isSimpleParameterList = 1; + if (parser.token !== 16 && parser.token !== 18) { + if (destructible & 8) + report(parser, 118); + expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, tokenPos, linePos, colPos); + destructible |= 16; + if ((parser.token & 8454144) === 8454144) { + expr = parseBinaryExpression(parser, context, 1, start, line, column, 4, token, expr); + } + if (consumeOpt(parser, context | 32768, 22)) { + expr = parseConditionalExpression(parser, context, expr, start, line, column); + } + } + } + else if (token === 14) { + expr = parseSpreadOrRestElement(parser, context, scope, 16, kind, origin, 1, 1, 0, tokenPos, linePos, colPos); + destructible |= (parser.token === 16 ? 0 : 16) | parser.destructible; + isSimpleParameterList = 1; + } + else { + expr = parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos); + destructible = parser.assignable; + params.push(expr); + while (consumeOpt(parser, context | 32768, 18)) { + params.push(parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos)); + } + destructible |= parser.assignable; + consume(parser, context, 16); + parser.destructible = destructible | 16; + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'CallExpression', + callee, + arguments: params + }); + } + params.push(expr); + if (!consumeOpt(parser, context | 32768, 18)) + break; + } + consume(parser, context, 16); + destructible |= + parser.destructible & 256 + ? 256 + : 0 | (parser.destructible & 128) + ? 128 + : 0; + if (parser.token === 10) { + if (destructible & (32 | 16)) + report(parser, 25); + if (parser.flags & 1 || flags & 1) + report(parser, 45); + if (destructible & 128) + report(parser, 29); + if (context & (1024 | 2097152) && destructible & 256) + report(parser, 30); + if (isSimpleParameterList) + parser.flags |= 128; + return parseParenthesizedArrow(parser, context, scope, params, canAssign, 1, start, line, column); + } + else if (destructible & 8) { + report(parser, 59); + } + parser.assignable = 2; + return finishNode(parser, context, start, line, column, { + type: 'CallExpression', + callee, + arguments: params + }); +} +function parseRegExpLiteral(parser, context, start, line, column) { + const { tokenRaw, tokenRegExp, tokenValue } = parser; + nextToken(parser, context); + parser.assignable = 2; + return context & 512 + ? finishNode(parser, context, start, line, column, { + type: 'Literal', + value: tokenValue, + regex: tokenRegExp, + raw: tokenRaw + }) + : finishNode(parser, context, start, line, column, { + type: 'Literal', + value: tokenValue, + regex: tokenRegExp + }); +} +function parseClassDeclaration(parser, context, scope, flags, start, line, column) { + context = (context | 16777216 | 1024) ^ 16777216; + let decorators = parseDecorators(parser, context); + if (decorators.length) { + start = parser.tokenPos; + line = parser.linePos; + column = parser.colPos; + } + if (parser.leadingDecorators.length) { + parser.leadingDecorators.push(...decorators); + decorators = parser.leadingDecorators; + parser.leadingDecorators = []; + } + nextToken(parser, context); + let id = null; + let superClass = null; + const { tokenValue } = parser; + if (parser.token & 4096 && parser.token !== 20567) { + if (isStrictReservedWord(parser, context, parser.token)) { + report(parser, 114); + } + if ((parser.token & 537079808) === 537079808) { + report(parser, 115); + } + if (scope) { + addBlockName(parser, context, scope, tokenValue, 32, 0); + if (flags) { + if (flags & 2) { + declareUnboundVariable(parser, tokenValue); + } + } + } + id = parseIdentifier(parser, context, 0); + } + else { + if ((flags & 1) < 1) + report(parser, 37, 'Class'); + } + let inheritedContext = context; + if (consumeOpt(parser, context | 32768, 20567)) { + superClass = parseLeftHandSideExpression(parser, context, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + inheritedContext |= 524288; + } + else { + inheritedContext = (inheritedContext | 524288) ^ 524288; + } + const body = parseClassBody(parser, inheritedContext, context, scope, 2, 8, 0); + return finishNode(parser, context, start, line, column, context & 1 + ? { + type: 'ClassDeclaration', + id, + superClass, + decorators, + body + } + : { + type: 'ClassDeclaration', + id, + superClass, + body + }); +} +function parseClassExpression(parser, context, inGroup, start, line, column) { + let id = null; + let superClass = null; + context = (context | 1024 | 16777216) ^ 16777216; + const decorators = parseDecorators(parser, context); + if (decorators.length) { + start = parser.tokenPos; + line = parser.linePos; + column = parser.colPos; + } + nextToken(parser, context); + if (parser.token & 4096 && parser.token !== 20567) { + if (isStrictReservedWord(parser, context, parser.token)) + report(parser, 114); + if ((parser.token & 537079808) === 537079808) { + report(parser, 115); + } + id = parseIdentifier(parser, context, 0); + } + let inheritedContext = context; + if (consumeOpt(parser, context | 32768, 20567)) { + superClass = parseLeftHandSideExpression(parser, context, 0, inGroup, 0, parser.tokenPos, parser.linePos, parser.colPos); + inheritedContext |= 524288; + } + else { + inheritedContext = (inheritedContext | 524288) ^ 524288; + } + const body = parseClassBody(parser, inheritedContext, context, void 0, 2, 0, inGroup); + parser.assignable = 2; + return finishNode(parser, context, start, line, column, context & 1 + ? { + type: 'ClassExpression', + id, + superClass, + decorators, + body + } + : { + type: 'ClassExpression', + id, + superClass, + body + }); +} +function parseDecorators(parser, context) { + const list = []; + if (context & 1) { + while (parser.token === 133) { + list.push(parseDecoratorList(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); + } + } + return list; +} +function parseDecoratorList(parser, context, start, line, column) { + nextToken(parser, context | 32768); + let expression = parsePrimaryExpression(parser, context, 2, 0, 1, 0, 0, 1, start, line, column); + expression = parseMemberOrUpdateExpression(parser, context, expression, 0, 0, start, line, column); + return finishNode(parser, context, start, line, column, { + type: 'Decorator', + expression + }); +} +function parseClassBody(parser, context, inheritedContext, scope, kind, origin, inGroup) { + const { tokenPos, linePos, colPos } = parser; + consume(parser, context | 32768, 2162700); + context = (context | 134217728) ^ 134217728; + parser.flags = (parser.flags | 32) ^ 32; + const body = []; + let decorators; + while (parser.token !== 1074790415) { + let length = 0; + decorators = parseDecorators(parser, context); + length = decorators.length; + if (length > 0 && parser.tokenValue === 'constructor') { + report(parser, 106); + } + if (parser.token === 1074790415) + report(parser, 105); + if (consumeOpt(parser, context, 1074790417)) { + if (length > 0) + report(parser, 116); + continue; + } + body.push(parseClassElementList(parser, context, scope, inheritedContext, kind, decorators, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); + } + consume(parser, origin & 8 ? context | 32768 : context, 1074790415); + return finishNode(parser, context, tokenPos, linePos, colPos, { + type: 'ClassBody', + body + }); +} +function parseClassElementList(parser, context, scope, inheritedContext, type, decorators, isStatic, inGroup, start, line, column) { + let kind = isStatic ? 32 : 0; + let key = null; + const { token, tokenPos, linePos, colPos } = parser; + if (token & (143360 | 36864)) { + key = parseIdentifier(parser, context, 0); + switch (token) { + case 36972: + if (!isStatic && parser.token !== 67174411) { + return parseClassElementList(parser, context, scope, inheritedContext, type, decorators, 1, inGroup, start, line, column); + } + break; + case 209007: + if (parser.token !== 67174411 && (parser.flags & 1) < 1) { + if (context & 1 && (parser.token & 1073741824) === 1073741824) { + return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); + } + kind |= 16 | (optionalBit(parser, context, 8457014) ? 8 : 0); + } + break; + case 12402: + if (parser.token !== 67174411) { + if (context & 1 && (parser.token & 1073741824) === 1073741824) { + return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); + } + kind |= 256; + } + break; + case 12403: + if (parser.token !== 67174411) { + if (context & 1 && (parser.token & 1073741824) === 1073741824) { + return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); + } + kind |= 512; + } + break; + } + } + else if (token === 69271571) { + kind |= 2; + key = parseComputedPropertyName(parser, inheritedContext, inGroup); + } + else if ((token & 134217728) === 134217728) { + key = parseLiteral(parser, context); + } + else if (token === 8457014) { + kind |= 8; + nextToken(parser, context); + } + else if (context & 1 && parser.token === 131) { + kind |= 4096; + key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos); + context = context | 16384; + } + else if (context & 1 && (parser.token & 1073741824) === 1073741824) { + kind |= 128; + context = context | 16384; + } + else if (token === 122) { + key = parseIdentifier(parser, context, 0); + if (parser.token !== 67174411) + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + else { + report(parser, 28, KeywordDescTable[parser.token & 255]); + } + if (kind & (8 | 16 | 768)) { + if (parser.token & 143360) { + key = parseIdentifier(parser, context, 0); + } + else if ((parser.token & 134217728) === 134217728) { + key = parseLiteral(parser, context); + } + else if (parser.token === 69271571) { + kind |= 2; + key = parseComputedPropertyName(parser, context, 0); + } + else if (parser.token === 122) { + key = parseIdentifier(parser, context, 0); + } + else if (context & 1 && parser.token === 131) { + kind |= 4096; + key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos); + } + else + report(parser, 131); + } + if ((kind & 2) < 1) { + if (parser.tokenValue === 'constructor') { + if ((parser.token & 1073741824) === 1073741824) { + report(parser, 125); + } + else if ((kind & 32) < 1 && parser.token === 67174411) { + if (kind & (768 | 16 | 128 | 8)) { + report(parser, 50, 'accessor'); + } + else if ((context & 524288) < 1) { + if (parser.flags & 32) + report(parser, 51); + else + parser.flags |= 32; + } + } + kind |= 64; + } + else if ((kind & 4096) < 1 && + kind & (32 | 768 | 8 | 16) && + parser.tokenValue === 'prototype') { + report(parser, 49); + } + } + if (context & 1 && parser.token !== 67174411) { + return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); + } + const value = parseMethodDefinition(parser, context, kind, inGroup, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, context & 1 + ? { + type: 'MethodDefinition', + kind: (kind & 32) < 1 && kind & 64 + ? 'constructor' + : kind & 256 + ? 'get' + : kind & 512 + ? 'set' + : 'method', + static: (kind & 32) > 0, + computed: (kind & 2) > 0, + key, + decorators, + value + } + : { + type: 'MethodDefinition', + kind: (kind & 32) < 1 && kind & 64 + ? 'constructor' + : kind & 256 + ? 'get' + : kind & 512 + ? 'set' + : 'method', + static: (kind & 32) > 0, + computed: (kind & 2) > 0, + key, + value + }); +} +function parsePrivateIdentifier(parser, context, start, line, column) { + nextToken(parser, context); + const { tokenValue } = parser; + if (tokenValue === 'constructor') + report(parser, 124); + nextToken(parser, context); + return finishNode(parser, context, start, line, column, { + type: 'PrivateIdentifier', + name: tokenValue + }); +} +function parsePropertyDefinition(parser, context, key, state, decorators, start, line, column) { + let value = null; + if (state & 8) + report(parser, 0); + if (parser.token === 1077936157) { + nextToken(parser, context | 32768); + const { tokenPos, linePos, colPos } = parser; + if (parser.token === 537079928) + report(parser, 115); + value = parsePrimaryExpression(parser, context | 16384, 2, 0, 1, 0, 0, 1, tokenPos, linePos, colPos); + if ((parser.token & 1073741824) !== 1073741824) { + value = parseMemberOrUpdateExpression(parser, context | 16384, value, 0, 0, tokenPos, linePos, colPos); + value = parseAssignmentExpression(parser, context | 16384, 0, 0, tokenPos, linePos, colPos, value); + if (parser.token === 18) { + value = parseSequenceExpression(parser, context, 0, start, line, column, value); + } + } + } + return finishNode(parser, context, start, line, column, { + type: 'PropertyDefinition', + key, + value, + static: (state & 32) > 0, + computed: (state & 2) > 0, + decorators + }); +} +function parseBindingPattern(parser, context, scope, type, origin, start, line, column) { + if (parser.token & 143360) + return parseAndClassifyIdentifier(parser, context, scope, type, origin, start, line, column); + if ((parser.token & 2097152) !== 2097152) + report(parser, 28, KeywordDescTable[parser.token & 255]); + const left = parser.token === 69271571 + ? parseArrayExpressionOrPattern(parser, context, scope, 1, 0, 1, type, origin, start, line, column) + : parseObjectLiteralOrPattern(parser, context, scope, 1, 0, 1, type, origin, start, line, column); + if (parser.destructible & 16) + report(parser, 47); + if (parser.destructible & 32) + report(parser, 47); + return left; +} +function parseAndClassifyIdentifier(parser, context, scope, kind, origin, start, line, column) { + const { tokenValue, token } = parser; + if (context & 1024) { + if ((token & 537079808) === 537079808) { + report(parser, 115); + } + else if ((token & 36864) === 36864) { + report(parser, 114); + } + } + if ((token & 20480) === 20480) { + report(parser, 99); + } + if (context & (2048 | 2097152) && token === 241773) { + report(parser, 30); + } + if (token === 241739) { + if (kind & (8 | 16)) + report(parser, 97); + } + if (context & (4194304 | 2048) && token === 209008) { + report(parser, 95); + } + nextToken(parser, context); + if (scope) + addVarOrBlock(parser, context, scope, tokenValue, kind, origin); + return finishNode(parser, context, start, line, column, { + type: 'Identifier', + name: tokenValue + }); +} +function parseJSXRootElementOrFragment(parser, context, inJSXChild, start, line, column) { + nextToken(parser, context); + if (parser.token === 8456259) { + return finishNode(parser, context, start, line, column, { + type: 'JSXFragment', + openingFragment: parseOpeningFragment(parser, context, start, line, column), + children: parseJSXChildren(parser, context), + closingFragment: parseJSXClosingFragment(parser, context, inJSXChild, parser.tokenPos, parser.linePos, parser.colPos) + }); + } + let closingElement = null; + let children = []; + const openingElement = parseJSXOpeningFragmentOrSelfCloseElement(parser, context, inJSXChild, start, line, column); + if (!openingElement.selfClosing) { + children = parseJSXChildren(parser, context); + closingElement = parseJSXClosingElement(parser, context, inJSXChild, parser.tokenPos, parser.linePos, parser.colPos); + const close = isEqualTagName(closingElement.name); + if (isEqualTagName(openingElement.name) !== close) + report(parser, 149, close); + } + return finishNode(parser, context, start, line, column, { + type: 'JSXElement', + children, + openingElement, + closingElement + }); +} +function parseOpeningFragment(parser, context, start, line, column) { + scanJSXToken(parser, context); + return finishNode(parser, context, start, line, column, { + type: 'JSXOpeningFragment' + }); +} +function parseJSXClosingElement(parser, context, inJSXChild, start, line, column) { + consume(parser, context, 25); + const name = parseJSXElementName(parser, context, parser.tokenPos, parser.linePos, parser.colPos); + if (inJSXChild) { + consume(parser, context, 8456259); + } + else { + parser.token = scanJSXToken(parser, context); + } + return finishNode(parser, context, start, line, column, { + type: 'JSXClosingElement', + name + }); +} +function parseJSXClosingFragment(parser, context, inJSXChild, start, line, column) { + consume(parser, context, 25); + if (inJSXChild) { + consume(parser, context, 8456259); + } + else { + consume(parser, context, 8456259); + } + return finishNode(parser, context, start, line, column, { + type: 'JSXClosingFragment' + }); +} +function parseJSXChildren(parser, context) { + const children = []; + while (parser.token !== 25) { + parser.index = parser.tokenPos = parser.startPos; + parser.column = parser.colPos = parser.startColumn; + parser.line = parser.linePos = parser.startLine; + scanJSXToken(parser, context); + children.push(parseJSXChild(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); + } + return children; +} +function parseJSXChild(parser, context, start, line, column) { + if (parser.token === 138) + return parseJSXText(parser, context, start, line, column); + if (parser.token === 2162700) + return parseJSXExpressionContainer(parser, context, 0, 0, start, line, column); + if (parser.token === 8456258) + return parseJSXRootElementOrFragment(parser, context, 0, start, line, column); + report(parser, 0); +} +function parseJSXText(parser, context, start, line, column) { + scanJSXToken(parser, context); + const node = { + type: 'JSXText', + value: parser.tokenValue + }; + if (context & 512) { + node.raw = parser.tokenRaw; + } + return finishNode(parser, context, start, line, column, node); +} +function parseJSXOpeningFragmentOrSelfCloseElement(parser, context, inJSXChild, start, line, column) { + if ((parser.token & 143360) !== 143360 && (parser.token & 4096) !== 4096) + report(parser, 0); + const tagName = parseJSXElementName(parser, context, parser.tokenPos, parser.linePos, parser.colPos); + const attributes = parseJSXAttributes(parser, context); + const selfClosing = parser.token === 8457016; + if (parser.token === 8456259) { + scanJSXToken(parser, context); + } + else { + consume(parser, context, 8457016); + if (inJSXChild) { + consume(parser, context, 8456259); + } + else { + scanJSXToken(parser, context); + } + } + return finishNode(parser, context, start, line, column, { + type: 'JSXOpeningElement', + name: tagName, + attributes, + selfClosing + }); +} +function parseJSXElementName(parser, context, start, line, column) { + scanJSXIdentifier(parser); + let key = parseJSXIdentifier(parser, context, start, line, column); + if (parser.token === 21) + return parseJSXNamespacedName(parser, context, key, start, line, column); + while (consumeOpt(parser, context, 67108877)) { + scanJSXIdentifier(parser); + key = parseJSXMemberExpression(parser, context, key, start, line, column); + } + return key; +} +function parseJSXMemberExpression(parser, context, object, start, line, column) { + const property = parseJSXIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, { + type: 'JSXMemberExpression', + object, + property + }); +} +function parseJSXAttributes(parser, context) { + const attributes = []; + while (parser.token !== 8457016 && parser.token !== 8456259 && parser.token !== 1048576) { + attributes.push(parseJsxAttribute(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); + } + return attributes; +} +function parseJSXSpreadAttribute(parser, context, start, line, column) { + nextToken(parser, context); + consume(parser, context, 14); + const expression = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context, 1074790415); + return finishNode(parser, context, start, line, column, { + type: 'JSXSpreadAttribute', + argument: expression + }); +} +function parseJsxAttribute(parser, context, start, line, column) { + if (parser.token === 2162700) + return parseJSXSpreadAttribute(parser, context, start, line, column); + scanJSXIdentifier(parser); + let value = null; + let name = parseJSXIdentifier(parser, context, start, line, column); + if (parser.token === 21) { + name = parseJSXNamespacedName(parser, context, name, start, line, column); + } + if (parser.token === 1077936157) { + const token = scanJSXAttributeValue(parser, context); + const { tokenPos, linePos, colPos } = parser; + switch (token) { + case 134283267: + value = parseLiteral(parser, context); + break; + case 8456258: + value = parseJSXRootElementOrFragment(parser, context, 1, tokenPos, linePos, colPos); + break; + case 2162700: + value = parseJSXExpressionContainer(parser, context, 1, 1, tokenPos, linePos, colPos); + break; + default: + report(parser, 148); + } + } + return finishNode(parser, context, start, line, column, { + type: 'JSXAttribute', + value, + name + }); +} +function parseJSXNamespacedName(parser, context, namespace, start, line, column) { + consume(parser, context, 21); + const name = parseJSXIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos); + return finishNode(parser, context, start, line, column, { + type: 'JSXNamespacedName', + namespace, + name + }); +} +function parseJSXExpressionContainer(parser, context, inJSXChild, isAttr, start, line, column) { + nextToken(parser, context); + const { tokenPos, linePos, colPos } = parser; + if (parser.token === 14) + return parseJSXSpreadChild(parser, context, tokenPos, linePos, colPos); + let expression = null; + if (parser.token === 1074790415) { + if (isAttr) + report(parser, 151); + expression = parseJSXEmptyExpression(parser, context, parser.startPos, parser.startLine, parser.startColumn); + } + else { + expression = parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos); + } + if (inJSXChild) { + consume(parser, context, 1074790415); + } + else { + scanJSXToken(parser, context); + } + return finishNode(parser, context, start, line, column, { + type: 'JSXExpressionContainer', + expression + }); +} +function parseJSXSpreadChild(parser, context, start, line, column) { + consume(parser, context, 14); + const expression = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); + consume(parser, context, 1074790415); + return finishNode(parser, context, start, line, column, { + type: 'JSXSpreadChild', + expression + }); +} +function parseJSXEmptyExpression(parser, context, start, line, column) { + parser.startPos = parser.tokenPos; + parser.startLine = parser.linePos; + parser.startColumn = parser.colPos; + return finishNode(parser, context, start, line, column, { + type: 'JSXEmptyExpression' + }); +} +function parseJSXIdentifier(parser, context, start, line, column) { + const { tokenValue } = parser; + nextToken(parser, context); + return finishNode(parser, context, start, line, column, { + type: 'JSXIdentifier', + name: tokenValue + }); +} + +var estree = /*#__PURE__*/Object.freeze({ + __proto__: null +}); + +var version$1 = "4.2.0"; + +const version = version$1; +function parseScript(source, options) { + return parseSource(source, options, 0); +} +function parseModule(source, options) { + return parseSource(source, options, 1024 | 2048); +} +function parse(source, options) { + return parseSource(source, options, 0); +} + + + + +/***/ }), +/* 31 */ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +// ------------------------------------------------------------- +// WARNING: this file is used by both the client and the server. +// Do not use any browser or node-specific API! +// ------------------------------------------------------------- + +/* + Copyright (C) 2014 Ivan Nikulin + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2012-2013 Michael Ficarra + Copyright (C) 2012-2013 Mathias Bynens + Copyright (C) 2013 Irakli Gozalishvili + Copyright (C) 2012 Robert Gust-Bardon + Copyright (C) 2012 John Freeman + Copyright (C) 2011-2012 Ariya Hidayat + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Arpad Borsos + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + + +var isArray, + json, + renumber, + hexadecimal, + quotes, + escapeless, + parentheses, + semicolons, + safeConcatenation, + directive, + extra, + parse; + +var Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', + ComprehensionExpression: 'ComprehensionExpression', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportBatchSpecifier: 'ExportBatchSpecifier', + ExportDeclaration: 'ExportDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportSpecifier: 'ImportSpecifier', + ImportDeclaration: 'ImportDeclaration', + ChainExpression: 'ChainExpression', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleDeclaration: 'ModuleDeclaration', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' +}; + +exports.Syntax = Syntax; + +var Precedence = { + Sequence: 0, + Yield: 1, + Assignment: 1, + Conditional: 2, + ArrowFunction: 2, + Coalesce: 3, + LogicalOR: 3, + LogicalAND: 4, + BitwiseOR: 5, + BitwiseXOR: 6, + BitwiseAND: 7, + Equality: 8, + Relational: 9, + BitwiseSHIFT: 10, + Additive: 11, + Multiplicative: 12, + Unary: 13, + Exponentiation: 14, + Postfix: 14, + Await: 14, + Call: 15, + New: 16, + TaggedTemplate: 17, + OptionalChaining: 17, + Member: 18, + Primary: 19 +}; + +var BinaryPrecedence = { + '||': Precedence.LogicalOR, + '&&': Precedence.LogicalAND, + '|': Precedence.BitwiseOR, + '^': Precedence.BitwiseXOR, + '&': Precedence.BitwiseAND, + '==': Precedence.Equality, + '!=': Precedence.Equality, + '===': Precedence.Equality, + '!==': Precedence.Equality, + 'is': Precedence.Equality, + 'isnt': Precedence.Equality, + '<': Precedence.Relational, + '>': Precedence.Relational, + '<=': Precedence.Relational, + '>=': Precedence.Relational, + 'in': Precedence.Relational, + 'instanceof': Precedence.Relational, + '<<': Precedence.BitwiseSHIFT, + '>>': Precedence.BitwiseSHIFT, + '>>>': Precedence.BitwiseSHIFT, + '+': Precedence.Additive, + '-': Precedence.Additive, + '*': Precedence.Multiplicative, + '%': Precedence.Multiplicative, + '/': Precedence.Multiplicative, + '??': Precedence.Coalesce, + '**': Precedence.Exponentiation +}; + +function getDefaultOptions () { + // default options + return { + indent: null, + base: null, + parse: null, + format: { + indent: { + style: ' ', + base: 0 + }, + newline: '\n', + space: ' ', + json: false, + renumber: false, + hexadecimal: false, + quotes: 'single', + escapeless: false, + compact: false, + parentheses: true, + semicolons: true, + safeConcatenation: false + }, + directive: false, + raw: true, + verbatim: null + }; +} + +//-------------------------------------------------===------------------------------------------------------ +// Lexical utils +//-------------------------------------------------===------------------------------------------------------ + +//Const +var NON_ASCII_WHITESPACES = [ + 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, + 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, + 0xFEFF +]; + +//Regular expressions +var NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP = new RegExp( + '[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376' + + '\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-' + + '\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA' + + '\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-' + + '\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-' + + '\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-' + + '\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-' + + '\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38' + + '\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83' + + '\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9' + + '\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-' + + '\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-' + + '\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E' + + '\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-' + + '\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-' + + '\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-' + + '\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE' + + '\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44' + + '\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-' + + '\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A' + + '\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-' + + '\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9' + + '\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84' + + '\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-' + + '\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5' + + '\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-' + + '\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-' + + '\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD' + + '\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B' + + '\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E' + + '\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-' + + '\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-' + + '\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-' + + '\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F' + + '\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115' + + '\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188' + + '\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-' + + '\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-' + + '\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A' + + '\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5' + + '\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697' + + '\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873' + + '\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-' + + '\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-' + + '\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC' + + '\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-' + + '\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D' + + '\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74' + + '\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-' + + '\uFFD7\uFFDA-\uFFDC]' +); + + +//Methods +function isIdentifierCh (cp) { + if (cp < 0x80) { + return cp >= 97 && cp <= 122 || // a..z + cp >= 65 && cp <= 90 || // A..Z + cp >= 48 && cp <= 57 || // 0..9 + cp === 36 || cp === 95 || // $ (dollar) and _ (underscore) + cp === 92; // \ (backslash) + } + + var ch = String.fromCharCode(cp); + + return NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP.test(ch); +} + +function isLineTerminator (cp) { + return cp === 0x0A || cp === 0x0D || cp === 0x2028 || cp === 0x2029; +} + +function isWhitespace (cp) { + return cp === 0x20 || cp === 0x09 || isLineTerminator(cp) || cp === 0x0B || cp === 0x0C || cp === 0xA0 || + (cp >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(cp) >= 0); +} + +function isDecimalDigit (cp) { + return cp >= 48 && cp <= 57; +} + +function stringRepeat (str, num) { + var result = ''; + + for (num |= 0; num > 0; num >>>= 1, str += str) { + if (num & 1) { + result += str; + } + } + + return result; +} + +isArray = Array.isArray; +if (!isArray) { + isArray = function isArray (array) { + return Object.prototype.toString.call(array) === '[object Array]'; + }; +} + + +function updateDeeply (target, override) { + var key, val; + + function isHashObject (target) { + return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); + } + + for (key in override) { + if (override.hasOwnProperty(key)) { + val = override[key]; + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } + else { + target[key] = updateDeeply({}, val); + } + } + else { + target[key] = val; + } + } + } + return target; +} + +function generateNumber (value) { + var result, point, temp, exponent, pos; + + if (value === 1 / 0) { + return json ? 'null' : renumber ? '1e400' : '1e+400'; + } + + result = '' + value; + if (!renumber || result.length < 3) { + return result; + } + + point = result.indexOf('.'); + //NOTE: 0x30 == '0' + if (!json && result.charCodeAt(0) === 0x30 && point === 1) { + point = 0; + result = result.slice(1); + } + temp = result; + result = result.replace('e+', 'e'); + exponent = 0; + if ((pos = temp.indexOf('e')) > 0) { + exponent = +temp.slice(pos + 1); + temp = temp.slice(0, pos); + } + if (point >= 0) { + exponent -= temp.length - point - 1; + temp = +(temp.slice(0, point) + temp.slice(point + 1)) + ''; + } + pos = 0; + + //NOTE: 0x30 == '0' + while (temp.charCodeAt(temp.length + pos - 1) === 0x30) { + --pos; + } + if (pos !== 0) { + exponent -= pos; + temp = temp.slice(0, pos); + } + if (exponent !== 0) { + temp += 'e' + exponent; + } + if ((temp.length < result.length || + (hexadecimal && value > 1e12 && Math.floor(value) === value && + (temp = '0x' + value.toString(16)).length + < result.length)) && + +temp === value) { + result = temp; + } + + return result; +} + +// Generate valid RegExp expression. +// This function is based on https://github.com/Constellation/iv Engine + +function escapeRegExpCharacter (ch, previousIsBackslash) { + // not handling '\' and handling \u2028 or \u2029 to unicode escape sequence + if ((ch & ~1) === 0x2028) { + return (previousIsBackslash ? 'u' : '\\u') + ((ch === 0x2028) ? '2028' : '2029'); + } + else if (ch === 10 || ch === 13) { // \n, \r + return (previousIsBackslash ? '' : '\\') + ((ch === 10) ? 'n' : 'r'); + } + return String.fromCharCode(ch); +} + +function generateRegExp (reg) { + var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash; + + result = reg.toString(); + + if (reg.source) { + // extract flag from toString result + match = result.match(/\/([^/]*)$/); + if (!match) { + return result; + } + + flags = match[1]; + result = ''; + + characterInBrack = false; + previousIsBackslash = false; + for (i = 0, iz = reg.source.length; i < iz; ++i) { + ch = reg.source.charCodeAt(i); + + if (!previousIsBackslash) { + if (characterInBrack) { + if (ch === 93) { // ] + characterInBrack = false; + } + } + else { + if (ch === 47) { // / + result += '\\'; + } + else if (ch === 91) { // [ + characterInBrack = true; + } + } + result += escapeRegExpCharacter(ch, previousIsBackslash); + previousIsBackslash = ch === 92; // \ + } + else { + // if new RegExp("\\\n') is provided, create /\n/ + result += escapeRegExpCharacter(ch, previousIsBackslash); + // prevent like /\\[/]/ + previousIsBackslash = false; + } + } + + return '/' + result + '/' + flags; + } + + return result; +} + +function escapeAllowedCharacter (code, next) { + var hex, result = '\\'; + + switch (code) { + case 0x08: // \b + result += 'b'; + break; + case 0x0C: // \f + result += 'f'; + break; + case 0x09: // \t + result += 't'; + break; + default: + hex = code.toString(16).toUpperCase(); + if (json || code > 0xFF) { + result += 'u' + '0000'.slice(hex.length) + hex; + } + + else if (code === 0x0000 && !isDecimalDigit(next)) { + result += '0'; + } + + else if (code === 0x000B) { // \v + result += 'x0B'; + } + + else { + result += 'x' + '00'.slice(hex.length) + hex; + } + break; + } + + return result; +} + +function escapeDisallowedCharacter (code) { + var result = '\\'; + switch (code) { + case 0x5C // \ + : + result += '\\'; + break; + case 0x0A // \n + : + result += 'n'; + break; + case 0x0D // \r + : + result += 'r'; + break; + case 0x2028: + result += 'u2028'; + break; + case 0x2029: + result += 'u2029'; + break; + } + + return result; +} + +function escapeDirective (str) { + var i, iz, code, quote; + + quote = quotes === 'double' ? '"' : '\''; + for (i = 0, iz = str.length; i < iz; ++i) { + code = str.charCodeAt(i); + if (code === 0x27) { // ' + quote = '"'; + break; + } + else if (code === 0x22) { // " + quote = '\''; + break; + } + else if (code === 0x5C) { // \ + ++i; + } + } + + return quote + str + quote; +} + +function escapeString (str) { + var result = '', i, len, code, singleQuotes = 0, doubleQuotes = 0, single, quote; + //TODO http://jsperf.com/character-counting/8 + for (i = 0, len = str.length; i < len; ++i) { + code = str.charCodeAt(i); + if (code === 0x27) { // ' + ++singleQuotes; + } + else if (code === 0x22) { // " + ++doubleQuotes; + } + else if (code === 0x2F && json) { // / + result += '\\'; + } + else if (isLineTerminator(code) || code === 0x5C) { // \ + result += escapeDisallowedCharacter(code); + continue; + } + else if ((json && code < 0x20) || // SP + !(json || escapeless || (code >= 0x20 && code <= 0x7E))) { // SP, ~ + result += escapeAllowedCharacter(code, str.charCodeAt(i + 1)); + continue; + } + result += String.fromCharCode(code); + } + + single = !(quotes === 'double' || (quotes === 'auto' && doubleQuotes < singleQuotes)); + quote = single ? '\'' : '"'; + + if (!(single ? singleQuotes : doubleQuotes)) { + return quote + result + quote; + } + + str = result; + result = quote; + + for (i = 0, len = str.length; i < len; ++i) { + code = str.charCodeAt(i); + if ((code === 0x27 && single) || (code === 0x22 && !single)) { // ', " + result += '\\'; + } + result += String.fromCharCode(code); + } + + return result + quote; +} + + +function join (l, r) { + if (!l.length) + return r; + + if (!r.length) + return l; + + var lCp = l.charCodeAt(l.length - 1), + rCp = r.charCodeAt(0); + + if (isIdentifierCh(lCp) && isIdentifierCh(rCp) || + lCp === rCp && (lCp === 0x2B || lCp === 0x2D) || // + +, - - + lCp === 0x2F && rCp === 0x69) { // /re/ instanceof foo + return l + _.space + r; + } + + else if (isWhitespace(lCp) || isWhitespace(rCp)) + return l + r; + + return l + _.optSpace + r; +} + +function shiftIndent () { + var prevIndent = _.indent; + + _.indent += _.indentUnit; + return prevIndent; +} + +function adoptionPrefix ($stmt) { + if ($stmt.type === Syntax.BlockStatement) + return _.optSpace; + + if ($stmt.type === Syntax.EmptyStatement) + return ''; + + return _.newline + _.indent + _.indentUnit; +} + +function adoptionSuffix ($stmt) { + if ($stmt.type === Syntax.BlockStatement) + return _.optSpace; + + return _.newline + _.indent; +} + +//Subentities generators +function generateVerbatim ($expr, settings) { + var verbatim = $expr[extra.verbatim], + strVerbatim = typeof verbatim === 'string', + precedence = !strVerbatim && + verbatim.precedence !== void 0 ? verbatim.precedence : Precedence.Sequence, + parenthesize = precedence < settings.precedence, + content = strVerbatim ? verbatim : verbatim.content, + chunks = content.split(/\r\n|\n/), + chunkCount = chunks.length; + + if (parenthesize) + _.js += '('; + + _.js += chunks[0]; + + for (var i = 1; i < chunkCount; i++) + _.js += _.newline + _.indent + chunks[i]; + + if (parenthesize) + _.js += ')'; +} + +function generateFunctionParams ($node) { + var $params = $node.params, + paramCount = $params.length, + lastParamIdx = paramCount - 1, + arrowFuncWithoutParentheses = $node.type === Syntax.ArrowFunctionExpression && paramCount === 1 && + $params[0].type === Syntax.Identifier; + + //NOTE: arg => { } case + if (arrowFuncWithoutParentheses) + _.js += $params[0].name; + + else { + _.js += '('; + + for (var i = 0; i < paramCount; ++i) { + var $param = $params[i]; + + if ($params[i].type === Syntax.Identifier) + _.js += $param.name; + + else + ExprGen[$param.type]($param, Preset.e4); + + if (i !== lastParamIdx) + _.js += ',' + _.optSpace; + } + + _.js += ')'; + } +} + +function generateFunctionBody ($node) { + var $body = $node.body; + + generateFunctionParams($node); + + if ($node.type === Syntax.ArrowFunctionExpression) + _.js += _.optSpace + '=>'; + + if ($node.expression) { + _.js += _.optSpace; + + var exprJs = exprToJs($body, Preset.e4); + + if (exprJs.charAt(0) === '{') + exprJs = '(' + exprJs + ')'; + + _.js += exprJs; + } + + else { + _.js += adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s8); + } +} + + +//-------------------------------------------------===------------------------------------------------------ +// Syntactic entities generation presets +//-------------------------------------------------===------------------------------------------------------ + +var Preset = { + e1: function (allowIn) { + return { + precedence: Precedence.Assignment, + allowIn: allowIn, + allowCall: true, + allowUnparenthesizedNew: true + }; + }, + + e2: function (allowIn) { + return { + precedence: Precedence.LogicalOR, + allowIn: allowIn, + allowCall: true, + allowUnparenthesizedNew: true + }; + }, + + e3: { + precedence: Precedence.Call, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: false + }, + + e4: { + precedence: Precedence.Assignment, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e5: { + precedence: Precedence.Sequence, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e6: function (allowUnparenthesizedNew) { + return { + precedence: Precedence.New, + allowIn: true, + allowCall: false, + allowUnparenthesizedNew: allowUnparenthesizedNew + }; + }, + + e7: { + precedence: Precedence.Unary, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e8: { + precedence: Precedence.Postfix, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e9: { + precedence: void 0, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e10: { + precedence: Precedence.Call, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + e11: function (allowCall) { + return { + precedence: Precedence.Call, + allowIn: true, + allowCall: allowCall, + allowUnparenthesizedNew: false + }; + }, + + e12: { + precedence: Precedence.Primary, + allowIn: false, + allowCall: false, + allowUnparenthesizedNew: true + }, + + e13: { + precedence: Precedence.Primary, + allowIn: true, + allowCall: true, + allowUnparenthesizedNew: true + }, + + + e14: { + precedence: Precedence.Sequence, + allowIn: false, + allowCall: true, + allowUnparenthesizedNew: true + }, + + + e15: function (allowCall) { + return { + precedence: Precedence.Sequence, + allowIn: true, + allowCall: allowCall, + allowUnparenthesizedNew: true + }; + }, + + e16: function (precedence, allowIn) { + return { + precedence: precedence, + allowIn: allowIn, + allowCall: true, + allowUnparenthesizedNew: true + }; + }, + + e17: function (allowIn) { + return { + precedence: Precedence.Call, + allowIn: allowIn, + allowCall: true, + allowUnparenthesizedNew: true + } + }, + + e18: function (allowIn) { + return { + precedence: Precedence.Assignment, + allowIn: allowIn, + allowCall: true, + allowUnparenthesizedNew: true + } + }, + + e19: { + precedence: Precedence.Sequence, + allowIn: true, + allowCall: true, + semicolonOptional: false + }, + + e20: { + precedence: Precedence.Await, + allowCall: true + }, + + s1: function (functionBody, semicolonOptional) { + return { + allowIn: true, + functionBody: false, + directiveContext: functionBody, + semicolonOptional: semicolonOptional + }; + }, + + s2: { + allowIn: true, + functionBody: false, + directiveContext: false, + semicolonOptional: true + }, + + s3: function (allowIn) { + return { + allowIn: allowIn, + functionBody: false, + directiveContext: false, + semicolonOptional: false + }; + }, + + s4: function (semicolonOptional) { + return { + allowIn: true, + functionBody: false, + directiveContext: false, + semicolonOptional: semicolonOptional + }; + }, + + s5: function (semicolonOptional) { + return { + allowIn: true, + functionBody: false, + directiveContext: true, + semicolonOptional: semicolonOptional, + }; + }, + + s6: { + allowIn: false, + functionBody: false, + directiveContext: false, + semicolonOptional: false + }, + + s7: { + allowIn: true, + functionBody: false, + directiveContext: false, + semicolonOptional: false + }, + + s8: { + allowIn: true, + functionBody: true, + directiveContext: false, + semicolonOptional: false + } +}; + + +//-------------------------------------------------===------------------------------------------------------- +// Expressions +//-------------------------------------------------===------------------------------------------------------- + +//Regular expressions +var FLOATING_OR_OCTAL_REGEXP = /[.eExX]|^0[0-9]+/, + LAST_DECIMAL_DIGIT_REGEXP = /[0-9]$/; + + +//Common expression generators +function generateLogicalOrBinaryExpression ($expr, settings) { + var op = $expr.operator, + precedence = BinaryPrecedence[$expr.operator], + parenthesize = precedence < settings.precedence, + allowIn = settings.allowIn || parenthesize, + operandGenSettings = Preset.e16(precedence, allowIn), + exprJs = exprToJs($expr.left, operandGenSettings); + + parenthesize |= op === 'in' && !allowIn; + + if (parenthesize) + _.js += '('; + + // 0x2F = '/' + if (exprJs.charCodeAt(exprJs.length - 1) === 0x2F && isIdentifierCh(op.charCodeAt(0))) + exprJs = exprJs + _.space + op; + + else + exprJs = join(exprJs, op); + + operandGenSettings.precedence++; + + var rightJs = exprToJs($expr.right, operandGenSettings); + + //NOTE: If '/' concats with '/' or `<` concats with `!--`, it is interpreted as comment start + if (op === '/' && rightJs.charAt(0) === '/' || op.slice(-1) === '<' && rightJs.slice(0, 3) === '!--') + exprJs += _.space + rightJs; + + else + exprJs = join(exprJs, rightJs); + + _.js += exprJs; + + if (parenthesize) + _.js += ')'; +} + +function generateArrayPatternOrExpression ($expr) { + var $elems = $expr.elements, + elemCount = $elems.length; + + if (elemCount) { + var lastElemIdx = elemCount - 1, + multiline = elemCount > 1, + prevIndent = shiftIndent(), + itemPrefix = _.newline + _.indent; + + _.js += '['; + + for (var i = 0; i < elemCount; i++) { + var $elem = $elems[i]; + + if (multiline) + _.js += itemPrefix; + + if ($elem) + ExprGen[$elem.type]($elem, Preset.e4); + + if (i !== lastElemIdx || !$elem) + _.js += ','; + } + + _.indent = prevIndent; + + if (multiline) + _.js += _.newline + _.indent; + + _.js += ']'; + } + + else + _.js += '[]'; +} + +function generateGeneratorOrComprehensionExpression ($expr) { + //NOTE: GeneratorExpression should be parenthesized with (...), ComprehensionExpression with [...] + var $blocks = $expr.blocks, + $filter = $expr.filter, + isGenerator = $expr.type === Syntax.GeneratorExpression, + exprJs = isGenerator ? '(' : '[', + bodyJs = exprToJs($expr.body, Preset.e4); + + if ($blocks) { + var prevIndent = shiftIndent(), + blockCount = $blocks.length; + + for (var i = 0; i < blockCount; ++i) { + var blockJs = exprToJs($blocks[i], Preset.e5); + + exprJs = i > 0 ? join(exprJs, blockJs) : (exprJs + blockJs); + } + + _.indent = prevIndent; + } + + if ($filter) { + var filterJs = exprToJs($filter, Preset.e5); + + exprJs = join(exprJs, 'if' + _.optSpace); + exprJs = join(exprJs, '(' + filterJs + ')'); + } + + exprJs = join(exprJs, bodyJs); + exprJs += isGenerator ? ')' : ']'; + + _.js += exprJs; +} + + +//Expression raw generator dictionary +var ExprRawGen = { + SequenceExpression: function generateSequenceExpression ($expr, settings) { + var $children = $expr.expressions, + childrenCount = $children.length, + lastChildIdx = childrenCount - 1, + parenthesize = Precedence.Sequence < settings.precedence, + exprGenSettings = Preset.e1(settings.allowIn || parenthesize); + + if (parenthesize) + _.js += '('; + + for (var i = 0; i < childrenCount; i++) { + var $child = $children[i]; + + ExprGen[$child.type]($child, exprGenSettings); + + if (i !== lastChildIdx) + _.js += ',' + _.optSpace; + } + + if (parenthesize) + _.js += ')'; + }, + + AssignmentExpression: function generateAssignmentExpression ($expr, settings) { + var $left = $expr.left, + $right = $expr.right, + parenthesize = Precedence.Assignment < settings.precedence, + allowIn = settings.allowIn || parenthesize; + + if (parenthesize) + _.js += '('; + + ExprGen[$left.type]($left, Preset.e17(allowIn)); + _.js += _.optSpace + $expr.operator + _.optSpace; + ExprGen[$right.type]($right, Preset.e18(allowIn)); + + if (parenthesize) + _.js += ')'; + }, + + AssignmentPattern: function generateAssignmentPattern ($node) { + var $fakeAssign = { + left: $node.left, + right: $node.right, + operator: '=' + }; + + ExprGen.AssignmentExpression($fakeAssign, Preset.e4); + }, + + ArrowFunctionExpression: function generateArrowFunctionExpression ($expr, settings) { + var parenthesize = Precedence.ArrowFunction < settings.precedence; + + if (parenthesize) + _.js += '('; + + if ($expr.async) + _.js += 'async '; + + generateFunctionBody($expr); + + if (parenthesize) + _.js += ')'; + }, + + AwaitExpression: function generateAwaitExpression ($expr, settings) { + var parenthesize = Precedence.Await < settings.precedence; + + if (parenthesize) + _.js += '('; + + _.js += $expr.all ? 'await* ' : 'await '; + + ExprGen[$expr.argument.type]($expr.argument, Preset.e20); + + if (parenthesize) + _.js += ')'; + }, + + ConditionalExpression: function generateConditionalExpression ($expr, settings) { + var $test = $expr.test, + $conseq = $expr.consequent, + $alt = $expr.alternate, + parenthesize = Precedence.Conditional < settings.precedence, + allowIn = settings.allowIn || parenthesize, + testGenSettings = Preset.e2(allowIn), + branchGenSettings = Preset.e1(allowIn); + + if (parenthesize) + _.js += '('; + + ExprGen[$test.type]($test, testGenSettings); + _.js += _.optSpace + '?' + _.optSpace; + ExprGen[$conseq.type]($conseq, branchGenSettings); + _.js += _.optSpace + ':' + _.optSpace; + ExprGen[$alt.type]($alt, branchGenSettings); + + if (parenthesize) + _.js += ')'; + }, + + LogicalExpression: generateLogicalOrBinaryExpression, + + BinaryExpression: generateLogicalOrBinaryExpression, + + CallExpression: function generateCallExpression ($expr, settings) { + var $callee = $expr.callee, + $args = $expr['arguments'], + argCount = $args.length, + lastArgIdx = argCount - 1, + parenthesize = !settings.allowCall || Precedence.Call < settings.precedence; + + if (parenthesize) + _.js += '('; + + ExprGen[$callee.type]($callee, Preset.e3); + + if ($expr.optional) + _.js += '?.'; + + _.js += '('; + + for (var i = 0; i < argCount; ++i) { + var $arg = $args[i]; + + ExprGen[$arg.type]($arg, Preset.e4); + + if (i !== lastArgIdx) + _.js += ',' + _.optSpace; + } + + _.js += ')'; + + if (parenthesize) + _.js += ')'; + }, + + NewExpression: function generateNewExpression ($expr, settings) { + var $args = $expr['arguments'], + parenthesize = Precedence.New < settings.precedence, + argCount = $args.length, + lastArgIdx = argCount - 1, + withCall = !settings.allowUnparenthesizedNew || parentheses || argCount > 0, + calleeJs = exprToJs($expr.callee, Preset.e6(!withCall)); + + if (parenthesize) + _.js += '('; + + _.js += join('new', calleeJs); + + if (withCall) { + _.js += '('; + + for (var i = 0; i < argCount; ++i) { + var $arg = $args[i]; + + ExprGen[$arg.type]($arg, Preset.e4); + + if (i !== lastArgIdx) + _.js += ',' + _.optSpace; + } + + _.js += ')'; + } + + if (parenthesize) + _.js += ')'; + }, + + MemberExpression: function generateMemberExpression ($expr, settings) { + var $obj = $expr.object, + $prop = $expr.property, + parenthesize = Precedence.Member < settings.precedence, + isNumObj = !$expr.computed && $obj.type === Syntax.Literal && typeof $obj.value === 'number'; + + if (parenthesize) + _.js += '('; + + if (isNumObj) { + + //NOTE: When the following conditions are all true: + // 1. No floating point + // 2. Don't have exponents + // 3. The last character is a decimal digit + // 4. Not hexadecimal OR octal number literal + // then we should add a floating point. + + var numJs = exprToJs($obj, Preset.e11(settings.allowCall)), + withPoint = LAST_DECIMAL_DIGIT_REGEXP.test(numJs) && !FLOATING_OR_OCTAL_REGEXP.test(numJs); + + _.js += withPoint ? (numJs + '.') : numJs; + } + + else + ExprGen[$obj.type]($obj, Preset.e11(settings.allowCall)); + + if ($expr.computed) { + if ($expr.optional) + _.js += '?.'; + + _.js += '['; + ExprGen[$prop.type]($prop, Preset.e15(settings.allowCall)); + _.js += ']'; + } + + else + _.js += ($expr.optional ? '?.' : '.') + $prop.name; + + if (parenthesize) + _.js += ')'; + }, + + UnaryExpression: function generateUnaryExpression ($expr, settings) { + var parenthesize = Precedence.Unary < settings.precedence, + op = $expr.operator, + argJs = exprToJs($expr.argument, Preset.e7); + + if (parenthesize) + _.js += '('; + + //NOTE: delete, void, typeof + // get `typeof []`, not `typeof[]` + if (_.optSpace === '' || op.length > 2) + _.js += join(op, argJs); + + else { + _.js += op; + + //NOTE: Prevent inserting spaces between operator and argument if it is unnecessary + // like, `!cond` + var leftCp = op.charCodeAt(op.length - 1), + rightCp = argJs.charCodeAt(0); + + // 0x2B = '+', 0x2D = '-' + if (leftCp === rightCp && (leftCp === 0x2B || leftCp === 0x2D) || + isIdentifierCh(leftCp) && isIdentifierCh(rightCp)) { + _.js += _.space; + } + + _.js += argJs; + } + + if (parenthesize) + _.js += ')'; + }, + + YieldExpression: function generateYieldExpression ($expr, settings) { + var $arg = $expr.argument, + js = $expr.delegate ? 'yield*' : 'yield', + parenthesize = Precedence.Yield < settings.precedence; + + if (parenthesize) + _.js += '('; + + if ($arg) { + var argJs = exprToJs($arg, Preset.e4); + + js = join(js, argJs); + } + + _.js += js; + + if (parenthesize) + _.js += ')'; + }, + + UpdateExpression: function generateUpdateExpression ($expr, settings) { + var $arg = $expr.argument, + $op = $expr.operator, + prefix = $expr.prefix, + precedence = prefix ? Precedence.Unary : Precedence.Postfix, + parenthesize = precedence < settings.precedence; + + if (parenthesize) + _.js += '('; + + if (prefix) { + _.js += $op; + ExprGen[$arg.type]($arg, Preset.e8); + + } + + else { + ExprGen[$arg.type]($arg, Preset.e8); + _.js += $op; + } + + if (parenthesize) + _.js += ')'; + }, + + FunctionExpression: function generateFunctionExpression ($expr) { + var isGenerator = !!$expr.generator; + + if ($expr.async) + _.js += 'async '; + + _.js += isGenerator ? 'function*' : 'function'; + + if ($expr.id) { + _.js += isGenerator ? _.optSpace : _.space; + _.js += $expr.id.name; + } + else + _.js += _.optSpace; + + generateFunctionBody($expr); + }, + + ExportBatchSpecifier: function generateExportBatchSpecifier () { + _.js += '*'; + }, + + ArrayPattern: generateArrayPatternOrExpression, + + ArrayExpression: generateArrayPatternOrExpression, + + ClassExpression: function generateClassExpression ($expr) { + var $id = $expr.id, + $super = $expr.superClass, + $body = $expr.body, + exprJs = 'class'; + + if ($id) { + var idJs = exprToJs($id, Preset.e9); + + exprJs = join(exprJs, idJs); + } + + if ($super) { + var superJs = exprToJs($super, Preset.e4); + + superJs = join('extends', superJs); + exprJs = join(exprJs, superJs); + } + + _.js += exprJs + _.optSpace; + StmtGen[$body.type]($body, Preset.s2); + }, + + MetaProperty: function generateMetaProperty ($expr, settings) { + var $meta = $expr.meta, + $property = $expr.property, + parenthesize = Precedence.Member < settings.precedence; + + if (parenthesize) + _.js += '('; + + _.js += (typeof $meta === "string" ? $meta : $meta.name) + + '.' + (typeof $property === "string" ? $property : $property.name); + + if (parenthesize) + _.js += ')'; + }, + + MethodDefinition: function generateMethodDefinition ($expr) { + var exprJs = $expr['static'] ? 'static' + _.optSpace : '', + keyJs = exprToJs($expr.key, Preset.e5); + + if ($expr.computed) + keyJs = '[' + keyJs + ']'; + + if ($expr.kind === 'get' || $expr.kind === 'set') { + keyJs = join($expr.kind, keyJs); + _.js += join(exprJs, keyJs); + } + + else { + if ($expr.value.generator) + _.js += exprJs + '*' + keyJs; + else if ($expr.value.async) + _.js += exprJs + 'async ' + keyJs; + else + _.js += join(exprJs, keyJs); + } + + generateFunctionBody($expr.value); + }, + + Property: function generateProperty ($expr) { + var $val = $expr.value, + $kind = $expr.kind, + keyJs = exprToJs($expr.key, Preset.e4); + + if ($expr.computed) + keyJs = '[' + keyJs + ']'; + + if ($kind === 'get' || $kind === 'set') { + _.js += $kind + _.space + keyJs; + generateFunctionBody($val); + } + + else { + if ($expr.shorthand) + _.js += keyJs; + + else if ($expr.method) { + if ($val.generator) + keyJs = '*' + keyJs; + else if ($val.async) + keyJs = 'async ' + keyJs; + + _.js += keyJs; + generateFunctionBody($val) + } + + else { + _.js += keyJs + ':' + _.optSpace; + ExprGen[$val.type]($val, Preset.e4); + } + } + }, + + ObjectExpression: function generateObjectExpression ($expr) { + var $props = $expr.properties, + propCount = $props.length; + + if (propCount) { + var lastPropIdx = propCount - 1, + prevIndent = shiftIndent(); + + _.js += '{'; + + for (var i = 0; i < propCount; i++) { + var $prop = $props[i], + propType = $prop.type || Syntax.Property; + + _.js += _.newline + _.indent; + ExprGen[propType]($prop, Preset.e5); + + if (i !== lastPropIdx) + _.js += ','; + } + + _.indent = prevIndent; + _.js += _.newline + _.indent + '}'; + } + + else + _.js += '{}'; + }, + + ObjectPattern: function generateObjectPattern ($expr) { + var $props = $expr.properties, + propCount = $props.length; + + if (propCount) { + var lastPropIdx = propCount - 1, + multiline = false; + + if (propCount === 1) + multiline = $props[0].value.type !== Syntax.Identifier; + + else { + for (var i = 0; i < propCount; i++) { + if (!$props[i].shorthand) { + multiline = true; + break; + } + } + } + + _.js += multiline ? ('{' + _.newline) : '{'; + + var prevIndent = shiftIndent(), + propSuffix = ',' + (multiline ? _.newline : _.optSpace); + + for (var i = 0; i < propCount; i++) { + var $prop = $props[i]; + + if (multiline) + _.js += _.indent; + + ExprGen[$prop.type]($prop, Preset.e5); + + if (i !== lastPropIdx) + _.js += propSuffix; + } + + _.indent = prevIndent; + _.js += multiline ? (_.newline + _.indent + '}') : '}'; + } + else + _.js += '{}'; + }, + + ThisExpression: function generateThisExpression () { + _.js += 'this'; + }, + + Identifier: function generateIdentifier ($expr, precedence, flag) { + _.js += $expr.name; + }, + + ImportExpression: function generateImportExpression ($expr, settings) { + var parenthesize = Precedence.Call < settings.precedence; + var $source = $expr.source; + + if (parenthesize) + _.js += '('; + + _.js += 'import('; + + ExprGen[$source.type]($source, Preset.e4); + + _.js += ')'; + + if (parenthesize) + _.js += ')'; + }, + + ImportSpecifier: function generateImportSpecifier ($expr) { + _.js += $expr.imported.name; + + if ($expr.local) + _.js += _.space + 'as' + _.space + $expr.local.name; + }, + + ExportSpecifier: function generateImportOrExportSpecifier ($expr) { + _.js += $expr.local.name; + + if ($expr.exported) + _.js += _.space + 'as' + _.space + $expr.exported.name; + }, + + ChainExpression: function generateChainExpression ($expr, settings) { + var parenthesize = Precedence.OptionalChaining < settings.precedence; + var $expression = $expr.expression; + + settings = settings || {}; + + var newSettings = { + precedence: Precedence.OptionalChaining, + allowIn: settings.allowIn , + allowCall: settings.allowCall, + + allowUnparenthesizedNew: settings.allowUnparenthesizedNew + } + + if (parenthesize) { + newSettings.allowCall = true; + _.js += '('; + } + + ExprGen[$expression.type]($expression, newSettings); + + if (parenthesize) + _.js += ')'; + }, + + Literal: function generateLiteral ($expr) { + if (extra.raw && $expr.raw !== void 0) + _.js += $expr.raw; + + else if ($expr.value === null) + _.js += 'null'; + + else { + var valueType = typeof $expr.value; + + if (valueType === 'string') + _.js += escapeString($expr.value); + + else if (valueType === 'number') + _.js += generateNumber($expr.value); + + else if (valueType === 'boolean') + _.js += $expr.value ? 'true' : 'false'; + + else + _.js += generateRegExp($expr.value); + } + }, + + GeneratorExpression: generateGeneratorOrComprehensionExpression, + + ComprehensionExpression: generateGeneratorOrComprehensionExpression, + + ComprehensionBlock: function generateComprehensionBlock ($expr) { + var $left = $expr.left, + leftJs = void 0, + rightJs = exprToJs($expr.right, Preset.e5); + + if ($left.type === Syntax.VariableDeclaration) + leftJs = $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6); + + else + leftJs = exprToJs($left, Preset.e10); + + leftJs = join(leftJs, $expr.of ? 'of' : 'in'); + + _.js += 'for' + _.optSpace + '(' + join(leftJs, rightJs) + ')'; + }, + + RestElement: function generateRestElement ($node) { + _.js += '...' + $node.argument.name; + }, + + SpreadElement: function generateSpreadElement ($expr) { + var $arg = $expr.argument; + + _.js += '...'; + ExprGen[$arg.type]($arg, Preset.e4); + }, + + TaggedTemplateExpression: function generateTaggedTemplateExpression ($expr, settings) { + var $tag = $expr.tag, + $quasi = $expr.quasi, + parenthesize = Precedence.TaggedTemplate < settings.precedence; + + if (parenthesize) + _.js += '('; + + ExprGen[$tag.type]($tag, Preset.e11(settings.allowCall)); + ExprGen[$quasi.type]($quasi, Preset.e12); + + if (parenthesize) + _.js += ')'; + }, + + TemplateElement: function generateTemplateElement ($expr) { + //NOTE: Don't use "cooked". Since tagged template can use raw template + // representation. So if we do so, it breaks the script semantics. + _.js += $expr.value.raw; + }, + + TemplateLiteral: function generateTemplateLiteral ($expr) { + var $quasis = $expr.quasis, + $childExprs = $expr.expressions, + quasiCount = $quasis.length, + lastQuasiIdx = quasiCount - 1; + + _.js += '`'; + + for (var i = 0; i < quasiCount; ++i) { + var $quasi = $quasis[i]; + + ExprGen[$quasi.type]($quasi, Preset.e13); + + if (i !== lastQuasiIdx) { + var $childExpr = $childExprs[i]; + + _.js += '${' + _.optSpace; + ExprGen[$childExpr.type]($childExpr, Preset.e5); + _.js += _.optSpace + '}'; + } + } + + _.js += '`'; + }, + + Super: function generateSuper () { + _.js += 'super'; + } +}; + + +//-------------------------------------------------===------------------------------------------------------ +// Statements +//-------------------------------------------------===------------------------------------------------------ + + +//Regular expressions +var EXPR_STMT_UNALLOWED_EXPR_REGEXP = /^{|^class(?:\s|{)|^(async )?function(?:\s|\*|\()/; + + +//Common statement generators +function generateTryStatementHandlers (stmtJs, $finalizer, handlers) { + var handlerCount = handlers.length, + lastHandlerIdx = handlerCount - 1; + + for (var i = 0; i < handlerCount; ++i) { + var handlerJs = stmtToJs(handlers[i], Preset.s7); + + stmtJs = join(stmtJs, handlerJs); + + if ($finalizer || i !== lastHandlerIdx) + stmtJs += adoptionSuffix(handlers[i].body); + } + + return stmtJs; +} + +function generateForStatementIterator ($op, $stmt, settings) { + var $body = $stmt.body, + $left = $stmt.left, + bodySemicolonOptional = !semicolons && settings.semicolonOptional, + prevIndent1 = shiftIndent(), + awaitStr = $stmt.await ? ' await' : '', + stmtJs = 'for' + awaitStr + _.optSpace + '('; + + if ($left.type === Syntax.VariableDeclaration) { + var prevIndent2 = shiftIndent(); + + stmtJs += $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6); + _.indent = prevIndent2; + } + + else + stmtJs += exprToJs($left, Preset.e10); + + stmtJs = join(stmtJs, $op); + + var rightJs = exprToJs($stmt.right, Preset.e4); + + stmtJs = join(stmtJs, rightJs) + ')'; + + _.indent = prevIndent1; + + _.js += stmtJs + adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); +} + + +//Statement generator dictionary +var StmtRawGen = { + BlockStatement: function generateBlockStatement ($stmt, settings) { + var $body = $stmt.body, + len = $body.length, + lastIdx = len - 1, + prevIndent = shiftIndent(); + + _.js += '{' + _.newline; + + for (var i = 0; i < len; i++) { + var $item = $body[i]; + + _.js += _.indent; + StmtGen[$item.type]($item, Preset.s1(settings.functionBody, i === lastIdx)); + _.js += _.newline; + } + + _.indent = prevIndent; + _.js += _.indent + '}'; + }, + + BreakStatement: function generateBreakStatement ($stmt, settings) { + if ($stmt.label) + _.js += 'break ' + $stmt.label.name; + + else + _.js += 'break'; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + ContinueStatement: function generateContinueStatement ($stmt, settings) { + if ($stmt.label) + _.js += 'continue ' + $stmt.label.name; + + else + _.js += 'continue'; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + ClassBody: function generateClassBody ($stmt) { + var $body = $stmt.body, + itemCount = $body.length, + lastItemIdx = itemCount - 1, + prevIndent = shiftIndent(); + + _.js += '{' + _.newline; + + for (var i = 0; i < itemCount; i++) { + var $item = $body[i], + itemType = $item.type || Syntax.Property; + + _.js += _.indent; + ExprGen[itemType]($item, Preset.e5); + + if (i !== lastItemIdx) + _.js += _.newline; + } + + _.indent = prevIndent; + _.js += _.newline + _.indent + '}'; + }, + + ClassDeclaration: function generateClassDeclaration ($stmt) { + var $body = $stmt.body, + $super = $stmt.superClass, + js = 'class ' + $stmt.id.name; + + if ($super) { + var superJs = exprToJs($super, Preset.e4); + + js += _.space + join('extends', superJs); + } + + _.js += js + _.optSpace; + StmtGen[$body.type]($body, Preset.s2); + }, + + DirectiveStatement: function generateDirectiveStatement ($stmt, settings) { + if (extra.raw && $stmt.raw) + _.js += $stmt.raw; + + else + _.js += escapeDirective($stmt.directive); + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + DoWhileStatement: function generateDoWhileStatement ($stmt, settings) { + var $body = $stmt.body, + $test = $stmt.test, + bodyJs = adoptionPrefix($body) + + stmtToJs($body, Preset.s7) + + adoptionSuffix($body); + + //NOTE: Because `do 42 while (cond)` is Syntax Error. We need semicolon. + var stmtJs = join('do', bodyJs); + + _.js += join(stmtJs, 'while' + _.optSpace + '('); + ExprGen[$test.type]($test, Preset.e5); + _.js += ')'; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + CatchClause: function generateCatchClause ($stmt) { + var $param = $stmt.param, + $guard = $stmt.guard, + $body = $stmt.body, + prevIndent = shiftIndent(); + + _.js += 'catch' + _.optSpace; + + if ($param) { + _.js += '('; + ExprGen[$param.type]($param, Preset.e5); + } + + if ($guard) { + _.js += ' if '; + ExprGen[$guard.type]($guard, Preset.e5); + } + + _.indent = prevIndent; + if ($param) { + _.js += ')'; + } + + _.js += adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s7); + }, + + DebuggerStatement: function generateDebuggerStatement ($stmt, settings) { + _.js += 'debugger'; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + EmptyStatement: function generateEmptyStatement () { + _.js += ';'; + }, + + ExportAllDeclaration: function ($stmt, settings) { + StmtRawGen.ExportDeclaration($stmt, settings, true); + }, + + ExportDeclaration: function generateExportDeclaration ($stmt, settings, exportAll) { + var $specs = $stmt.specifiers, + $decl = $stmt.declaration, + withSemicolon = semicolons || !settings.semicolonOptional; + + // export default AssignmentExpression[In] ; + if ($stmt['default']) { + var declJs = exprToJs($decl, Preset.e4); + + _.js += join('export default', declJs); + + if (withSemicolon) + _.js += ';'; + } + + // export * FromClause ; + // export ExportClause[NoReference] FromClause ; + // export ExportClause ; + else if ($specs || exportAll) { + var stmtJs = 'export'; + + if (exportAll) + stmtJs += _.optSpace + '*'; + + else if ($specs.length === 0) + stmtJs += _.optSpace + '{' + _.optSpace + '}'; + + else if ($specs[0].type === Syntax.ExportBatchSpecifier) { + var specJs = exprToJs($specs[0], Preset.e5); + + stmtJs = join(stmtJs, specJs); + } + + else { + var prevIndent = shiftIndent(), + specCount = $specs.length, + lastSpecIdx = specCount - 1; + + stmtJs += _.optSpace + '{'; + + for (var i = 0; i < specCount; ++i) { + stmtJs += _.newline + _.indent; + stmtJs += exprToJs($specs[i], Preset.e5); + + if (i !== lastSpecIdx) + stmtJs += ','; + } + + _.indent = prevIndent; + stmtJs += _.newline + _.indent + '}'; + } + + if ($stmt.source) { + _.js += join(stmtJs, 'from' + _.optSpace); + ExprGen.Literal($stmt.source); + } + + else + _.js += stmtJs; + + if (withSemicolon) + _.js += ';'; + } + + // export VariableStatement + // export Declaration[Default] + else if ($decl) { + var declJs = stmtToJs($decl, Preset.s4(!withSemicolon)); + + _.js += join('export', declJs); + } + }, + + ExportNamedDeclaration: function ($stmt, settings) { + StmtRawGen.ExportDeclaration($stmt, settings); + }, + + ExpressionStatement: function generateExpressionStatement ($stmt, settings) { + var exprJs = exprToJs($stmt.expression, Preset.e5), + parenthesize = EXPR_STMT_UNALLOWED_EXPR_REGEXP.test(exprJs) || + (directive && + settings.directiveContext && + $stmt.expression.type === Syntax.Literal && + typeof $stmt.expression.value === 'string'); + + //NOTE: '{', 'function', 'class' are not allowed in expression statement. + // Therefore, they should be parenthesized. + if (parenthesize) + _.js += '(' + exprJs + ')'; + + else + _.js += exprJs; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + ImportDeclaration: function generateImportDeclaration ($stmt, settings) { + var $specs = $stmt.specifiers, + stmtJs = 'import', + specCount = $specs.length; + + //NOTE: If no ImportClause is present, + // this should be `import ModuleSpecifier` so skip `from` + // ModuleSpecifier is StringLiteral. + if (specCount) { + var hasBinding = !!$specs[0]['default'], + firstNamedIdx = hasBinding ? 1 : 0, + lastSpecIdx = specCount - 1; + + // ImportedBinding + if (hasBinding) + stmtJs = join(stmtJs, $specs[0].id.name); + + // NamedImports + if (firstNamedIdx < specCount) { + if (hasBinding) + stmtJs += ','; + + stmtJs += _.optSpace + '{'; + + // import { ... } from "..."; + if (firstNamedIdx === lastSpecIdx) + stmtJs += _.optSpace + exprToJs($specs[firstNamedIdx], Preset.e5) + _.optSpace; + + else { + var prevIndent = shiftIndent(); + + // import { + // ..., + // ..., + // } from "..."; + for (var i = firstNamedIdx; i < specCount; i++) { + stmtJs += _.newline + _.indent + exprToJs($specs[i], Preset.e5); + + if (i !== lastSpecIdx) + stmtJs += ','; + } + + _.indent = prevIndent; + stmtJs += _.newline + _.indent; + } + + stmtJs += '}' + _.optSpace; + } + + stmtJs = join(stmtJs, 'from') + } + + _.js += stmtJs + _.optSpace; + ExprGen.Literal($stmt.source); + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + VariableDeclarator: function generateVariableDeclarator ($stmt, settings) { + var $id = $stmt.id, + $init = $stmt.init, + genSettings = Preset.e1(settings.allowIn); + + if ($init) { + ExprGen[$id.type]($id, genSettings); + _.js += _.optSpace + '=' + _.optSpace; + ExprGen[$init.type]($init, genSettings); + } + + else { + if ($id.type === Syntax.Identifier) + _.js += $id.name; + + else + ExprGen[$id.type]($id, genSettings); + } + }, + + VariableDeclaration: function generateVariableDeclaration ($stmt, settings) { + var $decls = $stmt.declarations, + len = $decls.length, + prevIndent = len > 1 ? shiftIndent() : _.indent, + declGenSettings = Preset.s3(settings.allowIn); + + _.js += $stmt.kind; + + for (var i = 0; i < len; i++) { + var $decl = $decls[i]; + + _.js += i === 0 ? _.space : (',' + _.optSpace); + StmtGen[$decl.type]($decl, declGenSettings); + } + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + + _.indent = prevIndent; + }, + + ThrowStatement: function generateThrowStatement ($stmt, settings) { + var argJs = exprToJs($stmt.argument, Preset.e5); + + _.js += join('throw', argJs); + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + TryStatement: function generateTryStatement ($stmt) { + var $block = $stmt.block, + $finalizer = $stmt.finalizer, + stmtJs = 'try' + + adoptionPrefix($block) + + stmtToJs($block, Preset.s7) + + adoptionSuffix($block); + + var $handlers = $stmt.handlers || $stmt.guardedHandlers; + + if ($handlers) + stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers); + + if ($stmt.handler) { + $handlers = isArray($stmt.handler) ? $stmt.handler : [$stmt.handler]; + stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers); + } + + if ($finalizer) { + stmtJs = join(stmtJs, 'finally' + adoptionPrefix($finalizer)); + stmtJs += stmtToJs($finalizer, Preset.s7); + } + + _.js += stmtJs; + }, + + SwitchStatement: function generateSwitchStatement ($stmt) { + var $cases = $stmt.cases, + $discr = $stmt.discriminant, + prevIndent = shiftIndent(); + + _.js += 'switch' + _.optSpace + '('; + ExprGen[$discr.type]($discr, Preset.e5); + _.js += ')' + _.optSpace + '{' + _.newline; + _.indent = prevIndent; + + if ($cases) { + var caseCount = $cases.length, + lastCaseIdx = caseCount - 1; + + for (var i = 0; i < caseCount; i++) { + var $case = $cases[i]; + + _.js += _.indent; + StmtGen[$case.type]($case, Preset.s4(i === lastCaseIdx)); + _.js += _.newline; + } + } + + _.js += _.indent + '}'; + }, + + SwitchCase: function generateSwitchCase ($stmt, settings) { + var $conseqs = $stmt.consequent, + $firstConseq = $conseqs[0], + $test = $stmt.test, + i = 0, + conseqSemicolonOptional = !semicolons && settings.semicolonOptional, + conseqCount = $conseqs.length, + lastConseqIdx = conseqCount - 1, + prevIndent = shiftIndent(); + + if ($test) { + var testJs = exprToJs($test, Preset.e5); + + _.js += join('case', testJs) + ':'; + } + + else + _.js += 'default:'; + + + if (conseqCount && $firstConseq.type === Syntax.BlockStatement) { + i++; + _.js += adoptionPrefix($firstConseq); + StmtGen[$firstConseq.type]($firstConseq, Preset.s7); + } + + for (; i < conseqCount; i++) { + var $conseq = $conseqs[i], + semicolonOptional = i === lastConseqIdx && conseqSemicolonOptional; + + _.js += _.newline + _.indent; + StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional)); + } + + _.indent = prevIndent; + }, + + IfStatement: function generateIfStatement ($stmt, settings) { + var $conseq = $stmt.consequent, + $test = $stmt.test, + prevIndent = shiftIndent(), + semicolonOptional = !semicolons && settings.semicolonOptional; + + _.js += 'if' + _.optSpace + '('; + ExprGen[$test.type]($test, Preset.e5); + _.js += ')'; + _.indent = prevIndent; + _.js += adoptionPrefix($conseq); + + if ($stmt.alternate) { + var conseq = stmtToJs($conseq, Preset.s7) + adoptionSuffix($conseq), + alt = stmtToJs($stmt.alternate, Preset.s4(semicolonOptional)); + + if ($stmt.alternate.type === Syntax.IfStatement) + alt = 'else ' + alt; + + else + alt = join('else', adoptionPrefix($stmt.alternate) + alt); + + _.js += join(conseq, alt); + } + + else + StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional)); + }, + + ForStatement: function generateForStatement ($stmt, settings) { + var $init = $stmt.init, + $test = $stmt.test, + $body = $stmt.body, + $update = $stmt.update, + bodySemicolonOptional = !semicolons && settings.semicolonOptional, + prevIndent = shiftIndent(); + + _.js += 'for' + _.optSpace + '('; + + if ($init) { + if ($init.type === Syntax.VariableDeclaration) + StmtGen[$init.type]($init, Preset.s6); + + else { + ExprGen[$init.type]($init, Preset.e14); + _.js += ';'; + } + } + + else + _.js += ';'; + + if ($test) { + _.js += _.optSpace; + ExprGen[$test.type]($test, Preset.e5); + } + + _.js += ';'; + + if ($update) { + _.js += _.optSpace; + ExprGen[$update.type]($update, Preset.e5); + } + + _.js += ')'; + _.indent = prevIndent; + _.js += adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); + }, + + ForInStatement: function generateForInStatement ($stmt, settings) { + generateForStatementIterator('in', $stmt, settings); + }, + + ForOfStatement: function generateForOfStatement ($stmt, settings) { + generateForStatementIterator('of', $stmt, settings); + }, + + LabeledStatement: function generateLabeledStatement ($stmt, settings) { + var $body = $stmt.body, + bodySemicolonOptional = !semicolons && settings.semicolonOptional, + prevIndent = _.indent; + + _.js += $stmt.label.name + ':' + adoptionPrefix($body); + + if ($body.type !== Syntax.BlockStatement) + prevIndent = shiftIndent(); + + StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); + _.indent = prevIndent; + }, + + ModuleDeclaration: function generateModuleDeclaration ($stmt, settings) { + _.js += 'module' + _.space + $stmt.id.name + _.space + 'from' + _.optSpace; + + ExprGen.Literal($stmt.source); + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + Program: function generateProgram ($stmt) { + var $body = $stmt.body, + len = $body.length, + lastIdx = len - 1; + + if (safeConcatenation && len > 0) + _.js += '\n'; + + for (var i = 0; i < len; i++) { + var $item = $body[i]; + + _.js += _.indent; + StmtGen[$item.type]($item, Preset.s5(!safeConcatenation && i === lastIdx)); + + if (i !== lastIdx) + _.js += _.newline; + } + }, + + FunctionDeclaration: function generateFunctionDeclaration ($stmt) { + var isGenerator = !!$stmt.generator; + + if ($stmt.async) + _.js += 'async '; + + _.js += isGenerator ? ('function*' + _.optSpace) : ('function' + _.space ); + _.js += $stmt.id.name; + generateFunctionBody($stmt); + }, + + ReturnStatement: function generateReturnStatement ($stmt, settings) { + var $arg = $stmt.argument; + + if ($arg) { + var argJs = exprToJs($arg, Preset.e5); + + _.js += join('return', argJs); + } + + else + _.js += 'return'; + + if (semicolons || !settings.semicolonOptional) + _.js += ';'; + }, + + WhileStatement: function generateWhileStatement ($stmt, settings) { + var $body = $stmt.body, + $test = $stmt.test, + bodySemicolonOptional = !semicolons && settings.semicolonOptional, + prevIndent = shiftIndent(); + + _.js += 'while' + _.optSpace + '('; + ExprGen[$test.type]($test, Preset.e5); + _.js += ')'; + _.indent = prevIndent; + + _.js += adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); + }, + + WithStatement: function generateWithStatement ($stmt, settings) { + var $body = $stmt.body, + $obj = $stmt.object, + bodySemicolonOptional = !semicolons && settings.semicolonOptional, + prevIndent = shiftIndent(); + + _.js += 'with' + _.optSpace + '('; + ExprGen[$obj.type]($obj, Preset.e5); + _.js += ')'; + _.indent = prevIndent; + _.js += adoptionPrefix($body); + StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); + } +}; + +function generateStatement ($stmt, option) { + StmtGen[$stmt.type]($stmt, option); +} + +//CodeGen +//----------------------------------------------------------------------------------- +function exprToJs ($expr, settings) { + var savedJs = _.js; + _.js = ''; + + ExprGen[$expr.type]($expr, settings); + + var src = _.js; + _.js = savedJs; + + return src; +} + +function stmtToJs ($stmt, settings) { + var savedJs = _.js; + _.js = ''; + + StmtGen[$stmt.type]($stmt, settings); + + var src = _.js; + _.js = savedJs; + + return src; +} + +function run ($node) { + _.js = ''; + + if (StmtGen[$node.type]) + StmtGen[$node.type]($node, Preset.s7); + + else + ExprGen[$node.type]($node, Preset.e19); + + return _.js; +} + +function wrapExprGen (gen) { + return function ($expr, settings) { + if (extra.verbatim && $expr.hasOwnProperty(extra.verbatim)) + generateVerbatim($expr, settings); + + else + gen($expr, settings); + } +} + +function createExprGenWithExtras () { + var gens = {}; + + for (var key in ExprRawGen) { + if (ExprRawGen.hasOwnProperty(key)) + gens[key] = wrapExprGen(ExprRawGen[key]); + } + + return gens; +} + + +//Strings +var _ = { + js: '', + newline: '\n', + optSpace: ' ', + space: ' ', + indentUnit: ' ', + indent: '' +}; + + +//Generators +var ExprGen = void 0, + StmtGen = StmtRawGen; + + +exports.generate = function ($node, options) { + var defaultOptions = getDefaultOptions(), result, pair; + + if (options != null) { + //NOTE: Obsolete options + // + // `options.indent` + // `options.base` + // + // Instead of them, we can use `option.format.indent`. + if (typeof options.indent === 'string') { + defaultOptions.format.indent.style = options.indent; + } + if (typeof options.base === 'number') { + defaultOptions.format.indent.base = options.base; + } + options = updateDeeply(defaultOptions, options); + _.indentUnit = options.format.indent.style; + if (typeof options.base === 'string') { + _.indent = options.base; + } + else { + _.indent = stringRepeat(_.indentUnit, options.format.indent.base); + } + } + else { + options = defaultOptions; + _.indentUnit = options.format.indent.style; + _.indent = stringRepeat(_.indentUnit, options.format.indent.base); + } + json = options.format.json; + renumber = options.format.renumber; + hexadecimal = json ? false : options.format.hexadecimal; + quotes = json ? 'double' : options.format.quotes; + escapeless = options.format.escapeless; + + _.newline = options.format.newline; + _.optSpace = options.format.space; + + if (options.format.compact) + _.newline = _.optSpace = _.indentUnit = _.indent = ''; + + _.space = _.optSpace ? _.optSpace : ' '; + parentheses = options.format.parentheses; + semicolons = options.format.semicolons; + safeConcatenation = options.format.safeConcatenation; + directive = options.directive; + parse = json ? null : options.parse; + extra = options; + + if (extra.verbatim) + ExprGen = createExprGenWithExtras(); + + else + ExprGen = ExprRawGen; + + return run($node); +}; + + +/***/ }), +/* 32 */ +/***/ ((module) => { + +"use strict"; + + +var defaultParseOptions = { + decodeValues: true, + map: false, + silent: false, +}; + +function isNonEmptyString(str) { + return typeof str === "string" && !!str.trim(); +} + +function parseString(setCookieValue, options) { + var parts = setCookieValue.split(";").filter(isNonEmptyString); + var nameValue = parts.shift().split("="); + var name = nameValue.shift(); + var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part + + options = options + ? Object.assign({}, defaultParseOptions, options) + : defaultParseOptions; + + try { + value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value + } catch (e) { + console.error( + "set-cookie-parser encountered an error while decoding a cookie with value '" + + value + + "'. Set options.decodeValues to false to disable this feature.", + e + ); + } + + var cookie = { + name: name, // grab everything before the first = + value: value, + }; + + parts.forEach(function (part) { + var sides = part.split("="); + var key = sides.shift().trimLeft().toLowerCase(); + var value = sides.join("="); + if (key === "expires") { + cookie.expires = new Date(value); + } else if (key === "max-age") { + cookie.maxAge = parseInt(value, 10); + } else if (key === "secure") { + cookie.secure = true; + } else if (key === "httponly") { + cookie.httpOnly = true; + } else if (key === "samesite") { + cookie.sameSite = value; + } else { + cookie[key] = value; + } + }); + + return cookie; +} + +function parse(input, options) { + options = options + ? Object.assign({}, defaultParseOptions, options) + : defaultParseOptions; + + if (!input) { + if (!options.map) { + return []; + } else { + return {}; + } + } + + if (input.headers && input.headers["set-cookie"]) { + // fast-path for node.js (which automatically normalizes header names to lower-case + input = input.headers["set-cookie"]; + } else if (input.headers) { + // slow-path for other environments - see #25 + var sch = + input.headers[ + Object.keys(input.headers).find(function (key) { + return key.toLowerCase() === "set-cookie"; + }) + ]; + // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36 + if (!sch && input.headers.cookie && !options.silent) { + console.warn( + "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning." + ); + } + input = sch; + } + if (!Array.isArray(input)) { + input = [input]; + } + + options = options + ? Object.assign({}, defaultParseOptions, options) + : defaultParseOptions; + + if (!options.map) { + return input.filter(isNonEmptyString).map(function (str) { + return parseString(str, options); + }); + } else { + var cookies = {}; + return input.filter(isNonEmptyString).reduce(function (cookies, str) { + var cookie = parseString(str, options); + cookies[cookie.name] = cookie; + return cookies; + }, cookies); + } +} + +/* + Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas + that are within a single set-cookie field-value, such as in the Expires portion. + + This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2 + Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128 + React Native's fetch does this for *every* header, including set-cookie. + + Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25 + Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation +*/ +function splitCookiesString(cookiesString) { + if (Array.isArray(cookiesString)) { + return cookiesString; + } + if (typeof cookiesString !== "string") { + return []; + } + + var cookiesStrings = []; + var pos = 0; + var start; + var ch; + var lastComma; + var nextStart; + var cookiesSeparatorFound; + + function skipWhitespace() { + while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) { + pos += 1; + } + return pos < cookiesString.length; + } + + function notSpecialChar() { + ch = cookiesString.charAt(pos); + + return ch !== "=" && ch !== ";" && ch !== ","; + } + + while (pos < cookiesString.length) { + start = pos; + cookiesSeparatorFound = false; + + while (skipWhitespace()) { + ch = cookiesString.charAt(pos); + if (ch === ",") { + // ',' is a cookie separator if we have later first '=', not ';' or ',' + lastComma = pos; + pos += 1; + + skipWhitespace(); + nextStart = pos; + + while (pos < cookiesString.length && notSpecialChar()) { + pos += 1; + } + + // currently special character + if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") { + // we found cookies separator + cookiesSeparatorFound = true; + // pos is inside the next cookie, so back up and return it. + pos = nextStart; + cookiesStrings.push(cookiesString.substring(start, lastComma)); + start = pos; + } else { + // in param ',' or param separator ';', + // we continue from that comma + pos = lastComma + 1; + } + } else { + pos += 1; + } + } + + if (!cookiesSeparatorFound || pos >= cookiesString.length) { + cookiesStrings.push(cookiesString.substring(start, cookiesString.length)); + } + } + + return cookiesStrings; +} + +module.exports = parse; +module.exports.parse = parse; +module.exports.parseString = parseString; +module.exports.splitCookiesString = splitCookiesString; + + +/***/ }), +/* 33 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "xor": () => (/* binding */ xor), +/* harmony export */ "plain": () => (/* binding */ plain), +/* harmony export */ "base64": () => (/* binding */ base64) +/* harmony export */ }); +// ------------------------------------------------------------- +// WARNING: this file is used by both the client and the server. +// Do not use any browser or node-specific API! +// ------------------------------------------------------------- +const xor = { + encode(str){ + if (!str) return str; + return encodeURIComponent(str.toString().split('').map((char, ind) => ind % 2 ? String.fromCharCode(char.charCodeAt() ^ 2) : char).join('')); + }, + decode(str){ + if (!str) return str; + let [ input, ...search ] = str.split('?'); + + return decodeURIComponent(input).split('').map((char, ind) => ind % 2 ? String.fromCharCode(char.charCodeAt(0) ^ 2) : char).join('') + (search.length ? '?' + search.join('?') : ''); + }, +}; + +const plain = { + encode(str) { + if (!str) return str; + return encodeURIComponent(str); + }, + decode(str) { + if (!str) return str; + return decodeURIComponent(str); + }, +}; + +const base64 = { + encode(str){ + if (!str) return str; + str = str.toString(); + const b64chs = Array.from('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='); + let u32; + let c0; + let c1; + let c2; + let asc = ''; + let pad = str.length % 3; + + for (let i = 0; i < str.length;) { + if((c0 = str.charCodeAt(i++)) > 255 || (c1 = str.charCodeAt(i++)) > 255 || (c2 = str.charCodeAt(i++)) > 255)throw new TypeError('invalid character found'); + u32 = (c0 << 16) | (c1 << 8) | c2; + asc += b64chs[u32 >> 18 & 63] + + b64chs[u32 >> 12 & 63] + + b64chs[u32 >> 6 & 63] + + b64chs[u32 & 63]; + } + + return encodeURIComponent(pad ? asc.slice(0, pad - 3) + '==='.substr(pad) : asc); + }, + decode(str){ + if (!str) return str; + str = decodeURIComponent(str.toString()); + const b64tab = {"0":52,"1":53,"2":54,"3":55,"4":56,"5":57,"6":58,"7":59,"8":60,"9":61,"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,"X":23,"Y":24,"Z":25,"a":26,"b":27,"c":28,"d":29,"e":30,"f":31,"g":32,"h":33,"i":34,"j":35,"k":36,"l":37,"m":38,"n":39,"o":40,"p":41,"q":42,"r":43,"s":44,"t":45,"u":46,"v":47,"w":48,"x":49,"y":50,"z":51,"+":62,"/":63,"=":64}; + str = str.replace(/\s+/g, ''); + str += '=='.slice(2 - (str.length & 3)); + let u24; + let bin = ''; + let r1; + let r2; + + for (let i = 0; i < str.length;) { + u24 = b64tab[str.charAt(i++)] << 18 + | b64tab[str.charAt(i++)] << 12 + | (r1 = b64tab[str.charAt(i++)]) << 6 + | (r2 = b64tab[str.charAt(i++)]); + bin += r1 === 64 ? String.fromCharCode(u24 >> 16 & 255) + : r2 === 64 ? String.fromCharCode(u24 >> 16 & 255, u24 >> 8 & 255) + : String.fromCharCode(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); + }; + return bin; + }, +}; + +/***/ }), +/* 34 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var mime_db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35); +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var $exports = {} + +; + +var extname = function(path = '') { + if (!path.includes('.')) return ''; + const map = path.split('.'); + + return '.' + map[map.length - 1]; +}; + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +$exports.charset = charset +$exports.charsets = { lookup: charset } +$exports.contentType = contentType +$exports.extension = extension +$exports.extensions = Object.create(null) +$exports.lookup = lookup +$exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps($exports.extensions, $exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && mime_db__WEBPACK_IMPORTED_MODULE_0__[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? $exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = $exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && $exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return $exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(mime_db__WEBPACK_IMPORTED_MODULE_0__).forEach(function forEachMimeType (type) { + var mime = mime_db__WEBPACK_IMPORTED_MODULE_0__[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(mime_db__WEBPACK_IMPORTED_MODULE_0__[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ($exports); + +/***/ }), +/* 35 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = __webpack_require__(36) + + +/***/ }), +/* 36 */ +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"iana"},"application/3gpdash-qoe-report+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/3gpp-ims+xml":{"source":"iana","compressible":true},"application/3gpphal+json":{"source":"iana","compressible":true},"application/3gpphalforms+json":{"source":"iana","compressible":true},"application/a2l":{"source":"iana"},"application/ace+cbor":{"source":"iana"},"application/activemessage":{"source":"iana"},"application/activity+json":{"source":"iana","compressible":true},"application/alto-costmap+json":{"source":"iana","compressible":true},"application/alto-costmapfilter+json":{"source":"iana","compressible":true},"application/alto-directory+json":{"source":"iana","compressible":true},"application/alto-endpointcost+json":{"source":"iana","compressible":true},"application/alto-endpointcostparams+json":{"source":"iana","compressible":true},"application/alto-endpointprop+json":{"source":"iana","compressible":true},"application/alto-endpointpropparams+json":{"source":"iana","compressible":true},"application/alto-error+json":{"source":"iana","compressible":true},"application/alto-networkmap+json":{"source":"iana","compressible":true},"application/alto-networkmapfilter+json":{"source":"iana","compressible":true},"application/alto-updatestreamcontrol+json":{"source":"iana","compressible":true},"application/alto-updatestreamparams+json":{"source":"iana","compressible":true},"application/aml":{"source":"iana"},"application/andrew-inset":{"source":"iana","extensions":["ez"]},"application/applefile":{"source":"iana"},"application/applixware":{"source":"apache","extensions":["aw"]},"application/at+jwt":{"source":"iana"},"application/atf":{"source":"iana"},"application/atfx":{"source":"iana"},"application/atom+xml":{"source":"iana","compressible":true,"extensions":["atom"]},"application/atomcat+xml":{"source":"iana","compressible":true,"extensions":["atomcat"]},"application/atomdeleted+xml":{"source":"iana","compressible":true,"extensions":["atomdeleted"]},"application/atomicmail":{"source":"iana"},"application/atomsvc+xml":{"source":"iana","compressible":true,"extensions":["atomsvc"]},"application/atsc-dwd+xml":{"source":"iana","compressible":true,"extensions":["dwd"]},"application/atsc-dynamic-event-message":{"source":"iana"},"application/atsc-held+xml":{"source":"iana","compressible":true,"extensions":["held"]},"application/atsc-rdt+json":{"source":"iana","compressible":true},"application/atsc-rsat+xml":{"source":"iana","compressible":true,"extensions":["rsat"]},"application/atxml":{"source":"iana"},"application/auth-policy+xml":{"source":"iana","compressible":true},"application/bacnet-xdd+zip":{"source":"iana","compressible":false},"application/batch-smtp":{"source":"iana"},"application/bdoc":{"compressible":false,"extensions":["bdoc"]},"application/beep+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/calendar+json":{"source":"iana","compressible":true},"application/calendar+xml":{"source":"iana","compressible":true,"extensions":["xcs"]},"application/call-completion":{"source":"iana"},"application/cals-1840":{"source":"iana"},"application/captive+json":{"source":"iana","compressible":true},"application/cbor":{"source":"iana"},"application/cbor-seq":{"source":"iana"},"application/cccex":{"source":"iana"},"application/ccmp+xml":{"source":"iana","compressible":true},"application/ccxml+xml":{"source":"iana","compressible":true,"extensions":["ccxml"]},"application/cdfx+xml":{"source":"iana","compressible":true,"extensions":["cdfx"]},"application/cdmi-capability":{"source":"iana","extensions":["cdmia"]},"application/cdmi-container":{"source":"iana","extensions":["cdmic"]},"application/cdmi-domain":{"source":"iana","extensions":["cdmid"]},"application/cdmi-object":{"source":"iana","extensions":["cdmio"]},"application/cdmi-queue":{"source":"iana","extensions":["cdmiq"]},"application/cdni":{"source":"iana"},"application/cea":{"source":"iana"},"application/cea-2018+xml":{"source":"iana","compressible":true},"application/cellml+xml":{"source":"iana","compressible":true},"application/cfw":{"source":"iana"},"application/clr":{"source":"iana"},"application/clue+xml":{"source":"iana","compressible":true},"application/clue_info+xml":{"source":"iana","compressible":true},"application/cms":{"source":"iana"},"application/cnrp+xml":{"source":"iana","compressible":true},"application/coap-group+json":{"source":"iana","compressible":true},"application/coap-payload":{"source":"iana"},"application/commonground":{"source":"iana"},"application/conference-info+xml":{"source":"iana","compressible":true},"application/cose":{"source":"iana"},"application/cose-key":{"source":"iana"},"application/cose-key-set":{"source":"iana"},"application/cpl+xml":{"source":"iana","compressible":true},"application/csrattrs":{"source":"iana"},"application/csta+xml":{"source":"iana","compressible":true},"application/cstadata+xml":{"source":"iana","compressible":true},"application/csvm+json":{"source":"iana","compressible":true},"application/cu-seeme":{"source":"apache","extensions":["cu"]},"application/cwt":{"source":"iana"},"application/cybercash":{"source":"iana"},"application/dart":{"compressible":true},"application/dash+xml":{"source":"iana","compressible":true,"extensions":["mpd"]},"application/dashdelta":{"source":"iana"},"application/davmount+xml":{"source":"iana","compressible":true,"extensions":["davmount"]},"application/dca-rft":{"source":"iana"},"application/dcd":{"source":"iana"},"application/dec-dx":{"source":"iana"},"application/dialog-info+xml":{"source":"iana","compressible":true},"application/dicom":{"source":"iana"},"application/dicom+json":{"source":"iana","compressible":true},"application/dicom+xml":{"source":"iana","compressible":true},"application/dii":{"source":"iana"},"application/dit":{"source":"iana"},"application/dns":{"source":"iana"},"application/dns+json":{"source":"iana","compressible":true},"application/dns-message":{"source":"iana"},"application/docbook+xml":{"source":"apache","compressible":true,"extensions":["dbk"]},"application/dots+cbor":{"source":"iana"},"application/dskpp+xml":{"source":"iana","compressible":true},"application/dssc+der":{"source":"iana","extensions":["dssc"]},"application/dssc+xml":{"source":"iana","compressible":true,"extensions":["xdssc"]},"application/dvcs":{"source":"iana"},"application/ecmascript":{"source":"iana","compressible":true,"extensions":["es","ecma"]},"application/edi-consent":{"source":"iana"},"application/edi-x12":{"source":"iana","compressible":false},"application/edifact":{"source":"iana","compressible":false},"application/efi":{"source":"iana"},"application/elm+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/elm+xml":{"source":"iana","compressible":true},"application/emergencycalldata.cap+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/emergencycalldata.comment+xml":{"source":"iana","compressible":true},"application/emergencycalldata.control+xml":{"source":"iana","compressible":true},"application/emergencycalldata.deviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.ecall.msd":{"source":"iana"},"application/emergencycalldata.providerinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.serviceinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.subscriberinfo+xml":{"source":"iana","compressible":true},"application/emergencycalldata.veds+xml":{"source":"iana","compressible":true},"application/emma+xml":{"source":"iana","compressible":true,"extensions":["emma"]},"application/emotionml+xml":{"source":"iana","compressible":true,"extensions":["emotionml"]},"application/encaprtp":{"source":"iana"},"application/epp+xml":{"source":"iana","compressible":true},"application/epub+zip":{"source":"iana","compressible":false,"extensions":["epub"]},"application/eshop":{"source":"iana"},"application/exi":{"source":"iana","extensions":["exi"]},"application/expect-ct-report+json":{"source":"iana","compressible":true},"application/express":{"source":"iana","extensions":["exp"]},"application/fastinfoset":{"source":"iana"},"application/fastsoap":{"source":"iana"},"application/fdt+xml":{"source":"iana","compressible":true,"extensions":["fdt"]},"application/fhir+json":{"source":"iana","charset":"UTF-8","compressible":true},"application/fhir+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/fido.trusted-apps+json":{"compressible":true},"application/fits":{"source":"iana"},"application/flexfec":{"source":"iana"},"application/font-sfnt":{"source":"iana"},"application/font-tdpfr":{"source":"iana","extensions":["pfr"]},"application/font-woff":{"source":"iana","compressible":false},"application/framework-attributes+xml":{"source":"iana","compressible":true},"application/geo+json":{"source":"iana","compressible":true,"extensions":["geojson"]},"application/geo+json-seq":{"source":"iana"},"application/geopackage+sqlite3":{"source":"iana"},"application/geoxacml+xml":{"source":"iana","compressible":true},"application/gltf-buffer":{"source":"iana"},"application/gml+xml":{"source":"iana","compressible":true,"extensions":["gml"]},"application/gpx+xml":{"source":"apache","compressible":true,"extensions":["gpx"]},"application/gxf":{"source":"apache","extensions":["gxf"]},"application/gzip":{"source":"iana","compressible":false,"extensions":["gz"]},"application/h224":{"source":"iana"},"application/held+xml":{"source":"iana","compressible":true},"application/hjson":{"extensions":["hjson"]},"application/http":{"source":"iana"},"application/hyperstudio":{"source":"iana","extensions":["stk"]},"application/ibe-key-request+xml":{"source":"iana","compressible":true},"application/ibe-pkg-reply+xml":{"source":"iana","compressible":true},"application/ibe-pp-data":{"source":"iana"},"application/iges":{"source":"iana"},"application/im-iscomposing+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/index":{"source":"iana"},"application/index.cmd":{"source":"iana"},"application/index.obj":{"source":"iana"},"application/index.response":{"source":"iana"},"application/index.vnd":{"source":"iana"},"application/inkml+xml":{"source":"iana","compressible":true,"extensions":["ink","inkml"]},"application/iotp":{"source":"iana"},"application/ipfix":{"source":"iana","extensions":["ipfix"]},"application/ipp":{"source":"iana"},"application/isup":{"source":"iana"},"application/its+xml":{"source":"iana","compressible":true,"extensions":["its"]},"application/java-archive":{"source":"apache","compressible":false,"extensions":["jar","war","ear"]},"application/java-serialized-object":{"source":"apache","compressible":false,"extensions":["ser"]},"application/java-vm":{"source":"apache","compressible":false,"extensions":["class"]},"application/javascript":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["js","mjs"]},"application/jf2feed+json":{"source":"iana","compressible":true},"application/jose":{"source":"iana"},"application/jose+json":{"source":"iana","compressible":true},"application/jrd+json":{"source":"iana","compressible":true},"application/jscalendar+json":{"source":"iana","compressible":true},"application/json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["json","map"]},"application/json-patch+json":{"source":"iana","compressible":true},"application/json-seq":{"source":"iana"},"application/json5":{"extensions":["json5"]},"application/jsonml+json":{"source":"apache","compressible":true,"extensions":["jsonml"]},"application/jwk+json":{"source":"iana","compressible":true},"application/jwk-set+json":{"source":"iana","compressible":true},"application/jwt":{"source":"iana"},"application/kpml-request+xml":{"source":"iana","compressible":true},"application/kpml-response+xml":{"source":"iana","compressible":true},"application/ld+json":{"source":"iana","compressible":true,"extensions":["jsonld"]},"application/lgr+xml":{"source":"iana","compressible":true,"extensions":["lgr"]},"application/link-format":{"source":"iana"},"application/load-control+xml":{"source":"iana","compressible":true},"application/lost+xml":{"source":"iana","compressible":true,"extensions":["lostxml"]},"application/lostsync+xml":{"source":"iana","compressible":true},"application/lpf+zip":{"source":"iana","compressible":false},"application/lxf":{"source":"iana"},"application/mac-binhex40":{"source":"iana","extensions":["hqx"]},"application/mac-compactpro":{"source":"apache","extensions":["cpt"]},"application/macwriteii":{"source":"iana"},"application/mads+xml":{"source":"iana","compressible":true,"extensions":["mads"]},"application/manifest+json":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["webmanifest"]},"application/marc":{"source":"iana","extensions":["mrc"]},"application/marcxml+xml":{"source":"iana","compressible":true,"extensions":["mrcx"]},"application/mathematica":{"source":"iana","extensions":["ma","nb","mb"]},"application/mathml+xml":{"source":"iana","compressible":true,"extensions":["mathml"]},"application/mathml-content+xml":{"source":"iana","compressible":true},"application/mathml-presentation+xml":{"source":"iana","compressible":true},"application/mbms-associated-procedure-description+xml":{"source":"iana","compressible":true},"application/mbms-deregister+xml":{"source":"iana","compressible":true},"application/mbms-envelope+xml":{"source":"iana","compressible":true},"application/mbms-msk+xml":{"source":"iana","compressible":true},"application/mbms-msk-response+xml":{"source":"iana","compressible":true},"application/mbms-protection-description+xml":{"source":"iana","compressible":true},"application/mbms-reception-report+xml":{"source":"iana","compressible":true},"application/mbms-register+xml":{"source":"iana","compressible":true},"application/mbms-register-response+xml":{"source":"iana","compressible":true},"application/mbms-schedule+xml":{"source":"iana","compressible":true},"application/mbms-user-service-description+xml":{"source":"iana","compressible":true},"application/mbox":{"source":"iana","extensions":["mbox"]},"application/media-policy-dataset+xml":{"source":"iana","compressible":true},"application/media_control+xml":{"source":"iana","compressible":true},"application/mediaservercontrol+xml":{"source":"iana","compressible":true,"extensions":["mscml"]},"application/merge-patch+json":{"source":"iana","compressible":true},"application/metalink+xml":{"source":"apache","compressible":true,"extensions":["metalink"]},"application/metalink4+xml":{"source":"iana","compressible":true,"extensions":["meta4"]},"application/mets+xml":{"source":"iana","compressible":true,"extensions":["mets"]},"application/mf4":{"source":"iana"},"application/mikey":{"source":"iana"},"application/mipc":{"source":"iana"},"application/missing-blocks+cbor-seq":{"source":"iana"},"application/mmt-aei+xml":{"source":"iana","compressible":true,"extensions":["maei"]},"application/mmt-usd+xml":{"source":"iana","compressible":true,"extensions":["musd"]},"application/mods+xml":{"source":"iana","compressible":true,"extensions":["mods"]},"application/moss-keys":{"source":"iana"},"application/moss-signature":{"source":"iana"},"application/mosskey-data":{"source":"iana"},"application/mosskey-request":{"source":"iana"},"application/mp21":{"source":"iana","extensions":["m21","mp21"]},"application/mp4":{"source":"iana","extensions":["mp4s","m4p"]},"application/mpeg4-generic":{"source":"iana"},"application/mpeg4-iod":{"source":"iana"},"application/mpeg4-iod-xmt":{"source":"iana"},"application/mrb-consumer+xml":{"source":"iana","compressible":true},"application/mrb-publish+xml":{"source":"iana","compressible":true},"application/msc-ivr+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msc-mixer+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/msword":{"source":"iana","compressible":false,"extensions":["doc","dot"]},"application/mud+json":{"source":"iana","compressible":true},"application/multipart-core":{"source":"iana"},"application/mxf":{"source":"iana","extensions":["mxf"]},"application/n-quads":{"source":"iana","extensions":["nq"]},"application/n-triples":{"source":"iana","extensions":["nt"]},"application/nasdata":{"source":"iana"},"application/news-checkgroups":{"source":"iana","charset":"US-ASCII"},"application/news-groupinfo":{"source":"iana","charset":"US-ASCII"},"application/news-transmission":{"source":"iana"},"application/nlsml+xml":{"source":"iana","compressible":true},"application/node":{"source":"iana","extensions":["cjs"]},"application/nss":{"source":"iana"},"application/oauth-authz-req+jwt":{"source":"iana"},"application/ocsp-request":{"source":"iana"},"application/ocsp-response":{"source":"iana"},"application/octet-stream":{"source":"iana","compressible":false,"extensions":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{"source":"iana","extensions":["oda"]},"application/odm+xml":{"source":"iana","compressible":true},"application/odx":{"source":"iana"},"application/oebps-package+xml":{"source":"iana","compressible":true,"extensions":["opf"]},"application/ogg":{"source":"iana","compressible":false,"extensions":["ogx"]},"application/omdoc+xml":{"source":"apache","compressible":true,"extensions":["omdoc"]},"application/onenote":{"source":"apache","extensions":["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{"source":"iana","compressible":true},"application/oscore":{"source":"iana"},"application/oxps":{"source":"iana","extensions":["oxps"]},"application/p21":{"source":"iana"},"application/p21+zip":{"source":"iana","compressible":false},"application/p2p-overlay+xml":{"source":"iana","compressible":true,"extensions":["relo"]},"application/parityfec":{"source":"iana"},"application/passport":{"source":"iana"},"application/patch-ops-error+xml":{"source":"iana","compressible":true,"extensions":["xer"]},"application/pdf":{"source":"iana","compressible":false,"extensions":["pdf"]},"application/pdx":{"source":"iana"},"application/pem-certificate-chain":{"source":"iana"},"application/pgp-encrypted":{"source":"iana","compressible":false,"extensions":["pgp"]},"application/pgp-keys":{"source":"iana"},"application/pgp-signature":{"source":"iana","extensions":["asc","sig"]},"application/pics-rules":{"source":"apache","extensions":["prf"]},"application/pidf+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pidf-diff+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/pkcs10":{"source":"iana","extensions":["p10"]},"application/pkcs12":{"source":"iana"},"application/pkcs7-mime":{"source":"iana","extensions":["p7m","p7c"]},"application/pkcs7-signature":{"source":"iana","extensions":["p7s"]},"application/pkcs8":{"source":"iana","extensions":["p8"]},"application/pkcs8-encrypted":{"source":"iana"},"application/pkix-attr-cert":{"source":"iana","extensions":["ac"]},"application/pkix-cert":{"source":"iana","extensions":["cer"]},"application/pkix-crl":{"source":"iana","extensions":["crl"]},"application/pkix-pkipath":{"source":"iana","extensions":["pkipath"]},"application/pkixcmp":{"source":"iana","extensions":["pki"]},"application/pls+xml":{"source":"iana","compressible":true,"extensions":["pls"]},"application/poc-settings+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/postscript":{"source":"iana","compressible":true,"extensions":["ai","eps","ps"]},"application/ppsp-tracker+json":{"source":"iana","compressible":true},"application/problem+json":{"source":"iana","compressible":true},"application/problem+xml":{"source":"iana","compressible":true},"application/provenance+xml":{"source":"iana","compressible":true,"extensions":["provx"]},"application/prs.alvestrand.titrax-sheet":{"source":"iana"},"application/prs.cww":{"source":"iana","extensions":["cww"]},"application/prs.cyn":{"source":"iana","charset":"7-BIT"},"application/prs.hpub+zip":{"source":"iana","compressible":false},"application/prs.nprend":{"source":"iana"},"application/prs.plucker":{"source":"iana"},"application/prs.rdf-xml-crypt":{"source":"iana"},"application/prs.xsf+xml":{"source":"iana","compressible":true},"application/pskc+xml":{"source":"iana","compressible":true,"extensions":["pskcxml"]},"application/pvd+json":{"source":"iana","compressible":true},"application/qsig":{"source":"iana"},"application/raml+yaml":{"compressible":true,"extensions":["raml"]},"application/raptorfec":{"source":"iana"},"application/rdap+json":{"source":"iana","compressible":true},"application/rdf+xml":{"source":"iana","compressible":true,"extensions":["rdf","owl"]},"application/reginfo+xml":{"source":"iana","compressible":true,"extensions":["rif"]},"application/relax-ng-compact-syntax":{"source":"iana","extensions":["rnc"]},"application/remote-printing":{"source":"iana"},"application/reputon+json":{"source":"iana","compressible":true},"application/resource-lists+xml":{"source":"iana","compressible":true,"extensions":["rl"]},"application/resource-lists-diff+xml":{"source":"iana","compressible":true,"extensions":["rld"]},"application/rfc+xml":{"source":"iana","compressible":true},"application/riscos":{"source":"iana"},"application/rlmi+xml":{"source":"iana","compressible":true},"application/rls-services+xml":{"source":"iana","compressible":true,"extensions":["rs"]},"application/route-apd+xml":{"source":"iana","compressible":true,"extensions":["rapd"]},"application/route-s-tsid+xml":{"source":"iana","compressible":true,"extensions":["sls"]},"application/route-usd+xml":{"source":"iana","compressible":true,"extensions":["rusd"]},"application/rpki-ghostbusters":{"source":"iana","extensions":["gbr"]},"application/rpki-manifest":{"source":"iana","extensions":["mft"]},"application/rpki-publication":{"source":"iana"},"application/rpki-roa":{"source":"iana","extensions":["roa"]},"application/rpki-updown":{"source":"iana"},"application/rsd+xml":{"source":"apache","compressible":true,"extensions":["rsd"]},"application/rss+xml":{"source":"apache","compressible":true,"extensions":["rss"]},"application/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"application/rtploopback":{"source":"iana"},"application/rtx":{"source":"iana"},"application/samlassertion+xml":{"source":"iana","compressible":true},"application/samlmetadata+xml":{"source":"iana","compressible":true},"application/sarif+json":{"source":"iana","compressible":true},"application/sarif-external-properties+json":{"source":"iana","compressible":true},"application/sbe":{"source":"iana"},"application/sbml+xml":{"source":"iana","compressible":true,"extensions":["sbml"]},"application/scaip+xml":{"source":"iana","compressible":true},"application/scim+json":{"source":"iana","compressible":true},"application/scvp-cv-request":{"source":"iana","extensions":["scq"]},"application/scvp-cv-response":{"source":"iana","extensions":["scs"]},"application/scvp-vp-request":{"source":"iana","extensions":["spq"]},"application/scvp-vp-response":{"source":"iana","extensions":["spp"]},"application/sdp":{"source":"iana","extensions":["sdp"]},"application/secevent+jwt":{"source":"iana"},"application/senml+cbor":{"source":"iana"},"application/senml+json":{"source":"iana","compressible":true},"application/senml+xml":{"source":"iana","compressible":true,"extensions":["senmlx"]},"application/senml-etch+cbor":{"source":"iana"},"application/senml-etch+json":{"source":"iana","compressible":true},"application/senml-exi":{"source":"iana"},"application/sensml+cbor":{"source":"iana"},"application/sensml+json":{"source":"iana","compressible":true},"application/sensml+xml":{"source":"iana","compressible":true,"extensions":["sensmlx"]},"application/sensml-exi":{"source":"iana"},"application/sep+xml":{"source":"iana","compressible":true},"application/sep-exi":{"source":"iana"},"application/session-info":{"source":"iana"},"application/set-payment":{"source":"iana"},"application/set-payment-initiation":{"source":"iana","extensions":["setpay"]},"application/set-registration":{"source":"iana"},"application/set-registration-initiation":{"source":"iana","extensions":["setreg"]},"application/sgml":{"source":"iana"},"application/sgml-open-catalog":{"source":"iana"},"application/shf+xml":{"source":"iana","compressible":true,"extensions":["shf"]},"application/sieve":{"source":"iana","extensions":["siv","sieve"]},"application/simple-filter+xml":{"source":"iana","compressible":true},"application/simple-message-summary":{"source":"iana"},"application/simplesymbolcontainer":{"source":"iana"},"application/sipc":{"source":"iana"},"application/slate":{"source":"iana"},"application/smil":{"source":"iana"},"application/smil+xml":{"source":"iana","compressible":true,"extensions":["smi","smil"]},"application/smpte336m":{"source":"iana"},"application/soap+fastinfoset":{"source":"iana"},"application/soap+xml":{"source":"iana","compressible":true},"application/sparql-query":{"source":"iana","extensions":["rq"]},"application/sparql-results+xml":{"source":"iana","compressible":true,"extensions":["srx"]},"application/spdx+json":{"source":"iana","compressible":true},"application/spirits-event+xml":{"source":"iana","compressible":true},"application/sql":{"source":"iana"},"application/srgs":{"source":"iana","extensions":["gram"]},"application/srgs+xml":{"source":"iana","compressible":true,"extensions":["grxml"]},"application/sru+xml":{"source":"iana","compressible":true,"extensions":["sru"]},"application/ssdl+xml":{"source":"apache","compressible":true,"extensions":["ssdl"]},"application/ssml+xml":{"source":"iana","compressible":true,"extensions":["ssml"]},"application/stix+json":{"source":"iana","compressible":true},"application/swid+xml":{"source":"iana","compressible":true,"extensions":["swidtag"]},"application/tamp-apex-update":{"source":"iana"},"application/tamp-apex-update-confirm":{"source":"iana"},"application/tamp-community-update":{"source":"iana"},"application/tamp-community-update-confirm":{"source":"iana"},"application/tamp-error":{"source":"iana"},"application/tamp-sequence-adjust":{"source":"iana"},"application/tamp-sequence-adjust-confirm":{"source":"iana"},"application/tamp-status-query":{"source":"iana"},"application/tamp-status-response":{"source":"iana"},"application/tamp-update":{"source":"iana"},"application/tamp-update-confirm":{"source":"iana"},"application/tar":{"compressible":true},"application/taxii+json":{"source":"iana","compressible":true},"application/td+json":{"source":"iana","compressible":true},"application/tei+xml":{"source":"iana","compressible":true,"extensions":["tei","teicorpus"]},"application/tetra_isi":{"source":"iana"},"application/thraud+xml":{"source":"iana","compressible":true,"extensions":["tfi"]},"application/timestamp-query":{"source":"iana"},"application/timestamp-reply":{"source":"iana"},"application/timestamped-data":{"source":"iana","extensions":["tsd"]},"application/tlsrpt+gzip":{"source":"iana"},"application/tlsrpt+json":{"source":"iana","compressible":true},"application/tnauthlist":{"source":"iana"},"application/token-introspection+jwt":{"source":"iana"},"application/toml":{"compressible":true,"extensions":["toml"]},"application/trickle-ice-sdpfrag":{"source":"iana"},"application/trig":{"source":"iana","extensions":["trig"]},"application/ttml+xml":{"source":"iana","compressible":true,"extensions":["ttml"]},"application/tve-trigger":{"source":"iana"},"application/tzif":{"source":"iana"},"application/tzif-leap":{"source":"iana"},"application/ubjson":{"compressible":false,"extensions":["ubj"]},"application/ulpfec":{"source":"iana"},"application/urc-grpsheet+xml":{"source":"iana","compressible":true},"application/urc-ressheet+xml":{"source":"iana","compressible":true,"extensions":["rsheet"]},"application/urc-targetdesc+xml":{"source":"iana","compressible":true,"extensions":["td"]},"application/urc-uisocketdesc+xml":{"source":"iana","compressible":true},"application/vcard+json":{"source":"iana","compressible":true},"application/vcard+xml":{"source":"iana","compressible":true},"application/vemmi":{"source":"iana"},"application/vividence.scriptfile":{"source":"apache"},"application/vnd.1000minds.decision-model+xml":{"source":"iana","compressible":true,"extensions":["1km"]},"application/vnd.3gpp-prose+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-prose-pc3ch+xml":{"source":"iana","compressible":true},"application/vnd.3gpp-v2x-local-service-information":{"source":"iana"},"application/vnd.3gpp.5gnas":{"source":"iana"},"application/vnd.3gpp.access-transfer-events+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.bsf+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gmop+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.gtpc":{"source":"iana"},"application/vnd.3gpp.interworking-data":{"source":"iana"},"application/vnd.3gpp.lpp":{"source":"iana"},"application/vnd.3gpp.mc-signalling-ear":{"source":"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-payload":{"source":"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-signalling":{"source":"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcdata-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-floor-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-signed+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-ue-init-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcptt-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-location-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-service-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-transmission-request+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-ue-config+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mcvideo-user-profile+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.mid-call+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ngap":{"source":"iana"},"application/vnd.3gpp.pfcp":{"source":"iana"},"application/vnd.3gpp.pic-bw-large":{"source":"iana","extensions":["plb"]},"application/vnd.3gpp.pic-bw-small":{"source":"iana","extensions":["psb"]},"application/vnd.3gpp.pic-bw-var":{"source":"iana","extensions":["pvb"]},"application/vnd.3gpp.s1ap":{"source":"iana"},"application/vnd.3gpp.sms":{"source":"iana"},"application/vnd.3gpp.sms+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-ext+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.srvcc-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.state-and-event-info+xml":{"source":"iana","compressible":true},"application/vnd.3gpp.ussd+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.bcmcsinfo+xml":{"source":"iana","compressible":true},"application/vnd.3gpp2.sms":{"source":"iana"},"application/vnd.3gpp2.tcap":{"source":"iana","extensions":["tcap"]},"application/vnd.3lightssoftware.imagescal":{"source":"iana"},"application/vnd.3m.post-it-notes":{"source":"iana","extensions":["pwn"]},"application/vnd.accpac.simply.aso":{"source":"iana","extensions":["aso"]},"application/vnd.accpac.simply.imp":{"source":"iana","extensions":["imp"]},"application/vnd.acucobol":{"source":"iana","extensions":["acu"]},"application/vnd.acucorp":{"source":"iana","extensions":["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{"source":"apache","compressible":false,"extensions":["air"]},"application/vnd.adobe.flash.movie":{"source":"iana"},"application/vnd.adobe.formscentral.fcdt":{"source":"iana","extensions":["fcdt"]},"application/vnd.adobe.fxp":{"source":"iana","extensions":["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{"source":"iana"},"application/vnd.adobe.xdp+xml":{"source":"iana","compressible":true,"extensions":["xdp"]},"application/vnd.adobe.xfdf":{"source":"iana","extensions":["xfdf"]},"application/vnd.aether.imp":{"source":"iana"},"application/vnd.afpc.afplinedata":{"source":"iana"},"application/vnd.afpc.afplinedata-pagedef":{"source":"iana"},"application/vnd.afpc.cmoca-cmresource":{"source":"iana"},"application/vnd.afpc.foca-charset":{"source":"iana"},"application/vnd.afpc.foca-codedfont":{"source":"iana"},"application/vnd.afpc.foca-codepage":{"source":"iana"},"application/vnd.afpc.modca":{"source":"iana"},"application/vnd.afpc.modca-cmtable":{"source":"iana"},"application/vnd.afpc.modca-formdef":{"source":"iana"},"application/vnd.afpc.modca-mediummap":{"source":"iana"},"application/vnd.afpc.modca-objectcontainer":{"source":"iana"},"application/vnd.afpc.modca-overlay":{"source":"iana"},"application/vnd.afpc.modca-pagesegment":{"source":"iana"},"application/vnd.age":{"source":"iana","extensions":["age"]},"application/vnd.ah-barcode":{"source":"iana"},"application/vnd.ahead.space":{"source":"iana","extensions":["ahead"]},"application/vnd.airzip.filesecure.azf":{"source":"iana","extensions":["azf"]},"application/vnd.airzip.filesecure.azs":{"source":"iana","extensions":["azs"]},"application/vnd.amadeus+json":{"source":"iana","compressible":true},"application/vnd.amazon.ebook":{"source":"apache","extensions":["azw"]},"application/vnd.amazon.mobi8-ebook":{"source":"iana"},"application/vnd.americandynamics.acc":{"source":"iana","extensions":["acc"]},"application/vnd.amiga.ami":{"source":"iana","extensions":["ami"]},"application/vnd.amundsen.maze+xml":{"source":"iana","compressible":true},"application/vnd.android.ota":{"source":"iana"},"application/vnd.android.package-archive":{"source":"apache","compressible":false,"extensions":["apk"]},"application/vnd.anki":{"source":"iana"},"application/vnd.anser-web-certificate-issue-initiation":{"source":"iana","extensions":["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{"source":"apache","extensions":["fti"]},"application/vnd.antix.game-component":{"source":"iana","extensions":["atx"]},"application/vnd.apache.arrow.file":{"source":"iana"},"application/vnd.apache.arrow.stream":{"source":"iana"},"application/vnd.apache.thrift.binary":{"source":"iana"},"application/vnd.apache.thrift.compact":{"source":"iana"},"application/vnd.apache.thrift.json":{"source":"iana"},"application/vnd.api+json":{"source":"iana","compressible":true},"application/vnd.aplextor.warrp+json":{"source":"iana","compressible":true},"application/vnd.apothekende.reservation+json":{"source":"iana","compressible":true},"application/vnd.apple.installer+xml":{"source":"iana","compressible":true,"extensions":["mpkg"]},"application/vnd.apple.keynote":{"source":"iana","extensions":["key"]},"application/vnd.apple.mpegurl":{"source":"iana","extensions":["m3u8"]},"application/vnd.apple.numbers":{"source":"iana","extensions":["numbers"]},"application/vnd.apple.pages":{"source":"iana","extensions":["pages"]},"application/vnd.apple.pkpass":{"compressible":false,"extensions":["pkpass"]},"application/vnd.arastra.swi":{"source":"iana"},"application/vnd.aristanetworks.swi":{"source":"iana","extensions":["swi"]},"application/vnd.artisan+json":{"source":"iana","compressible":true},"application/vnd.artsquare":{"source":"iana"},"application/vnd.astraea-software.iota":{"source":"iana","extensions":["iota"]},"application/vnd.audiograph":{"source":"iana","extensions":["aep"]},"application/vnd.autopackage":{"source":"iana"},"application/vnd.avalon+json":{"source":"iana","compressible":true},"application/vnd.avistar+xml":{"source":"iana","compressible":true},"application/vnd.balsamiq.bmml+xml":{"source":"iana","compressible":true,"extensions":["bmml"]},"application/vnd.balsamiq.bmpr":{"source":"iana"},"application/vnd.banana-accounting":{"source":"iana"},"application/vnd.bbf.usp.error":{"source":"iana"},"application/vnd.bbf.usp.msg":{"source":"iana"},"application/vnd.bbf.usp.msg+json":{"source":"iana","compressible":true},"application/vnd.bekitzur-stech+json":{"source":"iana","compressible":true},"application/vnd.bint.med-content":{"source":"iana"},"application/vnd.biopax.rdf+xml":{"source":"iana","compressible":true},"application/vnd.blink-idb-value-wrapper":{"source":"iana"},"application/vnd.blueice.multipass":{"source":"iana","extensions":["mpm"]},"application/vnd.bluetooth.ep.oob":{"source":"iana"},"application/vnd.bluetooth.le.oob":{"source":"iana"},"application/vnd.bmi":{"source":"iana","extensions":["bmi"]},"application/vnd.bpf":{"source":"iana"},"application/vnd.bpf3":{"source":"iana"},"application/vnd.businessobjects":{"source":"iana","extensions":["rep"]},"application/vnd.byu.uapi+json":{"source":"iana","compressible":true},"application/vnd.cab-jscript":{"source":"iana"},"application/vnd.canon-cpdl":{"source":"iana"},"application/vnd.canon-lips":{"source":"iana"},"application/vnd.capasystems-pg+json":{"source":"iana","compressible":true},"application/vnd.cendio.thinlinc.clientconf":{"source":"iana"},"application/vnd.century-systems.tcp_stream":{"source":"iana"},"application/vnd.chemdraw+xml":{"source":"iana","compressible":true,"extensions":["cdxml"]},"application/vnd.chess-pgn":{"source":"iana"},"application/vnd.chipnuts.karaoke-mmd":{"source":"iana","extensions":["mmd"]},"application/vnd.ciedi":{"source":"iana"},"application/vnd.cinderella":{"source":"iana","extensions":["cdy"]},"application/vnd.cirpack.isdn-ext":{"source":"iana"},"application/vnd.citationstyles.style+xml":{"source":"iana","compressible":true,"extensions":["csl"]},"application/vnd.claymore":{"source":"iana","extensions":["cla"]},"application/vnd.cloanto.rp9":{"source":"iana","extensions":["rp9"]},"application/vnd.clonk.c4group":{"source":"iana","extensions":["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{"source":"iana","extensions":["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{"source":"iana","extensions":["c11amz"]},"application/vnd.coffeescript":{"source":"iana"},"application/vnd.collabio.xodocuments.document":{"source":"iana"},"application/vnd.collabio.xodocuments.document-template":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation":{"source":"iana"},"application/vnd.collabio.xodocuments.presentation-template":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{"source":"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{"source":"iana"},"application/vnd.collection+json":{"source":"iana","compressible":true},"application/vnd.collection.doc+json":{"source":"iana","compressible":true},"application/vnd.collection.next+json":{"source":"iana","compressible":true},"application/vnd.comicbook+zip":{"source":"iana","compressible":false},"application/vnd.comicbook-rar":{"source":"iana"},"application/vnd.commerce-battelle":{"source":"iana"},"application/vnd.commonspace":{"source":"iana","extensions":["csp"]},"application/vnd.contact.cmsg":{"source":"iana","extensions":["cdbcmsg"]},"application/vnd.coreos.ignition+json":{"source":"iana","compressible":true},"application/vnd.cosmocaller":{"source":"iana","extensions":["cmc"]},"application/vnd.crick.clicker":{"source":"iana","extensions":["clkx"]},"application/vnd.crick.clicker.keyboard":{"source":"iana","extensions":["clkk"]},"application/vnd.crick.clicker.palette":{"source":"iana","extensions":["clkp"]},"application/vnd.crick.clicker.template":{"source":"iana","extensions":["clkt"]},"application/vnd.crick.clicker.wordbank":{"source":"iana","extensions":["clkw"]},"application/vnd.criticaltools.wbs+xml":{"source":"iana","compressible":true,"extensions":["wbs"]},"application/vnd.cryptii.pipe+json":{"source":"iana","compressible":true},"application/vnd.crypto-shade-file":{"source":"iana"},"application/vnd.cryptomator.encrypted":{"source":"iana"},"application/vnd.cryptomator.vault":{"source":"iana"},"application/vnd.ctc-posml":{"source":"iana","extensions":["pml"]},"application/vnd.ctct.ws+xml":{"source":"iana","compressible":true},"application/vnd.cups-pdf":{"source":"iana"},"application/vnd.cups-postscript":{"source":"iana"},"application/vnd.cups-ppd":{"source":"iana","extensions":["ppd"]},"application/vnd.cups-raster":{"source":"iana"},"application/vnd.cups-raw":{"source":"iana"},"application/vnd.curl":{"source":"iana"},"application/vnd.curl.car":{"source":"apache","extensions":["car"]},"application/vnd.curl.pcurl":{"source":"apache","extensions":["pcurl"]},"application/vnd.cyan.dean.root+xml":{"source":"iana","compressible":true},"application/vnd.cybank":{"source":"iana"},"application/vnd.cyclonedx+json":{"source":"iana","compressible":true},"application/vnd.cyclonedx+xml":{"source":"iana","compressible":true},"application/vnd.d2l.coursepackage1p0+zip":{"source":"iana","compressible":false},"application/vnd.d3m-dataset":{"source":"iana"},"application/vnd.d3m-problem":{"source":"iana"},"application/vnd.dart":{"source":"iana","compressible":true,"extensions":["dart"]},"application/vnd.data-vision.rdz":{"source":"iana","extensions":["rdz"]},"application/vnd.datapackage+json":{"source":"iana","compressible":true},"application/vnd.dataresource+json":{"source":"iana","compressible":true},"application/vnd.dbf":{"source":"iana","extensions":["dbf"]},"application/vnd.debian.binary-package":{"source":"iana"},"application/vnd.dece.data":{"source":"iana","extensions":["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{"source":"iana","compressible":true,"extensions":["uvt","uvvt"]},"application/vnd.dece.unspecified":{"source":"iana","extensions":["uvx","uvvx"]},"application/vnd.dece.zip":{"source":"iana","extensions":["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{"source":"iana","extensions":["fe_launch"]},"application/vnd.desmume.movie":{"source":"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{"source":"iana"},"application/vnd.dm.delegation+xml":{"source":"iana","compressible":true},"application/vnd.dna":{"source":"iana","extensions":["dna"]},"application/vnd.document+json":{"source":"iana","compressible":true},"application/vnd.dolby.mlp":{"source":"apache","extensions":["mlp"]},"application/vnd.dolby.mobile.1":{"source":"iana"},"application/vnd.dolby.mobile.2":{"source":"iana"},"application/vnd.doremir.scorecloud-binary-document":{"source":"iana"},"application/vnd.dpgraph":{"source":"iana","extensions":["dpg"]},"application/vnd.dreamfactory":{"source":"iana","extensions":["dfac"]},"application/vnd.drive+json":{"source":"iana","compressible":true},"application/vnd.ds-keypoint":{"source":"apache","extensions":["kpxx"]},"application/vnd.dtg.local":{"source":"iana"},"application/vnd.dtg.local.flash":{"source":"iana"},"application/vnd.dtg.local.html":{"source":"iana"},"application/vnd.dvb.ait":{"source":"iana","extensions":["ait"]},"application/vnd.dvb.dvbisl+xml":{"source":"iana","compressible":true},"application/vnd.dvb.dvbj":{"source":"iana"},"application/vnd.dvb.esgcontainer":{"source":"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess":{"source":"iana"},"application/vnd.dvb.ipdcesgaccess2":{"source":"iana"},"application/vnd.dvb.ipdcesgpdd":{"source":"iana"},"application/vnd.dvb.ipdcroaming":{"source":"iana"},"application/vnd.dvb.iptv.alfec-base":{"source":"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{"source":"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-container+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-generic+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-msglist+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-request+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-ia-registration-response+xml":{"source":"iana","compressible":true},"application/vnd.dvb.notif-init+xml":{"source":"iana","compressible":true},"application/vnd.dvb.pfr":{"source":"iana"},"application/vnd.dvb.service":{"source":"iana","extensions":["svc"]},"application/vnd.dxr":{"source":"iana"},"application/vnd.dynageo":{"source":"iana","extensions":["geo"]},"application/vnd.dzr":{"source":"iana"},"application/vnd.easykaraoke.cdgdownload":{"source":"iana"},"application/vnd.ecdis-update":{"source":"iana"},"application/vnd.ecip.rlp":{"source":"iana"},"application/vnd.ecowin.chart":{"source":"iana","extensions":["mag"]},"application/vnd.ecowin.filerequest":{"source":"iana"},"application/vnd.ecowin.fileupdate":{"source":"iana"},"application/vnd.ecowin.series":{"source":"iana"},"application/vnd.ecowin.seriesrequest":{"source":"iana"},"application/vnd.ecowin.seriesupdate":{"source":"iana"},"application/vnd.efi.img":{"source":"iana"},"application/vnd.efi.iso":{"source":"iana"},"application/vnd.emclient.accessrequest+xml":{"source":"iana","compressible":true},"application/vnd.enliven":{"source":"iana","extensions":["nml"]},"application/vnd.enphase.envoy":{"source":"iana"},"application/vnd.eprints.data+xml":{"source":"iana","compressible":true},"application/vnd.epson.esf":{"source":"iana","extensions":["esf"]},"application/vnd.epson.msf":{"source":"iana","extensions":["msf"]},"application/vnd.epson.quickanime":{"source":"iana","extensions":["qam"]},"application/vnd.epson.salt":{"source":"iana","extensions":["slt"]},"application/vnd.epson.ssf":{"source":"iana","extensions":["ssf"]},"application/vnd.ericsson.quickcall":{"source":"iana"},"application/vnd.espass-espass+zip":{"source":"iana","compressible":false},"application/vnd.eszigno3+xml":{"source":"iana","compressible":true,"extensions":["es3","et3"]},"application/vnd.etsi.aoc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.asic-e+zip":{"source":"iana","compressible":false},"application/vnd.etsi.asic-s+zip":{"source":"iana","compressible":false},"application/vnd.etsi.cug+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvcommand+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-bc+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-cod+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsad-npvr+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvservice+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvsync+xml":{"source":"iana","compressible":true},"application/vnd.etsi.iptvueprofile+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mcid+xml":{"source":"iana","compressible":true},"application/vnd.etsi.mheg5":{"source":"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{"source":"iana","compressible":true},"application/vnd.etsi.pstn+xml":{"source":"iana","compressible":true},"application/vnd.etsi.sci+xml":{"source":"iana","compressible":true},"application/vnd.etsi.simservs+xml":{"source":"iana","compressible":true},"application/vnd.etsi.timestamp-token":{"source":"iana"},"application/vnd.etsi.tsl+xml":{"source":"iana","compressible":true},"application/vnd.etsi.tsl.der":{"source":"iana"},"application/vnd.eudora.data":{"source":"iana"},"application/vnd.evolv.ecig.profile":{"source":"iana"},"application/vnd.evolv.ecig.settings":{"source":"iana"},"application/vnd.evolv.ecig.theme":{"source":"iana"},"application/vnd.exstream-empower+zip":{"source":"iana","compressible":false},"application/vnd.exstream-package":{"source":"iana"},"application/vnd.ezpix-album":{"source":"iana","extensions":["ez2"]},"application/vnd.ezpix-package":{"source":"iana","extensions":["ez3"]},"application/vnd.f-secure.mobile":{"source":"iana"},"application/vnd.fastcopy-disk-image":{"source":"iana"},"application/vnd.fdf":{"source":"iana","extensions":["fdf"]},"application/vnd.fdsn.mseed":{"source":"iana","extensions":["mseed"]},"application/vnd.fdsn.seed":{"source":"iana","extensions":["seed","dataless"]},"application/vnd.ffsns":{"source":"iana"},"application/vnd.ficlab.flb+zip":{"source":"iana","compressible":false},"application/vnd.filmit.zfc":{"source":"iana"},"application/vnd.fints":{"source":"iana"},"application/vnd.firemonkeys.cloudcell":{"source":"iana"},"application/vnd.flographit":{"source":"iana","extensions":["gph"]},"application/vnd.fluxtime.clip":{"source":"iana","extensions":["ftc"]},"application/vnd.font-fontforge-sfd":{"source":"iana"},"application/vnd.framemaker":{"source":"iana","extensions":["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{"source":"iana","extensions":["fnc"]},"application/vnd.frogans.ltf":{"source":"iana","extensions":["ltf"]},"application/vnd.fsc.weblaunch":{"source":"iana","extensions":["fsc"]},"application/vnd.fujifilm.fb.docuworks":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{"source":"iana"},"application/vnd.fujifilm.fb.docuworks.container":{"source":"iana"},"application/vnd.fujifilm.fb.jfi+xml":{"source":"iana","compressible":true},"application/vnd.fujitsu.oasys":{"source":"iana","extensions":["oas"]},"application/vnd.fujitsu.oasys2":{"source":"iana","extensions":["oa2"]},"application/vnd.fujitsu.oasys3":{"source":"iana","extensions":["oa3"]},"application/vnd.fujitsu.oasysgp":{"source":"iana","extensions":["fg5"]},"application/vnd.fujitsu.oasysprs":{"source":"iana","extensions":["bh2"]},"application/vnd.fujixerox.art-ex":{"source":"iana"},"application/vnd.fujixerox.art4":{"source":"iana"},"application/vnd.fujixerox.ddd":{"source":"iana","extensions":["ddd"]},"application/vnd.fujixerox.docuworks":{"source":"iana","extensions":["xdw"]},"application/vnd.fujixerox.docuworks.binder":{"source":"iana","extensions":["xbd"]},"application/vnd.fujixerox.docuworks.container":{"source":"iana"},"application/vnd.fujixerox.hbpl":{"source":"iana"},"application/vnd.fut-misnet":{"source":"iana"},"application/vnd.futoin+cbor":{"source":"iana"},"application/vnd.futoin+json":{"source":"iana","compressible":true},"application/vnd.fuzzysheet":{"source":"iana","extensions":["fzs"]},"application/vnd.genomatix.tuxedo":{"source":"iana","extensions":["txd"]},"application/vnd.gentics.grd+json":{"source":"iana","compressible":true},"application/vnd.geo+json":{"source":"iana","compressible":true},"application/vnd.geocube+xml":{"source":"iana","compressible":true},"application/vnd.geogebra.file":{"source":"iana","extensions":["ggb"]},"application/vnd.geogebra.slides":{"source":"iana"},"application/vnd.geogebra.tool":{"source":"iana","extensions":["ggt"]},"application/vnd.geometry-explorer":{"source":"iana","extensions":["gex","gre"]},"application/vnd.geonext":{"source":"iana","extensions":["gxt"]},"application/vnd.geoplan":{"source":"iana","extensions":["g2w"]},"application/vnd.geospace":{"source":"iana","extensions":["g3w"]},"application/vnd.gerber":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt":{"source":"iana"},"application/vnd.globalplatform.card-content-mgt-response":{"source":"iana"},"application/vnd.gmx":{"source":"iana","extensions":["gmx"]},"application/vnd.google-apps.document":{"compressible":false,"extensions":["gdoc"]},"application/vnd.google-apps.presentation":{"compressible":false,"extensions":["gslides"]},"application/vnd.google-apps.spreadsheet":{"compressible":false,"extensions":["gsheet"]},"application/vnd.google-earth.kml+xml":{"source":"iana","compressible":true,"extensions":["kml"]},"application/vnd.google-earth.kmz":{"source":"iana","compressible":false,"extensions":["kmz"]},"application/vnd.gov.sk.e-form+xml":{"source":"iana","compressible":true},"application/vnd.gov.sk.e-form+zip":{"source":"iana","compressible":false},"application/vnd.gov.sk.xmldatacontainer+xml":{"source":"iana","compressible":true},"application/vnd.grafeq":{"source":"iana","extensions":["gqf","gqs"]},"application/vnd.gridmp":{"source":"iana"},"application/vnd.groove-account":{"source":"iana","extensions":["gac"]},"application/vnd.groove-help":{"source":"iana","extensions":["ghf"]},"application/vnd.groove-identity-message":{"source":"iana","extensions":["gim"]},"application/vnd.groove-injector":{"source":"iana","extensions":["grv"]},"application/vnd.groove-tool-message":{"source":"iana","extensions":["gtm"]},"application/vnd.groove-tool-template":{"source":"iana","extensions":["tpl"]},"application/vnd.groove-vcard":{"source":"iana","extensions":["vcg"]},"application/vnd.hal+json":{"source":"iana","compressible":true},"application/vnd.hal+xml":{"source":"iana","compressible":true,"extensions":["hal"]},"application/vnd.handheld-entertainment+xml":{"source":"iana","compressible":true,"extensions":["zmm"]},"application/vnd.hbci":{"source":"iana","extensions":["hbci"]},"application/vnd.hc+json":{"source":"iana","compressible":true},"application/vnd.hcl-bireports":{"source":"iana"},"application/vnd.hdt":{"source":"iana"},"application/vnd.heroku+json":{"source":"iana","compressible":true},"application/vnd.hhe.lesson-player":{"source":"iana","extensions":["les"]},"application/vnd.hp-hpgl":{"source":"iana","extensions":["hpgl"]},"application/vnd.hp-hpid":{"source":"iana","extensions":["hpid"]},"application/vnd.hp-hps":{"source":"iana","extensions":["hps"]},"application/vnd.hp-jlyt":{"source":"iana","extensions":["jlt"]},"application/vnd.hp-pcl":{"source":"iana","extensions":["pcl"]},"application/vnd.hp-pclxl":{"source":"iana","extensions":["pclxl"]},"application/vnd.httphone":{"source":"iana"},"application/vnd.hydrostatix.sof-data":{"source":"iana","extensions":["sfd-hdstx"]},"application/vnd.hyper+json":{"source":"iana","compressible":true},"application/vnd.hyper-item+json":{"source":"iana","compressible":true},"application/vnd.hyperdrive+json":{"source":"iana","compressible":true},"application/vnd.hzn-3d-crossword":{"source":"iana"},"application/vnd.ibm.afplinedata":{"source":"iana"},"application/vnd.ibm.electronic-media":{"source":"iana"},"application/vnd.ibm.minipay":{"source":"iana","extensions":["mpy"]},"application/vnd.ibm.modcap":{"source":"iana","extensions":["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{"source":"iana","extensions":["irm"]},"application/vnd.ibm.secure-container":{"source":"iana","extensions":["sc"]},"application/vnd.iccprofile":{"source":"iana","extensions":["icc","icm"]},"application/vnd.ieee.1905":{"source":"iana"},"application/vnd.igloader":{"source":"iana","extensions":["igl"]},"application/vnd.imagemeter.folder+zip":{"source":"iana","compressible":false},"application/vnd.imagemeter.image+zip":{"source":"iana","compressible":false},"application/vnd.immervision-ivp":{"source":"iana","extensions":["ivp"]},"application/vnd.immervision-ivu":{"source":"iana","extensions":["ivu"]},"application/vnd.ims.imsccv1p1":{"source":"iana"},"application/vnd.ims.imsccv1p2":{"source":"iana"},"application/vnd.ims.imsccv1p3":{"source":"iana"},"application/vnd.ims.lis.v2.result+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolproxy.id+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings+json":{"source":"iana","compressible":true},"application/vnd.ims.lti.v2.toolsettings.simple+json":{"source":"iana","compressible":true},"application/vnd.informedcontrol.rms+xml":{"source":"iana","compressible":true},"application/vnd.informix-visionary":{"source":"iana"},"application/vnd.infotech.project":{"source":"iana"},"application/vnd.infotech.project+xml":{"source":"iana","compressible":true},"application/vnd.innopath.wamp.notification":{"source":"iana"},"application/vnd.insors.igm":{"source":"iana","extensions":["igm"]},"application/vnd.intercon.formnet":{"source":"iana","extensions":["xpw","xpx"]},"application/vnd.intergeo":{"source":"iana","extensions":["i2g"]},"application/vnd.intertrust.digibox":{"source":"iana"},"application/vnd.intertrust.nncp":{"source":"iana"},"application/vnd.intu.qbo":{"source":"iana","extensions":["qbo"]},"application/vnd.intu.qfx":{"source":"iana","extensions":["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.conceptitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.knowledgeitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.newsmessage+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.packageitem+xml":{"source":"iana","compressible":true},"application/vnd.iptc.g2.planningitem+xml":{"source":"iana","compressible":true},"application/vnd.ipunplugged.rcprofile":{"source":"iana","extensions":["rcprofile"]},"application/vnd.irepository.package+xml":{"source":"iana","compressible":true,"extensions":["irp"]},"application/vnd.is-xpr":{"source":"iana","extensions":["xpr"]},"application/vnd.isac.fcs":{"source":"iana","extensions":["fcs"]},"application/vnd.iso11783-10+zip":{"source":"iana","compressible":false},"application/vnd.jam":{"source":"iana","extensions":["jam"]},"application/vnd.japannet-directory-service":{"source":"iana"},"application/vnd.japannet-jpnstore-wakeup":{"source":"iana"},"application/vnd.japannet-payment-wakeup":{"source":"iana"},"application/vnd.japannet-registration":{"source":"iana"},"application/vnd.japannet-registration-wakeup":{"source":"iana"},"application/vnd.japannet-setstore-wakeup":{"source":"iana"},"application/vnd.japannet-verification":{"source":"iana"},"application/vnd.japannet-verification-wakeup":{"source":"iana"},"application/vnd.jcp.javame.midlet-rms":{"source":"iana","extensions":["rms"]},"application/vnd.jisp":{"source":"iana","extensions":["jisp"]},"application/vnd.joost.joda-archive":{"source":"iana","extensions":["joda"]},"application/vnd.jsk.isdn-ngn":{"source":"iana"},"application/vnd.kahootz":{"source":"iana","extensions":["ktz","ktr"]},"application/vnd.kde.karbon":{"source":"iana","extensions":["karbon"]},"application/vnd.kde.kchart":{"source":"iana","extensions":["chrt"]},"application/vnd.kde.kformula":{"source":"iana","extensions":["kfo"]},"application/vnd.kde.kivio":{"source":"iana","extensions":["flw"]},"application/vnd.kde.kontour":{"source":"iana","extensions":["kon"]},"application/vnd.kde.kpresenter":{"source":"iana","extensions":["kpr","kpt"]},"application/vnd.kde.kspread":{"source":"iana","extensions":["ksp"]},"application/vnd.kde.kword":{"source":"iana","extensions":["kwd","kwt"]},"application/vnd.kenameaapp":{"source":"iana","extensions":["htke"]},"application/vnd.kidspiration":{"source":"iana","extensions":["kia"]},"application/vnd.kinar":{"source":"iana","extensions":["kne","knp"]},"application/vnd.koan":{"source":"iana","extensions":["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{"source":"iana","extensions":["sse"]},"application/vnd.las":{"source":"iana"},"application/vnd.las.las+json":{"source":"iana","compressible":true},"application/vnd.las.las+xml":{"source":"iana","compressible":true,"extensions":["lasxml"]},"application/vnd.laszip":{"source":"iana"},"application/vnd.leap+json":{"source":"iana","compressible":true},"application/vnd.liberty-request+xml":{"source":"iana","compressible":true},"application/vnd.llamagraphics.life-balance.desktop":{"source":"iana","extensions":["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{"source":"iana","compressible":true,"extensions":["lbe"]},"application/vnd.logipipe.circuit+zip":{"source":"iana","compressible":false},"application/vnd.loom":{"source":"iana"},"application/vnd.lotus-1-2-3":{"source":"iana","extensions":["123"]},"application/vnd.lotus-approach":{"source":"iana","extensions":["apr"]},"application/vnd.lotus-freelance":{"source":"iana","extensions":["pre"]},"application/vnd.lotus-notes":{"source":"iana","extensions":["nsf"]},"application/vnd.lotus-organizer":{"source":"iana","extensions":["org"]},"application/vnd.lotus-screencam":{"source":"iana","extensions":["scm"]},"application/vnd.lotus-wordpro":{"source":"iana","extensions":["lwp"]},"application/vnd.macports.portpkg":{"source":"iana","extensions":["portpkg"]},"application/vnd.mapbox-vector-tile":{"source":"iana","extensions":["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.conftoken+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.license+xml":{"source":"iana","compressible":true},"application/vnd.marlin.drm.mdcf":{"source":"iana"},"application/vnd.mason+json":{"source":"iana","compressible":true},"application/vnd.maxmind.maxmind-db":{"source":"iana"},"application/vnd.mcd":{"source":"iana","extensions":["mcd"]},"application/vnd.medcalcdata":{"source":"iana","extensions":["mc1"]},"application/vnd.mediastation.cdkey":{"source":"iana","extensions":["cdkey"]},"application/vnd.meridian-slingshot":{"source":"iana"},"application/vnd.mfer":{"source":"iana","extensions":["mwf"]},"application/vnd.mfmp":{"source":"iana","extensions":["mfm"]},"application/vnd.micro+json":{"source":"iana","compressible":true},"application/vnd.micrografx.flo":{"source":"iana","extensions":["flo"]},"application/vnd.micrografx.igx":{"source":"iana","extensions":["igx"]},"application/vnd.microsoft.portable-executable":{"source":"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{"source":"iana"},"application/vnd.miele+json":{"source":"iana","compressible":true},"application/vnd.mif":{"source":"iana","extensions":["mif"]},"application/vnd.minisoft-hp3000-save":{"source":"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{"source":"iana"},"application/vnd.mobius.daf":{"source":"iana","extensions":["daf"]},"application/vnd.mobius.dis":{"source":"iana","extensions":["dis"]},"application/vnd.mobius.mbk":{"source":"iana","extensions":["mbk"]},"application/vnd.mobius.mqy":{"source":"iana","extensions":["mqy"]},"application/vnd.mobius.msl":{"source":"iana","extensions":["msl"]},"application/vnd.mobius.plc":{"source":"iana","extensions":["plc"]},"application/vnd.mobius.txf":{"source":"iana","extensions":["txf"]},"application/vnd.mophun.application":{"source":"iana","extensions":["mpn"]},"application/vnd.mophun.certificate":{"source":"iana","extensions":["mpc"]},"application/vnd.motorola.flexsuite":{"source":"iana"},"application/vnd.motorola.flexsuite.adsi":{"source":"iana"},"application/vnd.motorola.flexsuite.fis":{"source":"iana"},"application/vnd.motorola.flexsuite.gotap":{"source":"iana"},"application/vnd.motorola.flexsuite.kmr":{"source":"iana"},"application/vnd.motorola.flexsuite.ttc":{"source":"iana"},"application/vnd.motorola.flexsuite.wem":{"source":"iana"},"application/vnd.motorola.iprm":{"source":"iana"},"application/vnd.mozilla.xul+xml":{"source":"iana","compressible":true,"extensions":["xul"]},"application/vnd.ms-3mfdocument":{"source":"iana"},"application/vnd.ms-artgalry":{"source":"iana","extensions":["cil"]},"application/vnd.ms-asf":{"source":"iana"},"application/vnd.ms-cab-compressed":{"source":"iana","extensions":["cab"]},"application/vnd.ms-color.iccprofile":{"source":"apache"},"application/vnd.ms-excel":{"source":"iana","compressible":false,"extensions":["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{"source":"iana","extensions":["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{"source":"iana","extensions":["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{"source":"iana","extensions":["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{"source":"iana","extensions":["xltm"]},"application/vnd.ms-fontobject":{"source":"iana","compressible":true,"extensions":["eot"]},"application/vnd.ms-htmlhelp":{"source":"iana","extensions":["chm"]},"application/vnd.ms-ims":{"source":"iana","extensions":["ims"]},"application/vnd.ms-lrm":{"source":"iana","extensions":["lrm"]},"application/vnd.ms-office.activex+xml":{"source":"iana","compressible":true},"application/vnd.ms-officetheme":{"source":"iana","extensions":["thmx"]},"application/vnd.ms-opentype":{"source":"apache","compressible":true},"application/vnd.ms-outlook":{"compressible":false,"extensions":["msg"]},"application/vnd.ms-package.obfuscated-opentype":{"source":"apache"},"application/vnd.ms-pki.seccat":{"source":"apache","extensions":["cat"]},"application/vnd.ms-pki.stl":{"source":"apache","extensions":["stl"]},"application/vnd.ms-playready.initiator+xml":{"source":"iana","compressible":true},"application/vnd.ms-powerpoint":{"source":"iana","compressible":false,"extensions":["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{"source":"iana","extensions":["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{"source":"iana","extensions":["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{"source":"iana","extensions":["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{"source":"iana","extensions":["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{"source":"iana","extensions":["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{"source":"iana","compressible":true},"application/vnd.ms-printing.printticket+xml":{"source":"apache","compressible":true},"application/vnd.ms-printschematicket+xml":{"source":"iana","compressible":true},"application/vnd.ms-project":{"source":"iana","extensions":["mpp","mpt"]},"application/vnd.ms-tnef":{"source":"iana"},"application/vnd.ms-windows.devicepairing":{"source":"iana"},"application/vnd.ms-windows.nwprinting.oob":{"source":"iana"},"application/vnd.ms-windows.printerpairing":{"source":"iana"},"application/vnd.ms-windows.wsd.oob":{"source":"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.lic-resp":{"source":"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{"source":"iana"},"application/vnd.ms-wmdrm.meter-resp":{"source":"iana"},"application/vnd.ms-word.document.macroenabled.12":{"source":"iana","extensions":["docm"]},"application/vnd.ms-word.template.macroenabled.12":{"source":"iana","extensions":["dotm"]},"application/vnd.ms-works":{"source":"iana","extensions":["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{"source":"iana","extensions":["wpl"]},"application/vnd.ms-xpsdocument":{"source":"iana","compressible":false,"extensions":["xps"]},"application/vnd.msa-disk-image":{"source":"iana"},"application/vnd.mseq":{"source":"iana","extensions":["mseq"]},"application/vnd.msign":{"source":"iana"},"application/vnd.multiad.creator":{"source":"iana"},"application/vnd.multiad.creator.cif":{"source":"iana"},"application/vnd.music-niff":{"source":"iana"},"application/vnd.musician":{"source":"iana","extensions":["mus"]},"application/vnd.muvee.style":{"source":"iana","extensions":["msty"]},"application/vnd.mynfc":{"source":"iana","extensions":["taglet"]},"application/vnd.nacamar.ybrid+json":{"source":"iana","compressible":true},"application/vnd.ncd.control":{"source":"iana"},"application/vnd.ncd.reference":{"source":"iana"},"application/vnd.nearst.inv+json":{"source":"iana","compressible":true},"application/vnd.nebumind.line":{"source":"iana"},"application/vnd.nervana":{"source":"iana"},"application/vnd.netfpx":{"source":"iana"},"application/vnd.neurolanguage.nlu":{"source":"iana","extensions":["nlu"]},"application/vnd.nimn":{"source":"iana"},"application/vnd.nintendo.nitro.rom":{"source":"iana"},"application/vnd.nintendo.snes.rom":{"source":"iana"},"application/vnd.nitf":{"source":"iana","extensions":["ntf","nitf"]},"application/vnd.noblenet-directory":{"source":"iana","extensions":["nnd"]},"application/vnd.noblenet-sealer":{"source":"iana","extensions":["nns"]},"application/vnd.noblenet-web":{"source":"iana","extensions":["nnw"]},"application/vnd.nokia.catalogs":{"source":"iana"},"application/vnd.nokia.conml+wbxml":{"source":"iana"},"application/vnd.nokia.conml+xml":{"source":"iana","compressible":true},"application/vnd.nokia.iptv.config+xml":{"source":"iana","compressible":true},"application/vnd.nokia.isds-radio-presets":{"source":"iana"},"application/vnd.nokia.landmark+wbxml":{"source":"iana"},"application/vnd.nokia.landmark+xml":{"source":"iana","compressible":true},"application/vnd.nokia.landmarkcollection+xml":{"source":"iana","compressible":true},"application/vnd.nokia.n-gage.ac+xml":{"source":"iana","compressible":true,"extensions":["ac"]},"application/vnd.nokia.n-gage.data":{"source":"iana","extensions":["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{"source":"iana","extensions":["n-gage"]},"application/vnd.nokia.ncd":{"source":"iana"},"application/vnd.nokia.pcd+wbxml":{"source":"iana"},"application/vnd.nokia.pcd+xml":{"source":"iana","compressible":true},"application/vnd.nokia.radio-preset":{"source":"iana","extensions":["rpst"]},"application/vnd.nokia.radio-presets":{"source":"iana","extensions":["rpss"]},"application/vnd.novadigm.edm":{"source":"iana","extensions":["edm"]},"application/vnd.novadigm.edx":{"source":"iana","extensions":["edx"]},"application/vnd.novadigm.ext":{"source":"iana","extensions":["ext"]},"application/vnd.ntt-local.content-share":{"source":"iana"},"application/vnd.ntt-local.file-transfer":{"source":"iana"},"application/vnd.ntt-local.ogw_remote-access":{"source":"iana"},"application/vnd.ntt-local.sip-ta_remote":{"source":"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{"source":"iana"},"application/vnd.oasis.opendocument.chart":{"source":"iana","extensions":["odc"]},"application/vnd.oasis.opendocument.chart-template":{"source":"iana","extensions":["otc"]},"application/vnd.oasis.opendocument.database":{"source":"iana","extensions":["odb"]},"application/vnd.oasis.opendocument.formula":{"source":"iana","extensions":["odf"]},"application/vnd.oasis.opendocument.formula-template":{"source":"iana","extensions":["odft"]},"application/vnd.oasis.opendocument.graphics":{"source":"iana","compressible":false,"extensions":["odg"]},"application/vnd.oasis.opendocument.graphics-template":{"source":"iana","extensions":["otg"]},"application/vnd.oasis.opendocument.image":{"source":"iana","extensions":["odi"]},"application/vnd.oasis.opendocument.image-template":{"source":"iana","extensions":["oti"]},"application/vnd.oasis.opendocument.presentation":{"source":"iana","compressible":false,"extensions":["odp"]},"application/vnd.oasis.opendocument.presentation-template":{"source":"iana","extensions":["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{"source":"iana","compressible":false,"extensions":["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{"source":"iana","extensions":["ots"]},"application/vnd.oasis.opendocument.text":{"source":"iana","compressible":false,"extensions":["odt"]},"application/vnd.oasis.opendocument.text-master":{"source":"iana","extensions":["odm"]},"application/vnd.oasis.opendocument.text-template":{"source":"iana","extensions":["ott"]},"application/vnd.oasis.opendocument.text-web":{"source":"iana","extensions":["oth"]},"application/vnd.obn":{"source":"iana"},"application/vnd.ocf+cbor":{"source":"iana"},"application/vnd.oci.image.manifest.v1+json":{"source":"iana","compressible":true},"application/vnd.oftn.l10n+json":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessdownload+xml":{"source":"iana","compressible":true},"application/vnd.oipf.contentaccessstreaming+xml":{"source":"iana","compressible":true},"application/vnd.oipf.cspg-hexbinary":{"source":"iana"},"application/vnd.oipf.dae.svg+xml":{"source":"iana","compressible":true},"application/vnd.oipf.dae.xhtml+xml":{"source":"iana","compressible":true},"application/vnd.oipf.mippvcontrolmessage+xml":{"source":"iana","compressible":true},"application/vnd.oipf.pae.gem":{"source":"iana"},"application/vnd.oipf.spdiscovery+xml":{"source":"iana","compressible":true},"application/vnd.oipf.spdlist+xml":{"source":"iana","compressible":true},"application/vnd.oipf.ueprofile+xml":{"source":"iana","compressible":true},"application/vnd.oipf.userprofile+xml":{"source":"iana","compressible":true},"application/vnd.olpc-sugar":{"source":"iana","extensions":["xo"]},"application/vnd.oma-scws-config":{"source":"iana"},"application/vnd.oma-scws-http-request":{"source":"iana"},"application/vnd.oma-scws-http-response":{"source":"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.drm-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.imd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.ltkm":{"source":"iana"},"application/vnd.oma.bcast.notification+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.provisioningtrigger":{"source":"iana"},"application/vnd.oma.bcast.sgboot":{"source":"iana"},"application/vnd.oma.bcast.sgdd+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sgdu":{"source":"iana"},"application/vnd.oma.bcast.simple-symbol-container":{"source":"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.sprov+xml":{"source":"iana","compressible":true},"application/vnd.oma.bcast.stkm":{"source":"iana"},"application/vnd.oma.cab-address-book+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-feature-handler+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-pcc+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-subs-invite+xml":{"source":"iana","compressible":true},"application/vnd.oma.cab-user-prefs+xml":{"source":"iana","compressible":true},"application/vnd.oma.dcd":{"source":"iana"},"application/vnd.oma.dcdc":{"source":"iana"},"application/vnd.oma.dd2+xml":{"source":"iana","compressible":true,"extensions":["dd2"]},"application/vnd.oma.drm.risd+xml":{"source":"iana","compressible":true},"application/vnd.oma.group-usage-list+xml":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+cbor":{"source":"iana"},"application/vnd.oma.lwm2m+json":{"source":"iana","compressible":true},"application/vnd.oma.lwm2m+tlv":{"source":"iana"},"application/vnd.oma.pal+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.detailed-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.final-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.groups+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.invocation-descriptor+xml":{"source":"iana","compressible":true},"application/vnd.oma.poc.optimized-progress-report+xml":{"source":"iana","compressible":true},"application/vnd.oma.push":{"source":"iana"},"application/vnd.oma.scidm.messages+xml":{"source":"iana","compressible":true},"application/vnd.oma.xcap-directory+xml":{"source":"iana","compressible":true},"application/vnd.omads-email+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-file+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omads-folder+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.omaloc-supl-init":{"source":"iana"},"application/vnd.onepager":{"source":"iana"},"application/vnd.onepagertamp":{"source":"iana"},"application/vnd.onepagertamx":{"source":"iana"},"application/vnd.onepagertat":{"source":"iana"},"application/vnd.onepagertatp":{"source":"iana"},"application/vnd.onepagertatx":{"source":"iana"},"application/vnd.openblox.game+xml":{"source":"iana","compressible":true,"extensions":["obgx"]},"application/vnd.openblox.game-binary":{"source":"iana"},"application/vnd.openeye.oeb":{"source":"iana"},"application/vnd.openofficeorg.extension":{"source":"apache","extensions":["oxt"]},"application/vnd.openstreetmap.data+xml":{"source":"iana","compressible":true,"extensions":["osm"]},"application/vnd.opentimestamps.ots":{"source":"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawing+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{"source":"iana","compressible":false,"extensions":["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slide":{"source":"iana","extensions":["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{"source":"iana","extensions":["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.template":{"source":"iana","extensions":["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"source":"iana","compressible":false,"extensions":["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{"source":"iana","extensions":["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.theme+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.vmldrawing":{"source":"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"source":"iana","compressible":false,"extensions":["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{"source":"iana","extensions":["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.core-properties+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{"source":"iana","compressible":true},"application/vnd.openxmlformats-package.relationships+xml":{"source":"iana","compressible":true},"application/vnd.oracle.resource+json":{"source":"iana","compressible":true},"application/vnd.orange.indata":{"source":"iana"},"application/vnd.osa.netdeploy":{"source":"iana"},"application/vnd.osgeo.mapguide.package":{"source":"iana","extensions":["mgp"]},"application/vnd.osgi.bundle":{"source":"iana"},"application/vnd.osgi.dp":{"source":"iana","extensions":["dp"]},"application/vnd.osgi.subsystem":{"source":"iana","extensions":["esa"]},"application/vnd.otps.ct-kip+xml":{"source":"iana","compressible":true},"application/vnd.oxli.countgraph":{"source":"iana"},"application/vnd.pagerduty+json":{"source":"iana","compressible":true},"application/vnd.palm":{"source":"iana","extensions":["pdb","pqa","oprc"]},"application/vnd.panoply":{"source":"iana"},"application/vnd.paos.xml":{"source":"iana"},"application/vnd.patentdive":{"source":"iana"},"application/vnd.patientecommsdoc":{"source":"iana"},"application/vnd.pawaafile":{"source":"iana","extensions":["paw"]},"application/vnd.pcos":{"source":"iana"},"application/vnd.pg.format":{"source":"iana","extensions":["str"]},"application/vnd.pg.osasli":{"source":"iana","extensions":["ei6"]},"application/vnd.piaccess.application-licence":{"source":"iana"},"application/vnd.picsel":{"source":"iana","extensions":["efif"]},"application/vnd.pmi.widget":{"source":"iana","extensions":["wg"]},"application/vnd.poc.group-advertisement+xml":{"source":"iana","compressible":true},"application/vnd.pocketlearn":{"source":"iana","extensions":["plf"]},"application/vnd.powerbuilder6":{"source":"iana","extensions":["pbd"]},"application/vnd.powerbuilder6-s":{"source":"iana"},"application/vnd.powerbuilder7":{"source":"iana"},"application/vnd.powerbuilder7-s":{"source":"iana"},"application/vnd.powerbuilder75":{"source":"iana"},"application/vnd.powerbuilder75-s":{"source":"iana"},"application/vnd.preminet":{"source":"iana"},"application/vnd.previewsystems.box":{"source":"iana","extensions":["box"]},"application/vnd.proteus.magazine":{"source":"iana","extensions":["mgz"]},"application/vnd.psfs":{"source":"iana"},"application/vnd.publishare-delta-tree":{"source":"iana","extensions":["qps"]},"application/vnd.pvi.ptid1":{"source":"iana","extensions":["ptid"]},"application/vnd.pwg-multiplexed":{"source":"iana"},"application/vnd.pwg-xhtml-print+xml":{"source":"iana","compressible":true},"application/vnd.qualcomm.brew-app-res":{"source":"iana"},"application/vnd.quarantainenet":{"source":"iana"},"application/vnd.quark.quarkxpress":{"source":"iana","extensions":["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{"source":"iana"},"application/vnd.radisys.moml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-conn+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-audit-stream+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-conf+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-base+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-detect+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-group+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-speech+xml":{"source":"iana","compressible":true},"application/vnd.radisys.msml-dialog-transform+xml":{"source":"iana","compressible":true},"application/vnd.rainstor.data":{"source":"iana"},"application/vnd.rapid":{"source":"iana"},"application/vnd.rar":{"source":"iana","extensions":["rar"]},"application/vnd.realvnc.bed":{"source":"iana","extensions":["bed"]},"application/vnd.recordare.musicxml":{"source":"iana","extensions":["mxl"]},"application/vnd.recordare.musicxml+xml":{"source":"iana","compressible":true,"extensions":["musicxml"]},"application/vnd.renlearn.rlprint":{"source":"iana"},"application/vnd.resilient.logic":{"source":"iana"},"application/vnd.restful+json":{"source":"iana","compressible":true},"application/vnd.rig.cryptonote":{"source":"iana","extensions":["cryptonote"]},"application/vnd.rim.cod":{"source":"apache","extensions":["cod"]},"application/vnd.rn-realmedia":{"source":"apache","extensions":["rm"]},"application/vnd.rn-realmedia-vbr":{"source":"apache","extensions":["rmvb"]},"application/vnd.route66.link66+xml":{"source":"iana","compressible":true,"extensions":["link66"]},"application/vnd.rs-274x":{"source":"iana"},"application/vnd.ruckus.download":{"source":"iana"},"application/vnd.s3sms":{"source":"iana"},"application/vnd.sailingtracker.track":{"source":"iana","extensions":["st"]},"application/vnd.sar":{"source":"iana"},"application/vnd.sbm.cid":{"source":"iana"},"application/vnd.sbm.mid2":{"source":"iana"},"application/vnd.scribus":{"source":"iana"},"application/vnd.sealed.3df":{"source":"iana"},"application/vnd.sealed.csf":{"source":"iana"},"application/vnd.sealed.doc":{"source":"iana"},"application/vnd.sealed.eml":{"source":"iana"},"application/vnd.sealed.mht":{"source":"iana"},"application/vnd.sealed.net":{"source":"iana"},"application/vnd.sealed.ppt":{"source":"iana"},"application/vnd.sealed.tiff":{"source":"iana"},"application/vnd.sealed.xls":{"source":"iana"},"application/vnd.sealedmedia.softseal.html":{"source":"iana"},"application/vnd.sealedmedia.softseal.pdf":{"source":"iana"},"application/vnd.seemail":{"source":"iana","extensions":["see"]},"application/vnd.seis+json":{"source":"iana","compressible":true},"application/vnd.sema":{"source":"iana","extensions":["sema"]},"application/vnd.semd":{"source":"iana","extensions":["semd"]},"application/vnd.semf":{"source":"iana","extensions":["semf"]},"application/vnd.shade-save-file":{"source":"iana"},"application/vnd.shana.informed.formdata":{"source":"iana","extensions":["ifm"]},"application/vnd.shana.informed.formtemplate":{"source":"iana","extensions":["itp"]},"application/vnd.shana.informed.interchange":{"source":"iana","extensions":["iif"]},"application/vnd.shana.informed.package":{"source":"iana","extensions":["ipk"]},"application/vnd.shootproof+json":{"source":"iana","compressible":true},"application/vnd.shopkick+json":{"source":"iana","compressible":true},"application/vnd.shp":{"source":"iana"},"application/vnd.shx":{"source":"iana"},"application/vnd.sigrok.session":{"source":"iana"},"application/vnd.simtech-mindmapper":{"source":"iana","extensions":["twd","twds"]},"application/vnd.siren+json":{"source":"iana","compressible":true},"application/vnd.smaf":{"source":"iana","extensions":["mmf"]},"application/vnd.smart.notebook":{"source":"iana"},"application/vnd.smart.teacher":{"source":"iana","extensions":["teacher"]},"application/vnd.snesdev-page-table":{"source":"iana"},"application/vnd.software602.filler.form+xml":{"source":"iana","compressible":true,"extensions":["fo"]},"application/vnd.software602.filler.form-xml-zip":{"source":"iana"},"application/vnd.solent.sdkm+xml":{"source":"iana","compressible":true,"extensions":["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{"source":"iana","extensions":["dxp"]},"application/vnd.spotfire.sfs":{"source":"iana","extensions":["sfs"]},"application/vnd.sqlite3":{"source":"iana"},"application/vnd.sss-cod":{"source":"iana"},"application/vnd.sss-dtf":{"source":"iana"},"application/vnd.sss-ntf":{"source":"iana"},"application/vnd.stardivision.calc":{"source":"apache","extensions":["sdc"]},"application/vnd.stardivision.draw":{"source":"apache","extensions":["sda"]},"application/vnd.stardivision.impress":{"source":"apache","extensions":["sdd"]},"application/vnd.stardivision.math":{"source":"apache","extensions":["smf"]},"application/vnd.stardivision.writer":{"source":"apache","extensions":["sdw","vor"]},"application/vnd.stardivision.writer-global":{"source":"apache","extensions":["sgl"]},"application/vnd.stepmania.package":{"source":"iana","extensions":["smzip"]},"application/vnd.stepmania.stepchart":{"source":"iana","extensions":["sm"]},"application/vnd.street-stream":{"source":"iana"},"application/vnd.sun.wadl+xml":{"source":"iana","compressible":true,"extensions":["wadl"]},"application/vnd.sun.xml.calc":{"source":"apache","extensions":["sxc"]},"application/vnd.sun.xml.calc.template":{"source":"apache","extensions":["stc"]},"application/vnd.sun.xml.draw":{"source":"apache","extensions":["sxd"]},"application/vnd.sun.xml.draw.template":{"source":"apache","extensions":["std"]},"application/vnd.sun.xml.impress":{"source":"apache","extensions":["sxi"]},"application/vnd.sun.xml.impress.template":{"source":"apache","extensions":["sti"]},"application/vnd.sun.xml.math":{"source":"apache","extensions":["sxm"]},"application/vnd.sun.xml.writer":{"source":"apache","extensions":["sxw"]},"application/vnd.sun.xml.writer.global":{"source":"apache","extensions":["sxg"]},"application/vnd.sun.xml.writer.template":{"source":"apache","extensions":["stw"]},"application/vnd.sus-calendar":{"source":"iana","extensions":["sus","susp"]},"application/vnd.svd":{"source":"iana","extensions":["svd"]},"application/vnd.swiftview-ics":{"source":"iana"},"application/vnd.sycle+xml":{"source":"iana","compressible":true},"application/vnd.symbian.install":{"source":"apache","extensions":["sis","sisx"]},"application/vnd.syncml+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xsm"]},"application/vnd.syncml.dm+wbxml":{"source":"iana","charset":"UTF-8","extensions":["bdm"]},"application/vnd.syncml.dm+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["xdm"]},"application/vnd.syncml.dm.notification":{"source":"iana"},"application/vnd.syncml.dmddf+wbxml":{"source":"iana"},"application/vnd.syncml.dmddf+xml":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{"source":"iana"},"application/vnd.syncml.dmtnds+xml":{"source":"iana","charset":"UTF-8","compressible":true},"application/vnd.syncml.ds.notification":{"source":"iana"},"application/vnd.tableschema+json":{"source":"iana","compressible":true},"application/vnd.tao.intent-module-archive":{"source":"iana","extensions":["tao"]},"application/vnd.tcpdump.pcap":{"source":"iana","extensions":["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{"source":"iana","compressible":true},"application/vnd.tmd.mediaflex.api+xml":{"source":"iana","compressible":true},"application/vnd.tml":{"source":"iana"},"application/vnd.tmobile-livetv":{"source":"iana","extensions":["tmo"]},"application/vnd.tri.onesource":{"source":"iana"},"application/vnd.trid.tpt":{"source":"iana","extensions":["tpt"]},"application/vnd.triscape.mxs":{"source":"iana","extensions":["mxs"]},"application/vnd.trueapp":{"source":"iana","extensions":["tra"]},"application/vnd.truedoc":{"source":"iana"},"application/vnd.ubisoft.webplayer":{"source":"iana"},"application/vnd.ufdl":{"source":"iana","extensions":["ufd","ufdl"]},"application/vnd.uiq.theme":{"source":"iana","extensions":["utz"]},"application/vnd.umajin":{"source":"iana","extensions":["umj"]},"application/vnd.unity":{"source":"iana","extensions":["unityweb"]},"application/vnd.uoml+xml":{"source":"iana","compressible":true,"extensions":["uoml"]},"application/vnd.uplanet.alert":{"source":"iana"},"application/vnd.uplanet.alert-wbxml":{"source":"iana"},"application/vnd.uplanet.bearer-choice":{"source":"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{"source":"iana"},"application/vnd.uplanet.cacheop":{"source":"iana"},"application/vnd.uplanet.cacheop-wbxml":{"source":"iana"},"application/vnd.uplanet.channel":{"source":"iana"},"application/vnd.uplanet.channel-wbxml":{"source":"iana"},"application/vnd.uplanet.list":{"source":"iana"},"application/vnd.uplanet.list-wbxml":{"source":"iana"},"application/vnd.uplanet.listcmd":{"source":"iana"},"application/vnd.uplanet.listcmd-wbxml":{"source":"iana"},"application/vnd.uplanet.signal":{"source":"iana"},"application/vnd.uri-map":{"source":"iana"},"application/vnd.valve.source.material":{"source":"iana"},"application/vnd.vcx":{"source":"iana","extensions":["vcx"]},"application/vnd.vd-study":{"source":"iana"},"application/vnd.vectorworks":{"source":"iana"},"application/vnd.vel+json":{"source":"iana","compressible":true},"application/vnd.verimatrix.vcas":{"source":"iana"},"application/vnd.veritone.aion+json":{"source":"iana","compressible":true},"application/vnd.veryant.thin":{"source":"iana"},"application/vnd.ves.encrypted":{"source":"iana"},"application/vnd.vidsoft.vidconference":{"source":"iana"},"application/vnd.visio":{"source":"iana","extensions":["vsd","vst","vss","vsw"]},"application/vnd.visionary":{"source":"iana","extensions":["vis"]},"application/vnd.vividence.scriptfile":{"source":"iana"},"application/vnd.vsf":{"source":"iana","extensions":["vsf"]},"application/vnd.wap.sic":{"source":"iana"},"application/vnd.wap.slc":{"source":"iana"},"application/vnd.wap.wbxml":{"source":"iana","charset":"UTF-8","extensions":["wbxml"]},"application/vnd.wap.wmlc":{"source":"iana","extensions":["wmlc"]},"application/vnd.wap.wmlscriptc":{"source":"iana","extensions":["wmlsc"]},"application/vnd.webturbo":{"source":"iana","extensions":["wtb"]},"application/vnd.wfa.dpp":{"source":"iana"},"application/vnd.wfa.p2p":{"source":"iana"},"application/vnd.wfa.wsc":{"source":"iana"},"application/vnd.windows.devicepairing":{"source":"iana"},"application/vnd.wmc":{"source":"iana"},"application/vnd.wmf.bootstrap":{"source":"iana"},"application/vnd.wolfram.mathematica":{"source":"iana"},"application/vnd.wolfram.mathematica.package":{"source":"iana"},"application/vnd.wolfram.player":{"source":"iana","extensions":["nbp"]},"application/vnd.wordperfect":{"source":"iana","extensions":["wpd"]},"application/vnd.wqd":{"source":"iana","extensions":["wqd"]},"application/vnd.wrq-hp3000-labelled":{"source":"iana"},"application/vnd.wt.stf":{"source":"iana","extensions":["stf"]},"application/vnd.wv.csp+wbxml":{"source":"iana"},"application/vnd.wv.csp+xml":{"source":"iana","compressible":true},"application/vnd.wv.ssp+xml":{"source":"iana","compressible":true},"application/vnd.xacml+json":{"source":"iana","compressible":true},"application/vnd.xara":{"source":"iana","extensions":["xar"]},"application/vnd.xfdl":{"source":"iana","extensions":["xfdl"]},"application/vnd.xfdl.webform":{"source":"iana"},"application/vnd.xmi+xml":{"source":"iana","compressible":true},"application/vnd.xmpie.cpkg":{"source":"iana"},"application/vnd.xmpie.dpkg":{"source":"iana"},"application/vnd.xmpie.plan":{"source":"iana"},"application/vnd.xmpie.ppkg":{"source":"iana"},"application/vnd.xmpie.xlim":{"source":"iana"},"application/vnd.yamaha.hv-dic":{"source":"iana","extensions":["hvd"]},"application/vnd.yamaha.hv-script":{"source":"iana","extensions":["hvs"]},"application/vnd.yamaha.hv-voice":{"source":"iana","extensions":["hvp"]},"application/vnd.yamaha.openscoreformat":{"source":"iana","extensions":["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{"source":"iana","compressible":true,"extensions":["osfpvg"]},"application/vnd.yamaha.remote-setup":{"source":"iana"},"application/vnd.yamaha.smaf-audio":{"source":"iana","extensions":["saf"]},"application/vnd.yamaha.smaf-phrase":{"source":"iana","extensions":["spf"]},"application/vnd.yamaha.through-ngn":{"source":"iana"},"application/vnd.yamaha.tunnel-udpencap":{"source":"iana"},"application/vnd.yaoweme":{"source":"iana"},"application/vnd.yellowriver-custom-menu":{"source":"iana","extensions":["cmp"]},"application/vnd.youtube.yt":{"source":"iana"},"application/vnd.zul":{"source":"iana","extensions":["zir","zirz"]},"application/vnd.zzazz.deck+xml":{"source":"iana","compressible":true,"extensions":["zaz"]},"application/voicexml+xml":{"source":"iana","compressible":true,"extensions":["vxml"]},"application/voucher-cms+json":{"source":"iana","compressible":true},"application/vq-rtcpxr":{"source":"iana"},"application/wasm":{"source":"iana","compressible":true,"extensions":["wasm"]},"application/watcherinfo+xml":{"source":"iana","compressible":true},"application/webpush-options+json":{"source":"iana","compressible":true},"application/whoispp-query":{"source":"iana"},"application/whoispp-response":{"source":"iana"},"application/widget":{"source":"iana","extensions":["wgt"]},"application/winhlp":{"source":"apache","extensions":["hlp"]},"application/wita":{"source":"iana"},"application/wordperfect5.1":{"source":"iana"},"application/wsdl+xml":{"source":"iana","compressible":true,"extensions":["wsdl"]},"application/wspolicy+xml":{"source":"iana","compressible":true,"extensions":["wspolicy"]},"application/x-7z-compressed":{"source":"apache","compressible":false,"extensions":["7z"]},"application/x-abiword":{"source":"apache","extensions":["abw"]},"application/x-ace-compressed":{"source":"apache","extensions":["ace"]},"application/x-amf":{"source":"apache"},"application/x-apple-diskimage":{"source":"apache","extensions":["dmg"]},"application/x-arj":{"compressible":false,"extensions":["arj"]},"application/x-authorware-bin":{"source":"apache","extensions":["aab","x32","u32","vox"]},"application/x-authorware-map":{"source":"apache","extensions":["aam"]},"application/x-authorware-seg":{"source":"apache","extensions":["aas"]},"application/x-bcpio":{"source":"apache","extensions":["bcpio"]},"application/x-bdoc":{"compressible":false,"extensions":["bdoc"]},"application/x-bittorrent":{"source":"apache","extensions":["torrent"]},"application/x-blorb":{"source":"apache","extensions":["blb","blorb"]},"application/x-bzip":{"source":"apache","compressible":false,"extensions":["bz"]},"application/x-bzip2":{"source":"apache","compressible":false,"extensions":["bz2","boz"]},"application/x-cbr":{"source":"apache","extensions":["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{"source":"apache","extensions":["vcd"]},"application/x-cfs-compressed":{"source":"apache","extensions":["cfs"]},"application/x-chat":{"source":"apache","extensions":["chat"]},"application/x-chess-pgn":{"source":"apache","extensions":["pgn"]},"application/x-chrome-extension":{"extensions":["crx"]},"application/x-cocoa":{"source":"nginx","extensions":["cco"]},"application/x-compress":{"source":"apache"},"application/x-conference":{"source":"apache","extensions":["nsc"]},"application/x-cpio":{"source":"apache","extensions":["cpio"]},"application/x-csh":{"source":"apache","extensions":["csh"]},"application/x-deb":{"compressible":false},"application/x-debian-package":{"source":"apache","extensions":["deb","udeb"]},"application/x-dgc-compressed":{"source":"apache","extensions":["dgc"]},"application/x-director":{"source":"apache","extensions":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{"source":"apache","extensions":["wad"]},"application/x-dtbncx+xml":{"source":"apache","compressible":true,"extensions":["ncx"]},"application/x-dtbook+xml":{"source":"apache","compressible":true,"extensions":["dtb"]},"application/x-dtbresource+xml":{"source":"apache","compressible":true,"extensions":["res"]},"application/x-dvi":{"source":"apache","compressible":false,"extensions":["dvi"]},"application/x-envoy":{"source":"apache","extensions":["evy"]},"application/x-eva":{"source":"apache","extensions":["eva"]},"application/x-font-bdf":{"source":"apache","extensions":["bdf"]},"application/x-font-dos":{"source":"apache"},"application/x-font-framemaker":{"source":"apache"},"application/x-font-ghostscript":{"source":"apache","extensions":["gsf"]},"application/x-font-libgrx":{"source":"apache"},"application/x-font-linux-psf":{"source":"apache","extensions":["psf"]},"application/x-font-pcf":{"source":"apache","extensions":["pcf"]},"application/x-font-snf":{"source":"apache","extensions":["snf"]},"application/x-font-speedo":{"source":"apache"},"application/x-font-sunos-news":{"source":"apache"},"application/x-font-type1":{"source":"apache","extensions":["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{"source":"apache"},"application/x-freearc":{"source":"apache","extensions":["arc"]},"application/x-futuresplash":{"source":"apache","extensions":["spl"]},"application/x-gca-compressed":{"source":"apache","extensions":["gca"]},"application/x-glulx":{"source":"apache","extensions":["ulx"]},"application/x-gnumeric":{"source":"apache","extensions":["gnumeric"]},"application/x-gramps-xml":{"source":"apache","extensions":["gramps"]},"application/x-gtar":{"source":"apache","extensions":["gtar"]},"application/x-gzip":{"source":"apache"},"application/x-hdf":{"source":"apache","extensions":["hdf"]},"application/x-httpd-php":{"compressible":true,"extensions":["php"]},"application/x-install-instructions":{"source":"apache","extensions":["install"]},"application/x-iso9660-image":{"source":"apache","extensions":["iso"]},"application/x-iwork-keynote-sffkey":{"extensions":["key"]},"application/x-iwork-numbers-sffnumbers":{"extensions":["numbers"]},"application/x-iwork-pages-sffpages":{"extensions":["pages"]},"application/x-java-archive-diff":{"source":"nginx","extensions":["jardiff"]},"application/x-java-jnlp-file":{"source":"apache","compressible":false,"extensions":["jnlp"]},"application/x-javascript":{"compressible":true},"application/x-keepass2":{"extensions":["kdbx"]},"application/x-latex":{"source":"apache","compressible":false,"extensions":["latex"]},"application/x-lua-bytecode":{"extensions":["luac"]},"application/x-lzh-compressed":{"source":"apache","extensions":["lzh","lha"]},"application/x-makeself":{"source":"nginx","extensions":["run"]},"application/x-mie":{"source":"apache","extensions":["mie"]},"application/x-mobipocket-ebook":{"source":"apache","extensions":["prc","mobi"]},"application/x-mpegurl":{"compressible":false},"application/x-ms-application":{"source":"apache","extensions":["application"]},"application/x-ms-shortcut":{"source":"apache","extensions":["lnk"]},"application/x-ms-wmd":{"source":"apache","extensions":["wmd"]},"application/x-ms-wmz":{"source":"apache","extensions":["wmz"]},"application/x-ms-xbap":{"source":"apache","extensions":["xbap"]},"application/x-msaccess":{"source":"apache","extensions":["mdb"]},"application/x-msbinder":{"source":"apache","extensions":["obd"]},"application/x-mscardfile":{"source":"apache","extensions":["crd"]},"application/x-msclip":{"source":"apache","extensions":["clp"]},"application/x-msdos-program":{"extensions":["exe"]},"application/x-msdownload":{"source":"apache","extensions":["exe","dll","com","bat","msi"]},"application/x-msmediaview":{"source":"apache","extensions":["mvb","m13","m14"]},"application/x-msmetafile":{"source":"apache","extensions":["wmf","wmz","emf","emz"]},"application/x-msmoney":{"source":"apache","extensions":["mny"]},"application/x-mspublisher":{"source":"apache","extensions":["pub"]},"application/x-msschedule":{"source":"apache","extensions":["scd"]},"application/x-msterminal":{"source":"apache","extensions":["trm"]},"application/x-mswrite":{"source":"apache","extensions":["wri"]},"application/x-netcdf":{"source":"apache","extensions":["nc","cdf"]},"application/x-ns-proxy-autoconfig":{"compressible":true,"extensions":["pac"]},"application/x-nzb":{"source":"apache","extensions":["nzb"]},"application/x-perl":{"source":"nginx","extensions":["pl","pm"]},"application/x-pilot":{"source":"nginx","extensions":["prc","pdb"]},"application/x-pkcs12":{"source":"apache","compressible":false,"extensions":["p12","pfx"]},"application/x-pkcs7-certificates":{"source":"apache","extensions":["p7b","spc"]},"application/x-pkcs7-certreqresp":{"source":"apache","extensions":["p7r"]},"application/x-pki-message":{"source":"iana"},"application/x-rar-compressed":{"source":"apache","compressible":false,"extensions":["rar"]},"application/x-redhat-package-manager":{"source":"nginx","extensions":["rpm"]},"application/x-research-info-systems":{"source":"apache","extensions":["ris"]},"application/x-sea":{"source":"nginx","extensions":["sea"]},"application/x-sh":{"source":"apache","compressible":true,"extensions":["sh"]},"application/x-shar":{"source":"apache","extensions":["shar"]},"application/x-shockwave-flash":{"source":"apache","compressible":false,"extensions":["swf"]},"application/x-silverlight-app":{"source":"apache","extensions":["xap"]},"application/x-sql":{"source":"apache","extensions":["sql"]},"application/x-stuffit":{"source":"apache","compressible":false,"extensions":["sit"]},"application/x-stuffitx":{"source":"apache","extensions":["sitx"]},"application/x-subrip":{"source":"apache","extensions":["srt"]},"application/x-sv4cpio":{"source":"apache","extensions":["sv4cpio"]},"application/x-sv4crc":{"source":"apache","extensions":["sv4crc"]},"application/x-t3vm-image":{"source":"apache","extensions":["t3"]},"application/x-tads":{"source":"apache","extensions":["gam"]},"application/x-tar":{"source":"apache","compressible":true,"extensions":["tar"]},"application/x-tcl":{"source":"apache","extensions":["tcl","tk"]},"application/x-tex":{"source":"apache","extensions":["tex"]},"application/x-tex-tfm":{"source":"apache","extensions":["tfm"]},"application/x-texinfo":{"source":"apache","extensions":["texinfo","texi"]},"application/x-tgif":{"source":"apache","extensions":["obj"]},"application/x-ustar":{"source":"apache","extensions":["ustar"]},"application/x-virtualbox-hdd":{"compressible":true,"extensions":["hdd"]},"application/x-virtualbox-ova":{"compressible":true,"extensions":["ova"]},"application/x-virtualbox-ovf":{"compressible":true,"extensions":["ovf"]},"application/x-virtualbox-vbox":{"compressible":true,"extensions":["vbox"]},"application/x-virtualbox-vbox-extpack":{"compressible":false,"extensions":["vbox-extpack"]},"application/x-virtualbox-vdi":{"compressible":true,"extensions":["vdi"]},"application/x-virtualbox-vhd":{"compressible":true,"extensions":["vhd"]},"application/x-virtualbox-vmdk":{"compressible":true,"extensions":["vmdk"]},"application/x-wais-source":{"source":"apache","extensions":["src"]},"application/x-web-app-manifest+json":{"compressible":true,"extensions":["webapp"]},"application/x-www-form-urlencoded":{"source":"iana","compressible":true},"application/x-x509-ca-cert":{"source":"iana","extensions":["der","crt","pem"]},"application/x-x509-ca-ra-cert":{"source":"iana"},"application/x-x509-next-ca-cert":{"source":"iana"},"application/x-xfig":{"source":"apache","extensions":["fig"]},"application/x-xliff+xml":{"source":"apache","compressible":true,"extensions":["xlf"]},"application/x-xpinstall":{"source":"apache","compressible":false,"extensions":["xpi"]},"application/x-xz":{"source":"apache","extensions":["xz"]},"application/x-zmachine":{"source":"apache","extensions":["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{"source":"iana"},"application/xacml+xml":{"source":"iana","compressible":true},"application/xaml+xml":{"source":"apache","compressible":true,"extensions":["xaml"]},"application/xcap-att+xml":{"source":"iana","compressible":true,"extensions":["xav"]},"application/xcap-caps+xml":{"source":"iana","compressible":true,"extensions":["xca"]},"application/xcap-diff+xml":{"source":"iana","compressible":true,"extensions":["xdf"]},"application/xcap-el+xml":{"source":"iana","compressible":true,"extensions":["xel"]},"application/xcap-error+xml":{"source":"iana","compressible":true},"application/xcap-ns+xml":{"source":"iana","compressible":true,"extensions":["xns"]},"application/xcon-conference-info+xml":{"source":"iana","compressible":true},"application/xcon-conference-info-diff+xml":{"source":"iana","compressible":true},"application/xenc+xml":{"source":"iana","compressible":true,"extensions":["xenc"]},"application/xhtml+xml":{"source":"iana","compressible":true,"extensions":["xhtml","xht"]},"application/xhtml-voice+xml":{"source":"apache","compressible":true},"application/xliff+xml":{"source":"iana","compressible":true,"extensions":["xlf"]},"application/xml":{"source":"iana","compressible":true,"extensions":["xml","xsl","xsd","rng"]},"application/xml-dtd":{"source":"iana","compressible":true,"extensions":["dtd"]},"application/xml-external-parsed-entity":{"source":"iana"},"application/xml-patch+xml":{"source":"iana","compressible":true},"application/xmpp+xml":{"source":"iana","compressible":true},"application/xop+xml":{"source":"iana","compressible":true,"extensions":["xop"]},"application/xproc+xml":{"source":"apache","compressible":true,"extensions":["xpl"]},"application/xslt+xml":{"source":"iana","compressible":true,"extensions":["xsl","xslt"]},"application/xspf+xml":{"source":"apache","compressible":true,"extensions":["xspf"]},"application/xv+xml":{"source":"iana","compressible":true,"extensions":["mxml","xhvml","xvml","xvm"]},"application/yang":{"source":"iana","extensions":["yang"]},"application/yang-data+json":{"source":"iana","compressible":true},"application/yang-data+xml":{"source":"iana","compressible":true},"application/yang-patch+json":{"source":"iana","compressible":true},"application/yang-patch+xml":{"source":"iana","compressible":true},"application/yin+xml":{"source":"iana","compressible":true,"extensions":["yin"]},"application/zip":{"source":"iana","compressible":false,"extensions":["zip"]},"application/zlib":{"source":"iana"},"application/zstd":{"source":"iana"},"audio/1d-interleaved-parityfec":{"source":"iana"},"audio/32kadpcm":{"source":"iana"},"audio/3gpp":{"source":"iana","compressible":false,"extensions":["3gpp"]},"audio/3gpp2":{"source":"iana"},"audio/aac":{"source":"iana"},"audio/ac3":{"source":"iana"},"audio/adpcm":{"source":"apache","extensions":["adp"]},"audio/amr":{"source":"iana","extensions":["amr"]},"audio/amr-wb":{"source":"iana"},"audio/amr-wb+":{"source":"iana"},"audio/aptx":{"source":"iana"},"audio/asc":{"source":"iana"},"audio/atrac-advanced-lossless":{"source":"iana"},"audio/atrac-x":{"source":"iana"},"audio/atrac3":{"source":"iana"},"audio/basic":{"source":"iana","compressible":false,"extensions":["au","snd"]},"audio/bv16":{"source":"iana"},"audio/bv32":{"source":"iana"},"audio/clearmode":{"source":"iana"},"audio/cn":{"source":"iana"},"audio/dat12":{"source":"iana"},"audio/dls":{"source":"iana"},"audio/dsr-es201108":{"source":"iana"},"audio/dsr-es202050":{"source":"iana"},"audio/dsr-es202211":{"source":"iana"},"audio/dsr-es202212":{"source":"iana"},"audio/dv":{"source":"iana"},"audio/dvi4":{"source":"iana"},"audio/eac3":{"source":"iana"},"audio/encaprtp":{"source":"iana"},"audio/evrc":{"source":"iana"},"audio/evrc-qcp":{"source":"iana"},"audio/evrc0":{"source":"iana"},"audio/evrc1":{"source":"iana"},"audio/evrcb":{"source":"iana"},"audio/evrcb0":{"source":"iana"},"audio/evrcb1":{"source":"iana"},"audio/evrcnw":{"source":"iana"},"audio/evrcnw0":{"source":"iana"},"audio/evrcnw1":{"source":"iana"},"audio/evrcwb":{"source":"iana"},"audio/evrcwb0":{"source":"iana"},"audio/evrcwb1":{"source":"iana"},"audio/evs":{"source":"iana"},"audio/flexfec":{"source":"iana"},"audio/fwdred":{"source":"iana"},"audio/g711-0":{"source":"iana"},"audio/g719":{"source":"iana"},"audio/g722":{"source":"iana"},"audio/g7221":{"source":"iana"},"audio/g723":{"source":"iana"},"audio/g726-16":{"source":"iana"},"audio/g726-24":{"source":"iana"},"audio/g726-32":{"source":"iana"},"audio/g726-40":{"source":"iana"},"audio/g728":{"source":"iana"},"audio/g729":{"source":"iana"},"audio/g7291":{"source":"iana"},"audio/g729d":{"source":"iana"},"audio/g729e":{"source":"iana"},"audio/gsm":{"source":"iana"},"audio/gsm-efr":{"source":"iana"},"audio/gsm-hr-08":{"source":"iana"},"audio/ilbc":{"source":"iana"},"audio/ip-mr_v2.5":{"source":"iana"},"audio/isac":{"source":"apache"},"audio/l16":{"source":"iana"},"audio/l20":{"source":"iana"},"audio/l24":{"source":"iana","compressible":false},"audio/l8":{"source":"iana"},"audio/lpc":{"source":"iana"},"audio/melp":{"source":"iana"},"audio/melp1200":{"source":"iana"},"audio/melp2400":{"source":"iana"},"audio/melp600":{"source":"iana"},"audio/mhas":{"source":"iana"},"audio/midi":{"source":"apache","extensions":["mid","midi","kar","rmi"]},"audio/mobile-xmf":{"source":"iana","extensions":["mxmf"]},"audio/mp3":{"compressible":false,"extensions":["mp3"]},"audio/mp4":{"source":"iana","compressible":false,"extensions":["m4a","mp4a"]},"audio/mp4a-latm":{"source":"iana"},"audio/mpa":{"source":"iana"},"audio/mpa-robust":{"source":"iana"},"audio/mpeg":{"source":"iana","compressible":false,"extensions":["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{"source":"iana"},"audio/musepack":{"source":"apache"},"audio/ogg":{"source":"iana","compressible":false,"extensions":["oga","ogg","spx","opus"]},"audio/opus":{"source":"iana"},"audio/parityfec":{"source":"iana"},"audio/pcma":{"source":"iana"},"audio/pcma-wb":{"source":"iana"},"audio/pcmu":{"source":"iana"},"audio/pcmu-wb":{"source":"iana"},"audio/prs.sid":{"source":"iana"},"audio/qcelp":{"source":"iana"},"audio/raptorfec":{"source":"iana"},"audio/red":{"source":"iana"},"audio/rtp-enc-aescm128":{"source":"iana"},"audio/rtp-midi":{"source":"iana"},"audio/rtploopback":{"source":"iana"},"audio/rtx":{"source":"iana"},"audio/s3m":{"source":"apache","extensions":["s3m"]},"audio/scip":{"source":"iana"},"audio/silk":{"source":"apache","extensions":["sil"]},"audio/smv":{"source":"iana"},"audio/smv-qcp":{"source":"iana"},"audio/smv0":{"source":"iana"},"audio/sofa":{"source":"iana"},"audio/sp-midi":{"source":"iana"},"audio/speex":{"source":"iana"},"audio/t140c":{"source":"iana"},"audio/t38":{"source":"iana"},"audio/telephone-event":{"source":"iana"},"audio/tetra_acelp":{"source":"iana"},"audio/tetra_acelp_bb":{"source":"iana"},"audio/tone":{"source":"iana"},"audio/tsvcis":{"source":"iana"},"audio/uemclip":{"source":"iana"},"audio/ulpfec":{"source":"iana"},"audio/usac":{"source":"iana"},"audio/vdvi":{"source":"iana"},"audio/vmr-wb":{"source":"iana"},"audio/vnd.3gpp.iufp":{"source":"iana"},"audio/vnd.4sb":{"source":"iana"},"audio/vnd.audiokoz":{"source":"iana"},"audio/vnd.celp":{"source":"iana"},"audio/vnd.cisco.nse":{"source":"iana"},"audio/vnd.cmles.radio-events":{"source":"iana"},"audio/vnd.cns.anp1":{"source":"iana"},"audio/vnd.cns.inf1":{"source":"iana"},"audio/vnd.dece.audio":{"source":"iana","extensions":["uva","uvva"]},"audio/vnd.digital-winds":{"source":"iana","extensions":["eol"]},"audio/vnd.dlna.adts":{"source":"iana"},"audio/vnd.dolby.heaac.1":{"source":"iana"},"audio/vnd.dolby.heaac.2":{"source":"iana"},"audio/vnd.dolby.mlp":{"source":"iana"},"audio/vnd.dolby.mps":{"source":"iana"},"audio/vnd.dolby.pl2":{"source":"iana"},"audio/vnd.dolby.pl2x":{"source":"iana"},"audio/vnd.dolby.pl2z":{"source":"iana"},"audio/vnd.dolby.pulse.1":{"source":"iana"},"audio/vnd.dra":{"source":"iana","extensions":["dra"]},"audio/vnd.dts":{"source":"iana","extensions":["dts"]},"audio/vnd.dts.hd":{"source":"iana","extensions":["dtshd"]},"audio/vnd.dts.uhd":{"source":"iana"},"audio/vnd.dvb.file":{"source":"iana"},"audio/vnd.everad.plj":{"source":"iana"},"audio/vnd.hns.audio":{"source":"iana"},"audio/vnd.lucent.voice":{"source":"iana","extensions":["lvp"]},"audio/vnd.ms-playready.media.pya":{"source":"iana","extensions":["pya"]},"audio/vnd.nokia.mobile-xmf":{"source":"iana"},"audio/vnd.nortel.vbk":{"source":"iana"},"audio/vnd.nuera.ecelp4800":{"source":"iana","extensions":["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{"source":"iana","extensions":["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{"source":"iana","extensions":["ecelp9600"]},"audio/vnd.octel.sbc":{"source":"iana"},"audio/vnd.presonus.multitrack":{"source":"iana"},"audio/vnd.qcelp":{"source":"iana"},"audio/vnd.rhetorex.32kadpcm":{"source":"iana"},"audio/vnd.rip":{"source":"iana","extensions":["rip"]},"audio/vnd.rn-realaudio":{"compressible":false},"audio/vnd.sealedmedia.softseal.mpeg":{"source":"iana"},"audio/vnd.vmx.cvsd":{"source":"iana"},"audio/vnd.wave":{"compressible":false},"audio/vorbis":{"source":"iana","compressible":false},"audio/vorbis-config":{"source":"iana"},"audio/wav":{"compressible":false,"extensions":["wav"]},"audio/wave":{"compressible":false,"extensions":["wav"]},"audio/webm":{"source":"apache","compressible":false,"extensions":["weba"]},"audio/x-aac":{"source":"apache","compressible":false,"extensions":["aac"]},"audio/x-aiff":{"source":"apache","extensions":["aif","aiff","aifc"]},"audio/x-caf":{"source":"apache","compressible":false,"extensions":["caf"]},"audio/x-flac":{"source":"apache","extensions":["flac"]},"audio/x-m4a":{"source":"nginx","extensions":["m4a"]},"audio/x-matroska":{"source":"apache","extensions":["mka"]},"audio/x-mpegurl":{"source":"apache","extensions":["m3u"]},"audio/x-ms-wax":{"source":"apache","extensions":["wax"]},"audio/x-ms-wma":{"source":"apache","extensions":["wma"]},"audio/x-pn-realaudio":{"source":"apache","extensions":["ram","ra"]},"audio/x-pn-realaudio-plugin":{"source":"apache","extensions":["rmp"]},"audio/x-realaudio":{"source":"nginx","extensions":["ra"]},"audio/x-tta":{"source":"apache"},"audio/x-wav":{"source":"apache","extensions":["wav"]},"audio/xm":{"source":"apache","extensions":["xm"]},"chemical/x-cdx":{"source":"apache","extensions":["cdx"]},"chemical/x-cif":{"source":"apache","extensions":["cif"]},"chemical/x-cmdf":{"source":"apache","extensions":["cmdf"]},"chemical/x-cml":{"source":"apache","extensions":["cml"]},"chemical/x-csml":{"source":"apache","extensions":["csml"]},"chemical/x-pdb":{"source":"apache"},"chemical/x-xyz":{"source":"apache","extensions":["xyz"]},"font/collection":{"source":"iana","extensions":["ttc"]},"font/otf":{"source":"iana","compressible":true,"extensions":["otf"]},"font/sfnt":{"source":"iana"},"font/ttf":{"source":"iana","compressible":true,"extensions":["ttf"]},"font/woff":{"source":"iana","extensions":["woff"]},"font/woff2":{"source":"iana","extensions":["woff2"]},"image/aces":{"source":"iana","extensions":["exr"]},"image/apng":{"compressible":false,"extensions":["apng"]},"image/avci":{"source":"iana"},"image/avcs":{"source":"iana"},"image/avif":{"source":"iana","compressible":false,"extensions":["avif"]},"image/bmp":{"source":"iana","compressible":true,"extensions":["bmp"]},"image/cgm":{"source":"iana","extensions":["cgm"]},"image/dicom-rle":{"source":"iana","extensions":["drle"]},"image/emf":{"source":"iana","extensions":["emf"]},"image/fits":{"source":"iana","extensions":["fits"]},"image/g3fax":{"source":"iana","extensions":["g3"]},"image/gif":{"source":"iana","compressible":false,"extensions":["gif"]},"image/heic":{"source":"iana","extensions":["heic"]},"image/heic-sequence":{"source":"iana","extensions":["heics"]},"image/heif":{"source":"iana","extensions":["heif"]},"image/heif-sequence":{"source":"iana","extensions":["heifs"]},"image/hej2k":{"source":"iana","extensions":["hej2"]},"image/hsj2":{"source":"iana","extensions":["hsj2"]},"image/ief":{"source":"iana","extensions":["ief"]},"image/jls":{"source":"iana","extensions":["jls"]},"image/jp2":{"source":"iana","compressible":false,"extensions":["jp2","jpg2"]},"image/jpeg":{"source":"iana","compressible":false,"extensions":["jpeg","jpg","jpe"]},"image/jph":{"source":"iana","extensions":["jph"]},"image/jphc":{"source":"iana","extensions":["jhc"]},"image/jpm":{"source":"iana","compressible":false,"extensions":["jpm"]},"image/jpx":{"source":"iana","compressible":false,"extensions":["jpx","jpf"]},"image/jxr":{"source":"iana","extensions":["jxr"]},"image/jxra":{"source":"iana","extensions":["jxra"]},"image/jxrs":{"source":"iana","extensions":["jxrs"]},"image/jxs":{"source":"iana","extensions":["jxs"]},"image/jxsc":{"source":"iana","extensions":["jxsc"]},"image/jxsi":{"source":"iana","extensions":["jxsi"]},"image/jxss":{"source":"iana","extensions":["jxss"]},"image/ktx":{"source":"iana","extensions":["ktx"]},"image/ktx2":{"source":"iana","extensions":["ktx2"]},"image/naplps":{"source":"iana"},"image/pjpeg":{"compressible":false},"image/png":{"source":"iana","compressible":false,"extensions":["png"]},"image/prs.btif":{"source":"iana","extensions":["btif"]},"image/prs.pti":{"source":"iana","extensions":["pti"]},"image/pwg-raster":{"source":"iana"},"image/sgi":{"source":"apache","extensions":["sgi"]},"image/svg+xml":{"source":"iana","compressible":true,"extensions":["svg","svgz"]},"image/t38":{"source":"iana","extensions":["t38"]},"image/tiff":{"source":"iana","compressible":false,"extensions":["tif","tiff"]},"image/tiff-fx":{"source":"iana","extensions":["tfx"]},"image/vnd.adobe.photoshop":{"source":"iana","compressible":true,"extensions":["psd"]},"image/vnd.airzip.accelerator.azv":{"source":"iana","extensions":["azv"]},"image/vnd.cns.inf2":{"source":"iana"},"image/vnd.dece.graphic":{"source":"iana","extensions":["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{"source":"iana","extensions":["djvu","djv"]},"image/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"image/vnd.dwg":{"source":"iana","extensions":["dwg"]},"image/vnd.dxf":{"source":"iana","extensions":["dxf"]},"image/vnd.fastbidsheet":{"source":"iana","extensions":["fbs"]},"image/vnd.fpx":{"source":"iana","extensions":["fpx"]},"image/vnd.fst":{"source":"iana","extensions":["fst"]},"image/vnd.fujixerox.edmics-mmr":{"source":"iana","extensions":["mmr"]},"image/vnd.fujixerox.edmics-rlc":{"source":"iana","extensions":["rlc"]},"image/vnd.globalgraphics.pgb":{"source":"iana"},"image/vnd.microsoft.icon":{"source":"iana","compressible":true,"extensions":["ico"]},"image/vnd.mix":{"source":"iana"},"image/vnd.mozilla.apng":{"source":"iana"},"image/vnd.ms-dds":{"compressible":true,"extensions":["dds"]},"image/vnd.ms-modi":{"source":"iana","extensions":["mdi"]},"image/vnd.ms-photo":{"source":"apache","extensions":["wdp"]},"image/vnd.net-fpx":{"source":"iana","extensions":["npx"]},"image/vnd.pco.b16":{"source":"iana","extensions":["b16"]},"image/vnd.radiance":{"source":"iana"},"image/vnd.sealed.png":{"source":"iana"},"image/vnd.sealedmedia.softseal.gif":{"source":"iana"},"image/vnd.sealedmedia.softseal.jpg":{"source":"iana"},"image/vnd.svf":{"source":"iana"},"image/vnd.tencent.tap":{"source":"iana","extensions":["tap"]},"image/vnd.valve.source.texture":{"source":"iana","extensions":["vtf"]},"image/vnd.wap.wbmp":{"source":"iana","extensions":["wbmp"]},"image/vnd.xiff":{"source":"iana","extensions":["xif"]},"image/vnd.zbrush.pcx":{"source":"iana","extensions":["pcx"]},"image/webp":{"source":"apache","extensions":["webp"]},"image/wmf":{"source":"iana","extensions":["wmf"]},"image/x-3ds":{"source":"apache","extensions":["3ds"]},"image/x-cmu-raster":{"source":"apache","extensions":["ras"]},"image/x-cmx":{"source":"apache","extensions":["cmx"]},"image/x-freehand":{"source":"apache","extensions":["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{"source":"apache","compressible":true,"extensions":["ico"]},"image/x-jng":{"source":"nginx","extensions":["jng"]},"image/x-mrsid-image":{"source":"apache","extensions":["sid"]},"image/x-ms-bmp":{"source":"nginx","compressible":true,"extensions":["bmp"]},"image/x-pcx":{"source":"apache","extensions":["pcx"]},"image/x-pict":{"source":"apache","extensions":["pic","pct"]},"image/x-portable-anymap":{"source":"apache","extensions":["pnm"]},"image/x-portable-bitmap":{"source":"apache","extensions":["pbm"]},"image/x-portable-graymap":{"source":"apache","extensions":["pgm"]},"image/x-portable-pixmap":{"source":"apache","extensions":["ppm"]},"image/x-rgb":{"source":"apache","extensions":["rgb"]},"image/x-tga":{"source":"apache","extensions":["tga"]},"image/x-xbitmap":{"source":"apache","extensions":["xbm"]},"image/x-xcf":{"compressible":false},"image/x-xpixmap":{"source":"apache","extensions":["xpm"]},"image/x-xwindowdump":{"source":"apache","extensions":["xwd"]},"message/cpim":{"source":"iana"},"message/delivery-status":{"source":"iana"},"message/disposition-notification":{"source":"iana","extensions":["disposition-notification"]},"message/external-body":{"source":"iana"},"message/feedback-report":{"source":"iana"},"message/global":{"source":"iana","extensions":["u8msg"]},"message/global-delivery-status":{"source":"iana","extensions":["u8dsn"]},"message/global-disposition-notification":{"source":"iana","extensions":["u8mdn"]},"message/global-headers":{"source":"iana","extensions":["u8hdr"]},"message/http":{"source":"iana","compressible":false},"message/imdn+xml":{"source":"iana","compressible":true},"message/news":{"source":"iana"},"message/partial":{"source":"iana","compressible":false},"message/rfc822":{"source":"iana","compressible":true,"extensions":["eml","mime"]},"message/s-http":{"source":"iana"},"message/sip":{"source":"iana"},"message/sipfrag":{"source":"iana"},"message/tracking-status":{"source":"iana"},"message/vnd.si.simp":{"source":"iana"},"message/vnd.wfa.wsc":{"source":"iana","extensions":["wsc"]},"model/3mf":{"source":"iana","extensions":["3mf"]},"model/e57":{"source":"iana"},"model/gltf+json":{"source":"iana","compressible":true,"extensions":["gltf"]},"model/gltf-binary":{"source":"iana","compressible":true,"extensions":["glb"]},"model/iges":{"source":"iana","compressible":false,"extensions":["igs","iges"]},"model/mesh":{"source":"iana","compressible":false,"extensions":["msh","mesh","silo"]},"model/mtl":{"source":"iana","extensions":["mtl"]},"model/obj":{"source":"iana","extensions":["obj"]},"model/step":{"source":"iana"},"model/step+xml":{"source":"iana","compressible":true,"extensions":["stpx"]},"model/step+zip":{"source":"iana","compressible":false,"extensions":["stpz"]},"model/step-xml+zip":{"source":"iana","compressible":false,"extensions":["stpxz"]},"model/stl":{"source":"iana","extensions":["stl"]},"model/vnd.collada+xml":{"source":"iana","compressible":true,"extensions":["dae"]},"model/vnd.dwf":{"source":"iana","extensions":["dwf"]},"model/vnd.flatland.3dml":{"source":"iana"},"model/vnd.gdl":{"source":"iana","extensions":["gdl"]},"model/vnd.gs-gdl":{"source":"apache"},"model/vnd.gs.gdl":{"source":"iana"},"model/vnd.gtw":{"source":"iana","extensions":["gtw"]},"model/vnd.moml+xml":{"source":"iana","compressible":true},"model/vnd.mts":{"source":"iana","extensions":["mts"]},"model/vnd.opengex":{"source":"iana","extensions":["ogex"]},"model/vnd.parasolid.transmit.binary":{"source":"iana","extensions":["x_b"]},"model/vnd.parasolid.transmit.text":{"source":"iana","extensions":["x_t"]},"model/vnd.pytha.pyox":{"source":"iana"},"model/vnd.rosette.annotated-data-model":{"source":"iana"},"model/vnd.sap.vds":{"source":"iana","extensions":["vds"]},"model/vnd.usdz+zip":{"source":"iana","compressible":false,"extensions":["usdz"]},"model/vnd.valve.source.compiled-map":{"source":"iana","extensions":["bsp"]},"model/vnd.vtu":{"source":"iana","extensions":["vtu"]},"model/vrml":{"source":"iana","compressible":false,"extensions":["wrl","vrml"]},"model/x3d+binary":{"source":"apache","compressible":false,"extensions":["x3db","x3dbz"]},"model/x3d+fastinfoset":{"source":"iana","extensions":["x3db"]},"model/x3d+vrml":{"source":"apache","compressible":false,"extensions":["x3dv","x3dvz"]},"model/x3d+xml":{"source":"iana","compressible":true,"extensions":["x3d","x3dz"]},"model/x3d-vrml":{"source":"iana","extensions":["x3dv"]},"multipart/alternative":{"source":"iana","compressible":false},"multipart/appledouble":{"source":"iana"},"multipart/byteranges":{"source":"iana"},"multipart/digest":{"source":"iana"},"multipart/encrypted":{"source":"iana","compressible":false},"multipart/form-data":{"source":"iana","compressible":false},"multipart/header-set":{"source":"iana"},"multipart/mixed":{"source":"iana"},"multipart/multilingual":{"source":"iana"},"multipart/parallel":{"source":"iana"},"multipart/related":{"source":"iana","compressible":false},"multipart/report":{"source":"iana"},"multipart/signed":{"source":"iana","compressible":false},"multipart/vnd.bint.med-plus":{"source":"iana"},"multipart/voice-message":{"source":"iana"},"multipart/x-mixed-replace":{"source":"iana"},"text/1d-interleaved-parityfec":{"source":"iana"},"text/cache-manifest":{"source":"iana","compressible":true,"extensions":["appcache","manifest"]},"text/calendar":{"source":"iana","extensions":["ics","ifb"]},"text/calender":{"compressible":true},"text/cmd":{"compressible":true},"text/coffeescript":{"extensions":["coffee","litcoffee"]},"text/cql":{"source":"iana"},"text/cql-expression":{"source":"iana"},"text/cql-identifier":{"source":"iana"},"text/css":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["css"]},"text/csv":{"source":"iana","compressible":true,"extensions":["csv"]},"text/csv-schema":{"source":"iana"},"text/directory":{"source":"iana"},"text/dns":{"source":"iana"},"text/ecmascript":{"source":"iana"},"text/encaprtp":{"source":"iana"},"text/enriched":{"source":"iana"},"text/fhirpath":{"source":"iana"},"text/flexfec":{"source":"iana"},"text/fwdred":{"source":"iana"},"text/gff3":{"source":"iana"},"text/grammar-ref-list":{"source":"iana"},"text/html":{"source":"iana","compressible":true,"extensions":["html","htm","shtml"]},"text/jade":{"extensions":["jade"]},"text/javascript":{"source":"iana","compressible":true},"text/jcr-cnd":{"source":"iana"},"text/jsx":{"compressible":true,"extensions":["jsx"]},"text/less":{"compressible":true,"extensions":["less"]},"text/markdown":{"source":"iana","compressible":true,"extensions":["markdown","md"]},"text/mathml":{"source":"nginx","extensions":["mml"]},"text/mdx":{"compressible":true,"extensions":["mdx"]},"text/mizar":{"source":"iana"},"text/n3":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["n3"]},"text/parameters":{"source":"iana","charset":"UTF-8"},"text/parityfec":{"source":"iana"},"text/plain":{"source":"iana","compressible":true,"extensions":["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{"source":"iana","charset":"UTF-8"},"text/prs.fallenstein.rst":{"source":"iana"},"text/prs.lines.tag":{"source":"iana","extensions":["dsc"]},"text/prs.prop.logic":{"source":"iana"},"text/raptorfec":{"source":"iana"},"text/red":{"source":"iana"},"text/rfc822-headers":{"source":"iana"},"text/richtext":{"source":"iana","compressible":true,"extensions":["rtx"]},"text/rtf":{"source":"iana","compressible":true,"extensions":["rtf"]},"text/rtp-enc-aescm128":{"source":"iana"},"text/rtploopback":{"source":"iana"},"text/rtx":{"source":"iana"},"text/sgml":{"source":"iana","extensions":["sgml","sgm"]},"text/shaclc":{"source":"iana"},"text/shex":{"source":"iana","extensions":["shex"]},"text/slim":{"extensions":["slim","slm"]},"text/spdx":{"source":"iana","extensions":["spdx"]},"text/strings":{"source":"iana"},"text/stylus":{"extensions":["stylus","styl"]},"text/t140":{"source":"iana"},"text/tab-separated-values":{"source":"iana","compressible":true,"extensions":["tsv"]},"text/troff":{"source":"iana","extensions":["t","tr","roff","man","me","ms"]},"text/turtle":{"source":"iana","charset":"UTF-8","extensions":["ttl"]},"text/ulpfec":{"source":"iana"},"text/uri-list":{"source":"iana","compressible":true,"extensions":["uri","uris","urls"]},"text/vcard":{"source":"iana","compressible":true,"extensions":["vcard"]},"text/vnd.a":{"source":"iana"},"text/vnd.abc":{"source":"iana"},"text/vnd.ascii-art":{"source":"iana"},"text/vnd.curl":{"source":"iana","extensions":["curl"]},"text/vnd.curl.dcurl":{"source":"apache","extensions":["dcurl"]},"text/vnd.curl.mcurl":{"source":"apache","extensions":["mcurl"]},"text/vnd.curl.scurl":{"source":"apache","extensions":["scurl"]},"text/vnd.debian.copyright":{"source":"iana","charset":"UTF-8"},"text/vnd.dmclientscript":{"source":"iana"},"text/vnd.dvb.subtitle":{"source":"iana","extensions":["sub"]},"text/vnd.esmertec.theme-descriptor":{"source":"iana","charset":"UTF-8"},"text/vnd.familysearch.gedcom":{"source":"iana","extensions":["ged"]},"text/vnd.ficlab.flt":{"source":"iana"},"text/vnd.fly":{"source":"iana","extensions":["fly"]},"text/vnd.fmi.flexstor":{"source":"iana","extensions":["flx"]},"text/vnd.gml":{"source":"iana"},"text/vnd.graphviz":{"source":"iana","extensions":["gv"]},"text/vnd.hans":{"source":"iana"},"text/vnd.hgl":{"source":"iana"},"text/vnd.in3d.3dml":{"source":"iana","extensions":["3dml"]},"text/vnd.in3d.spot":{"source":"iana","extensions":["spot"]},"text/vnd.iptc.newsml":{"source":"iana"},"text/vnd.iptc.nitf":{"source":"iana"},"text/vnd.latex-z":{"source":"iana"},"text/vnd.motorola.reflex":{"source":"iana"},"text/vnd.ms-mediapackage":{"source":"iana"},"text/vnd.net2phone.commcenter.command":{"source":"iana"},"text/vnd.radisys.msml-basic-layout":{"source":"iana"},"text/vnd.senx.warpscript":{"source":"iana"},"text/vnd.si.uricatalogue":{"source":"iana"},"text/vnd.sosi":{"source":"iana"},"text/vnd.sun.j2me.app-descriptor":{"source":"iana","charset":"UTF-8","extensions":["jad"]},"text/vnd.trolltech.linguist":{"source":"iana","charset":"UTF-8"},"text/vnd.wap.si":{"source":"iana"},"text/vnd.wap.sl":{"source":"iana"},"text/vnd.wap.wml":{"source":"iana","extensions":["wml"]},"text/vnd.wap.wmlscript":{"source":"iana","extensions":["wmls"]},"text/vtt":{"source":"iana","charset":"UTF-8","compressible":true,"extensions":["vtt"]},"text/x-asm":{"source":"apache","extensions":["s","asm"]},"text/x-c":{"source":"apache","extensions":["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{"source":"nginx","extensions":["htc"]},"text/x-fortran":{"source":"apache","extensions":["f","for","f77","f90"]},"text/x-gwt-rpc":{"compressible":true},"text/x-handlebars-template":{"extensions":["hbs"]},"text/x-java-source":{"source":"apache","extensions":["java"]},"text/x-jquery-tmpl":{"compressible":true},"text/x-lua":{"extensions":["lua"]},"text/x-markdown":{"compressible":true,"extensions":["mkd"]},"text/x-nfo":{"source":"apache","extensions":["nfo"]},"text/x-opml":{"source":"apache","extensions":["opml"]},"text/x-org":{"compressible":true,"extensions":["org"]},"text/x-pascal":{"source":"apache","extensions":["p","pas"]},"text/x-processing":{"compressible":true,"extensions":["pde"]},"text/x-sass":{"extensions":["sass"]},"text/x-scss":{"extensions":["scss"]},"text/x-setext":{"source":"apache","extensions":["etx"]},"text/x-sfv":{"source":"apache","extensions":["sfv"]},"text/x-suse-ymp":{"compressible":true,"extensions":["ymp"]},"text/x-uuencode":{"source":"apache","extensions":["uu"]},"text/x-vcalendar":{"source":"apache","extensions":["vcs"]},"text/x-vcard":{"source":"apache","extensions":["vcf"]},"text/xml":{"source":"iana","compressible":true,"extensions":["xml"]},"text/xml-external-parsed-entity":{"source":"iana"},"text/yaml":{"compressible":true,"extensions":["yaml","yml"]},"video/1d-interleaved-parityfec":{"source":"iana"},"video/3gpp":{"source":"iana","extensions":["3gp","3gpp"]},"video/3gpp-tt":{"source":"iana"},"video/3gpp2":{"source":"iana","extensions":["3g2"]},"video/av1":{"source":"iana"},"video/bmpeg":{"source":"iana"},"video/bt656":{"source":"iana"},"video/celb":{"source":"iana"},"video/dv":{"source":"iana"},"video/encaprtp":{"source":"iana"},"video/ffv1":{"source":"iana"},"video/flexfec":{"source":"iana"},"video/h261":{"source":"iana","extensions":["h261"]},"video/h263":{"source":"iana","extensions":["h263"]},"video/h263-1998":{"source":"iana"},"video/h263-2000":{"source":"iana"},"video/h264":{"source":"iana","extensions":["h264"]},"video/h264-rcdo":{"source":"iana"},"video/h264-svc":{"source":"iana"},"video/h265":{"source":"iana"},"video/iso.segment":{"source":"iana","extensions":["m4s"]},"video/jpeg":{"source":"iana","extensions":["jpgv"]},"video/jpeg2000":{"source":"iana"},"video/jpm":{"source":"apache","extensions":["jpm","jpgm"]},"video/jxsv":{"source":"iana"},"video/mj2":{"source":"iana","extensions":["mj2","mjp2"]},"video/mp1s":{"source":"iana"},"video/mp2p":{"source":"iana"},"video/mp2t":{"source":"iana","extensions":["ts"]},"video/mp4":{"source":"iana","compressible":false,"extensions":["mp4","mp4v","mpg4"]},"video/mp4v-es":{"source":"iana"},"video/mpeg":{"source":"iana","compressible":false,"extensions":["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{"source":"iana"},"video/mpv":{"source":"iana"},"video/nv":{"source":"iana"},"video/ogg":{"source":"iana","compressible":false,"extensions":["ogv"]},"video/parityfec":{"source":"iana"},"video/pointer":{"source":"iana"},"video/quicktime":{"source":"iana","compressible":false,"extensions":["qt","mov"]},"video/raptorfec":{"source":"iana"},"video/raw":{"source":"iana"},"video/rtp-enc-aescm128":{"source":"iana"},"video/rtploopback":{"source":"iana"},"video/rtx":{"source":"iana"},"video/scip":{"source":"iana"},"video/smpte291":{"source":"iana"},"video/smpte292m":{"source":"iana"},"video/ulpfec":{"source":"iana"},"video/vc1":{"source":"iana"},"video/vc2":{"source":"iana"},"video/vnd.cctv":{"source":"iana"},"video/vnd.dece.hd":{"source":"iana","extensions":["uvh","uvvh"]},"video/vnd.dece.mobile":{"source":"iana","extensions":["uvm","uvvm"]},"video/vnd.dece.mp4":{"source":"iana"},"video/vnd.dece.pd":{"source":"iana","extensions":["uvp","uvvp"]},"video/vnd.dece.sd":{"source":"iana","extensions":["uvs","uvvs"]},"video/vnd.dece.video":{"source":"iana","extensions":["uvv","uvvv"]},"video/vnd.directv.mpeg":{"source":"iana"},"video/vnd.directv.mpeg-tts":{"source":"iana"},"video/vnd.dlna.mpeg-tts":{"source":"iana"},"video/vnd.dvb.file":{"source":"iana","extensions":["dvb"]},"video/vnd.fvt":{"source":"iana","extensions":["fvt"]},"video/vnd.hns.video":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.1dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-1010":{"source":"iana"},"video/vnd.iptvforum.2dparityfec-2005":{"source":"iana"},"video/vnd.iptvforum.ttsavc":{"source":"iana"},"video/vnd.iptvforum.ttsmpeg2":{"source":"iana"},"video/vnd.motorola.video":{"source":"iana"},"video/vnd.motorola.videop":{"source":"iana"},"video/vnd.mpegurl":{"source":"iana","extensions":["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{"source":"iana","extensions":["pyv"]},"video/vnd.nokia.interleaved-multimedia":{"source":"iana"},"video/vnd.nokia.mp4vr":{"source":"iana"},"video/vnd.nokia.videovoip":{"source":"iana"},"video/vnd.objectvideo":{"source":"iana"},"video/vnd.radgamettools.bink":{"source":"iana"},"video/vnd.radgamettools.smacker":{"source":"iana"},"video/vnd.sealed.mpeg1":{"source":"iana"},"video/vnd.sealed.mpeg4":{"source":"iana"},"video/vnd.sealed.swf":{"source":"iana"},"video/vnd.sealedmedia.softseal.mov":{"source":"iana"},"video/vnd.uvvu.mp4":{"source":"iana","extensions":["uvu","uvvu"]},"video/vnd.vivo":{"source":"iana","extensions":["viv"]},"video/vnd.youtube.yt":{"source":"iana"},"video/vp8":{"source":"iana"},"video/vp9":{"source":"iana"},"video/webm":{"source":"apache","compressible":false,"extensions":["webm"]},"video/x-f4v":{"source":"apache","extensions":["f4v"]},"video/x-fli":{"source":"apache","extensions":["fli"]},"video/x-flv":{"source":"apache","compressible":false,"extensions":["flv"]},"video/x-m4v":{"source":"apache","extensions":["m4v"]},"video/x-matroska":{"source":"apache","compressible":false,"extensions":["mkv","mk3d","mks"]},"video/x-mng":{"source":"apache","extensions":["mng"]},"video/x-ms-asf":{"source":"apache","extensions":["asf","asx"]},"video/x-ms-vob":{"source":"apache","extensions":["vob"]},"video/x-ms-wm":{"source":"apache","extensions":["wm"]},"video/x-ms-wmv":{"source":"apache","compressible":false,"extensions":["wmv"]},"video/x-ms-wmx":{"source":"apache","extensions":["wmx"]},"video/x-ms-wvx":{"source":"apache","extensions":["wvx"]},"video/x-msvideo":{"source":"apache","extensions":["avi"]},"video/x-sgi-movie":{"source":"apache","extensions":["movie"]},"video/x-smv":{"source":"apache","extensions":["smv"]},"x-conference/x-cooltalk":{"source":"apache","extensions":["ice"]},"x-shader/x-fragment":{"compressible":true},"x-shader/x-vertex":{"compressible":true}}'); + +/***/ }), +/* 37 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _document_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38); +/* harmony import */ var _element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41); +/* harmony import */ var _fetch_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42); +/* harmony import */ var _function_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43); +/* harmony import */ var _history_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(44); +/* harmony import */ var _xhr_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(45); +/* harmony import */ var _location_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46); +/* harmony import */ var _message_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(47); +/* harmony import */ var _navigator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(48); +/* harmony import */ var _worker_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(49); +/* harmony import */ var _url_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(50); +/* harmony import */ var _eventsource_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(51); +/* harmony import */ var _node_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(52); +/* harmony import */ var _websocket_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(53); +/* harmony import */ var _attr_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(54); +/* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(55); + + + + + + + + + + + + + + + + + +class Oxidation { + constructor(window = self, worker = !window.window) { + this.window = window; + this.fnStrings = new Map(); + this.originalFn = new Map(); + this.originalDescriptor = new Map(); + this.nativeMethods = { + fnToString: this.window.Function.prototype.toString, + defineProperty: this.window.Object.defineProperty, + getOwnPropertyDescriptor: this.window.Object.getOwnPropertyDescriptor, + getOwnPropertyDescriptors: this.window.Object.getOwnPropertyDescriptors, + isArray: this.window.Array.isArray, + setPrototypeOf: this.window.Object.setPrototypeOf, + }; + this.worker = worker; + this.fetch = new _fetch_js__WEBPACK_IMPORTED_MODULE_2__["default"](this); + this.xhr = new _xhr_js__WEBPACK_IMPORTED_MODULE_5__["default"](this); + this.history = new _history_js__WEBPACK_IMPORTED_MODULE_4__["default"](this); + this.element = new _element_js__WEBPACK_IMPORTED_MODULE_1__["default"](this); + this.node = new _node_js__WEBPACK_IMPORTED_MODULE_12__["default"](this) + this.document = new _document_js__WEBPACK_IMPORTED_MODULE_0__["default"](this); + this.function = new _function_js__WEBPACK_IMPORTED_MODULE_3__["default"](this); + this.object = new _object_js__WEBPACK_IMPORTED_MODULE_15__["default"](this); + this.message = new _message_js__WEBPACK_IMPORTED_MODULE_7__["default"](this); + this.websocket = new _websocket_js__WEBPACK_IMPORTED_MODULE_13__["default"](this); + this.navigator = new _navigator_js__WEBPACK_IMPORTED_MODULE_8__["default"](this); + this.eventSource = new _eventsource_js__WEBPACK_IMPORTED_MODULE_11__["default"](this); + this.attribute = new _attr_js__WEBPACK_IMPORTED_MODULE_14__["default"](this); + this.url = new _url_js__WEBPACK_IMPORTED_MODULE_10__["default"](this); + this.workers = new _worker_js__WEBPACK_IMPORTED_MODULE_9__["default"](this); + this.LocationApi = _location_js__WEBPACK_IMPORTED_MODULE_6__["default"]; + this.location = null; + }; + initLocation(rewriteUrl, sourceUrl) { + this.location = new _location_js__WEBPACK_IMPORTED_MODULE_6__["default"](this, sourceUrl, rewriteUrl, this.worker); + }; + override(obj, prop, wrapper, construct) { + if (!prop in obj) return false; + const wrapped = this.wrap(obj, prop, wrapper, construct); + return obj[prop] = wrapped; + }; + overrideDescriptor(obj, prop, wrapObj = {}) { + const wrapped = this.wrapDescriptor(obj, prop, wrapObj); + if (!wrapped) return {}; + this.nativeMethods.defineProperty(obj, prop, wrapped); + return wrapped; + }; + wrap(obj, prop, wrap, construct) { + const fn = obj[prop]; + if (!fn) return fn; + const wrapped = 'prototype' in fn ? function attach() { + return wrap(fn, this, [...arguments]); + } : { + attach() { + return wrap(fn, this, [...arguments]); + }, + }['attach']; + + this.fnStrings.set(wrapped, fn.toString()); + + this.nativeMethods.defineProperty(wrapped, 'name', this.nativeMethods.getOwnPropertyDescriptor(fn, 'name')); + this.nativeMethods.defineProperty(wrapped, 'length', this.nativeMethods.getOwnPropertyDescriptor(fn, 'length')); + + if (!!construct) { + wrapped.prototype = fn.prototype; + wrapped.prototype.constructor = wrapped; + }; + + return wrapped; + }; + wrapDescriptor(obj, prop, wrapObj = {}) { + const descriptor = this.nativeMethods.getOwnPropertyDescriptor(obj, prop); + if (!descriptor) return false; + for (let key in wrapObj) { + if (key in descriptor) { + if (key === 'get' || key === 'set') { + descriptor[key] = this.wrap(descriptor, key, wrapObj[key]); + } else { + descriptor[key] = typeof wrapObj[key] == 'function' ? wrapObj[key](descriptor[key]) : wrapObj[key]; + }; + } + }; + return descriptor; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Oxidation); +if (typeof self === 'object') self.Oxidation = Oxidation; + +/***/ }), +/* 38 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class DocumentHook extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.document = this.window.document; + this.Document = this.window.Document || {}; + this.DOMParser = this.window.DOMParser || {}; + this.docProto = this.Document.prototype || {}; + this.domProto = this.DOMParser.prototype || {}; + this.title = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'title'); + this.cookie = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'cookie'); + this.referrer = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'referrer'); + this.domain = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'domain'); + this.documentURI = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'documentURI'); + this.write = this.docProto.write; + this.writeln = this.docProto.writeln; + this.querySelector = this.docProto.querySelector; + this.querySelectorAll = this.docProto.querySelectorAll; + this.parseFromString = this.domProto.parseFromString; + this.URL = ctx.nativeMethods.getOwnPropertyDescriptor(this.docProto, 'URL'); + }; + overrideParseFromString() { + this.ctx.override(this.domProto, 'parseFromString', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ string, type ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ string, type }, target, that); + this.emit('parseFromString', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.string, event.data.type); + }); + }; + overrideQuerySelector() { + this.ctx.override(this.docProto, 'querySelector', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ selectors ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ selectors }, target, that); + this.emit('querySelector', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.selectors); + }); + }; + overrideDomain() { + this.ctx.overrideDescriptor(this.docProto, 'domain', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getDomain', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: val }, target, that); + this.emit('setDomain', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; + overrideReferrer() { + this.ctx.overrideDescriptor(this.docProto, 'referrer', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('referrer', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideCreateTreeWalker() { + this.ctx.override(this.docProto, 'createTreeWalker', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ root, show = 0xFFFFFFFF, filter, expandEntityReferences ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ root, show, filter, expandEntityReferences }, target, that); + this.emit('createTreeWalker', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.root, event.data.show, event.data.filter, event.data.expandEntityReferences); + }); + }; + overrideWrite() { + this.ctx.override(this.docProto, 'write', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ ...html ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ html }, target, that); + this.emit('write', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.html); + }); + this.ctx.override(this.docProto, 'writeln', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ ...html ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ html }, target, that); + this.emit('writeln', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.html); + }); + }; + overrideDocumentURI() { + this.ctx.overrideDescriptor(this.docProto, 'documentURI', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('documentURI', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideURL() { + this.ctx.overrideDescriptor(this.docProto, 'URL', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('url', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideReferrer() { + this.ctx.overrideDescriptor(this.docProto, 'referrer', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('referrer', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideCookie() { + this.ctx.overrideDescriptor(this.docProto, 'cookie', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getCookie', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ value ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value, }, target, that); + this.emit('setCookie', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; + overrideTitle() { + this.ctx.overrideDescriptor(this.docProto, 'title', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getTitle', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ value ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value, }, target, that); + this.emit('setTitle', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.value); + }, + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DocumentHook); + +/***/ }), +/* 39 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventEmitter); + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + +/***/ }), +/* 40 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +class HookEvent { + #intercepted; + #returnValue; + constructor(data = {}, target = null, that = null) { + this.#intercepted = false; + this.#returnValue = null; + this.data = data; + this.target = target; + this.that = that; + }; + get intercepted() { + return this.#intercepted; + }; + get returnValue() { + return this.#returnValue; + }; + respondWith(input) { + this.#returnValue = input; + this.#intercepted = true; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HookEvent); + +/***/ }), +/* 41 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +// Events +// getInnerHTML +// setInnerHTML +// getOuterHTML +// setOuterHTML + +// setAttribute +// getAttribute +// hasAttribute +// removeAttribute + +class ElementApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Audio = this.window.Audio; + this.Element = this.window.Element; + this.elemProto = this.Element ? this.Element.prototype : {}; + this.innerHTML = ctx.nativeMethods.getOwnPropertyDescriptor(this.elemProto, 'innerHTML'); + this.outerHTML = ctx.nativeMethods.getOwnPropertyDescriptor(this.elemProto, 'outerHTML'); + this.setAttribute = this.elemProto.setAttribute; + this.getAttribute = this.elemProto.getAttribute; + this.removeAttribute = this.elemProto.removeAttribute; + this.hasAttribute = this.elemProto.hasAttribute; + this.querySelector = this.elemProto.querySelector; + this.querySelectorAll = this.elemProto.querySelectorAll; + this.insertAdjacentHTML = this.elemProto.insertAdjacentHTML; + this.insertAdjacentText = this.elemProto.insertAdjacentText; + }; + overrideQuerySelector() { + this.ctx.override(this.elemProto, 'querySelector', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ selectors ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ selectors }, target, that); + this.emit('querySelector', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.selectors); + }); + }; + overrideAttribute() { + this.ctx.override(this.elemProto, 'getAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name }, target, that); + this.emit('getAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + this.ctx.override(this.elemProto, 'setAttribute', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ name, value ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value }, target, that); + this.emit('setAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name, event.data.value); + }); + this.ctx.override(this.elemProto, 'hasAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name }, target, that); + this.emit('hasAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + this.ctx.override(this.elemProto, 'removeAttribute', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name }, target, that); + this.emit('removeAttribute', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.name); + }); + }; + overrideAudio() { + this.ctx.override(this.window, 'Audio', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url }, target, that); + this.emit('audio', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url); + }, true); + }; + overrideHtml() { + this.hookProperty(this.Element, 'innerHTML', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getInnerHTML', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: val }, target, that); + this.emit('setInnerHTML', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + this.hookProperty(this.Element, 'outerHTML', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getOuterHTML', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: val }, target, that); + this.emit('setOuterHTML', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + }; + overrideInsertAdjacentHTML() { + this.ctx.override(this.elemProto, 'insertAdjacentHTML', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ position, html ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ position, html }, target, that); + this.emit('insertAdjacentHTML', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.position, event.data.html); + }); + }; + overrideInsertAdjacentText() { + this.ctx.override(this.elemProto, 'insertAdjacentText', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ position, text ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ position, text }, target, that); + this.emit('insertAdjacentText', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.position, event.data.text); + }); + }; + hookProperty(element, prop, handler) { + if (!element || !prop in element) return false; + + if (this.ctx.nativeMethods.isArray(element)) { + for (const elem of element) { + this.hookProperty(elem, prop, handler); + }; + return true; + }; + + const proto = element.prototype; + + this.ctx.overrideDescriptor(proto, prop, handler); + + return true; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ElementApi); + +/***/ }), +/* 42 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class Fetch extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.fetch = this.window.fetch; + this.Request = this.window.Request; + this.Response = this.window.Response; + this.Headers = this.window.Headers; + this.reqProto = this.Request ? this.Request.prototype : {}; + this.resProto = this.Response ? this.Response.prototype : {}; + this.headersProto = this.Headers ? this.Headers.prototype : {}; + this.reqUrl = ctx.nativeMethods.getOwnPropertyDescriptor(this.reqProto, 'url'); + this.resUrl = ctx.nativeMethods.getOwnPropertyDescriptor(this.resProto, 'url'); + this.reqHeaders = ctx.nativeMethods.getOwnPropertyDescriptor(this.reqProto, 'headers'); + this.resHeaders = ctx.nativeMethods.getOwnPropertyDescriptor(this.resProto, 'headers'); + }; + override() { + this.overrideRequest(); + this.overrideUrl(); + this.overrideHeaders(); + return true; + }; + overrideRequest() { + if (!this.fetch) return false; + + this.ctx.override(this.window, 'fetch', (target, that, args) => { + if (!args.length || args[0] instanceof this.Request) return target.apply(that, args); + + let [ input, options = {} ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ input, options }, target, that); + + this.emit('request', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.input, event.data.options); + }); + + this.ctx.override(this.window, 'Request', (target, that, args) => { + if (!args.length) return new target(...args); + + let [ input, options = {} ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ input, options }, target); + + this.emit('request', event); + if (event.intercepted) return event.returnValue; + + return new event.target(event.data.input, event.data.options); + }, true); + return true; + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.reqProto, 'url', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + + this.emit('requestUrl', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.resProto, 'url', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + + this.emit('responseUrl', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + return true; + }; + overrideHeaders() { + if (!this.Headers) return false; + + this.ctx.overrideDescriptor(this.reqProto, 'headers', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + + this.emit('requestHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.resProto, 'headers', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + + this.emit('responseHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }, + }); + + this.ctx.override(this.headersProto, 'get', (target, that, [ name ]) => { + if (!name) return target.call(that); + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value: target.call(that, name) }, target, that); + + this.emit('getHeader', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + + this.ctx.override(this.headersProto, 'set', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value }, target, that); + + this.emit('setHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + + this.ctx.override(this.headersProto, 'has', (target, that, args) => { + if (!args.length) return target.call(that); + let [ name ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value: target.call(that, name) }, target, that); + + this.emit('hasHeader', event); + if (event.intercepted) return event.returnValue; + + return event.data; + }); + + this.ctx.override(this.headersProto, 'append', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value }, target, that); + + this.emit('appendHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + + this.ctx.override(this.headersProto, 'delete', (target, that, args) => { + if (!args.length) return target.apply(that, args); + + let [ name ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name }, target, that); + + this.emit('deleteHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name); + }); + + return true; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Fetch); + +/***/ }), +/* 43 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class FunctionHook extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Function = this.window.Function; + this.fnProto = this.Function.prototype; + this.toString = this.fnProto.toString; + this.fnStrings = ctx.fnStrings; + this.call = this.fnProto.call; + this.apply = this.fnProto.apply; + this.bind = this.fnProto.bind; + }; + overrideFunction() { + this.ctx.override(this.window, 'Function', (target, that, args) => { + if (!args.length) return target.apply(that, args); + + let script = args[args.length - 1]; + let fnArgs = []; + + for (let i = 0; i < args.length - 1; i++) { + fnArgs.push(args[i]); + }; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ script, args: fnArgs }, target, that); + this.emit('function', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, ...event.data.args, event.data.script); + }, true); + }; + overrideToString() { + this.ctx.override(this.fnProto, 'toString', (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ fn: that }, target, that); + this.emit('toString', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.data.fn); + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FunctionHook); + +/***/ }), +/* 44 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class History extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.History = this.window.History; + this.history = this.window.history; + this.historyProto = this.History ? this.History.prototype : {}; + this.pushState = this.historyProto.pushState; + this.replaceState = this.historyProto.replaceState; + this.go = this.historyProto.go; + this.back = this.historyProto.back; + this.forward = this.historyProto.forward; + }; + override() { + this.overridePushState(); + this.overrideReplaceState(); + this.overrideGo(); + this.overrideForward(); + this.overrideBack(); + }; + overridePushState() { + this.ctx.override(this.historyProto, 'pushState', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ state, title, url = '' ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ state, title, url }, target, that); + this.emit('pushState', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.state, event.data.title, event.data.url); + }); + }; + overrideReplaceState() { + this.ctx.override(this.historyProto, 'replaceState', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + let [ state, title, url = '' ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ state, title, url }, target, that); + this.emit('replaceState', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.state, event.data.title, event.data.url); + }); + }; + overrideGo() { + this.ctx.override(this.historyProto, 'go', (target, that, [ delta ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ delta }, target, that); + this.emit('go', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.delta); + }); + }; + overrideForward() { + this.ctx.override(this.historyProto, 'forward', (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"](null, target, that); + this.emit('forward', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that); + }); + }; + overrideBack() { + this.ctx.override(this.historyProto, 'back', (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"](null, target, that); + this.emit('back', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that); + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (History); + +/***/ }), +/* 45 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class Xhr extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.XMLHttpRequest = this.window.XMLHttpRequest; + this.xhrProto = this.window.XMLHttpRequest ? this.window.XMLHttpRequest.prototype : {}; + this.open = this.xhrProto.open; + this.abort = this.xhrProto.abort; + this.send = this.xhrProto.send; + this.overrideMimeType = this.xhrProto.overrideMimeType + this.getAllResponseHeaders = this.xhrProto.getAllResponseHeaders; + this.getResponseHeader = this.xhrProto.getResponseHeader; + this.setRequestHeader = this.xhrProto.setRequestHeader; + this.responseURL = ctx.nativeMethods.getOwnPropertyDescriptor(this.xhrProto, 'responseURL'); + this.responseText = ctx.nativeMethods.getOwnPropertyDescriptor(this.xhrProto, 'responseText'); + }; + override() { + this.overrideOpen(); + this.overrideSend(); + this.overrideMimeType(); + this.overrideGetResHeader(); + this.overrideGetResHeaders(); + this.overrideSetReqHeader(); + }; + overrideOpen() { + this.ctx.override(this.xhrProto, 'open', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ method, input, async = true, user = null, password = null ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ method, input, async, user, password }, target, that); + + this.emit('open', event); + if (event.intercepted) return event.returnValue; + + return event.target.call( + event.that, + event.data.method, + event.data.input, + event.data.async, + event.data.user, + event.data.password + ); + }); + }; + overrideResponseUrl() { + this.ctx.overrideDescriptor(this.xhrProto, 'responseURL', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('responseUrl', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + }; + overrideSend() { + this.ctx.override(this.xhrProto, 'send', (target, that, [ body = null ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ body }, target, that); + + this.emit('send', event); + if (event.intercepted) return event.returnValue; + + return event.target.call( + event.that, + event.data.body, + ); + }); + }; + overrideSetReqHeader() { + this.ctx.override(this.xhrProto, 'setRequestHeader', (target, that, args) => { + if (2 > args.length) return target.apply(that, args); + + let [ name, value ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value }, target, that); + + this.emit('setReqHeader', event); + if (event.intercepted) return event.returnValue; + + return event.target.call(event.that, event.data.name, event.data.value); + }); + }; + overrideGetResHeaders() { + this.ctx.override(this.xhrProto, 'getAllResponseHeaders', (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + + this.emit('getAllResponseHeaders', event); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + }; + overrideGetResHeader() { + this.ctx.override(this.xhrProto, 'getResponseHeader', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ name ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name, value: target.call(that, name) }, target, that); + if (event.intercepted) return event.returnValue; + + return event.data.value; + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Xhr); + +/***/ }), +/* 46 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +class LocationInherit { + constructor() { + this[Symbol.toStringTag] = 'Location'; + }; +}; + +class LocationApi extends LocationInherit { + #ctx + #window + #location + #getHref + #sourceUrl + #rewriteUrl + constructor(ctx, sourceUrl, rewriteUrl, worker = false) { + super(); + this.#window = ctx.window; + this.#location = this.#window.location; + this.#getHref = ctx.nativeMethods.getOwnPropertyDescriptor(this.#location, 'href'); + this.#ctx = ctx; + this.#sourceUrl = sourceUrl; + this.#rewriteUrl = rewriteUrl; + this.constructor = LocationInherit; + + if (!worker) { + ctx.fnStrings.set(this.assign, this.#window.location.assign.toString()); + ctx.fnStrings.set(this.replace, this.#window.location.replace.toString()); + ctx.fnStrings.set(this.reload, this.#window.location.reload.toString()) + }; + ctx.fnStrings.set(this.toString, this.#window.location.toString.toString()); + + for (const key of ['href', 'protocol', 'host', 'hostname', 'port', 'pathname', 'search', 'hash', 'origin']) { + ctx.nativeMethods.defineProperty(this, key, { + enumerable: true, + configurable: false, + get: () => { + const val = new URL(this.#sourceUrl(this.#location.href))[key]; + return val; + }, + set: (!worker && key !== 'origin') ? val => { + if (key === 'href') { + this.#location.href = this.#rewriteUrl(val); + } else if (key === 'hash') { + this.#location.hash = val; + } else { + const url = ctx.meta.url; + url[key] = val; + this.#location.href = this.#rewriteUrl(url); + }; + } : undefined, + }); + }; + }; + assign() { + let [ url ] = arguments; + const that = this instanceof LocationApi ? this.#window.location : this; + if (!url || that !== this.#window.location) return this.#window.location.assign.apply(that, arguments); + url = this.#rewriteUrl(url); + return this.#window.location.assign.call(that, url); + }; + replace() { + let [ url ] = arguments; + const that = this instanceof LocationApi ? this.#window.location : this; + if (!url || that !== this.#window.location) return this.#window.location.replace.apply(that, arguments); + url = this.#rewriteUrl(url); + return this.#window.location.replace.call(that, url); + }; + reload() { + const that = this instanceof LocationApi ? this.#window.location : this; + if (that !== this.#window.location) return this.#window.location.replace.apply(that, arguments); + return this.#window.location.reload.call(that); + }; + get [Symbol.toPrimitive]() { + return this.toString; + }; + toString() { + return this.href; + }; +}; + +LocationApi.LocationInherit = LocationInherit; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LocationApi); + +/***/ }), +/* 47 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class MessageApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.postMessage = this.window.postMessage; + this.MessageEvent = this.window.MessageEvent || {}; + this.MessagePort = this.window.MessagePort || {}; + this.mpProto = this.MessagePort.prototype || {}; + this.mpPostMessage = this.mpProto.postMessage; + this.messageProto = this.MessageEvent.prototype || {}; + this.messageData = ctx.nativeMethods.getOwnPropertyDescriptor(this.messageProto, 'data'); + this.messageOrigin = ctx.nativeMethods.getOwnPropertyDescriptor(this.messageProto, 'origin'); + }; + overridePostMessage() { + this.ctx.override(this.window, 'postMessage', (target, that, args) => { + if (this.ctx.worker ? !args.length : 2 > args) return target.apply(that, args); + + let message; + let origin; + let transfer; + + if (!this.ctx.worker) { + [ message, origin, transfer = [] ] = args; + } else { + [ message, transfer = [] ] = args; + }; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ message, origin, transfer, worker: this.ctx.worker }, target, that); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return this.ctx.worker ? event.target.call(event.that, event.data.message, event.data.transfer) : event.target.call(event.that, event.data.message, event.data.origin, event.data.transfer); + }); + + this.ctx.override(this.mpProto, 'postMessage', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ message, transfer = [] ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ message, origin: null, transfer, worker: this.ctx.worker }, target, that); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.message, event.data.transfer); + }); + }; + wrapPostMessage(obj, prop, noOrigin = false) { + return this.ctx.wrap(obj, prop, (target, that, args) => { + if (this.ctx.worker ? !args.length : 2 > args) return target.apply(that, args); + let message; + let origin; + let transfer; + + if (!noOrigin) { + [ message, origin, transfer = [] ] = args; + } else { + [ message, transfer = [] ] = args; + origin = null; + }; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ message, origin, transfer, worker: this.ctx.worker }, target, obj); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return noOrigin ? event.target.call(event.that, event.data.message, event.data.transfer) : event.target.call(event.that, event.data.message, event.data.origin, event.data.transfer); + }); + }; + overrideMessageOrigin() { + this.ctx.overrideDescriptor(this.messageProto, 'origin', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('origin', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + } + }); + }; + overrideMessageData() { + this.ctx.overrideDescriptor(this.messageProto, 'data', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('data', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + } + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MessageApi); + +/***/ }), +/* 48 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class NavigatorApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.navigator = this.window.navigator; + this.Navigator = this.window.Navigator || {}; + this.navProto = this.Navigator.prototype || {}; + this.sendBeacon = this.navProto.sendBeacon; + }; + overrideSendBeacon() { + this.ctx.override(this.navProto, 'sendBeacon', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url, data = '' ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url, data }, target, that); + this.emit('sendBeacon', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url, event.data.data); + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NavigatorApi); + +/***/ }), +/* 49 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class Workers extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Worker = this.window.Worker || {}; + this.Worklet = this.window.Worklet || {}; + this.workletProto = this.Worklet.prototype || {}; + this.workerProto = this.Worker.prototype || {}; + this.postMessage = this.workerProto.postMessage; + this.terminate = this.workerProto.terminate; + this.addModule = this.workletProto.addModule; + }; + overrideWorker() { + this.ctx.override(this.window, 'Worker', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, options = {} ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url, options }, target, that); + this.emit('worker', event); + + if (event.intercepted) return event.returnValue; + return new event.target(...[ event.data.url, event.data.options ]); + }, true); + }; + overrideAddModule() { + this.ctx.override(this.workletProto, 'addModule', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url, options = {} ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url, options }, target, that); + this.emit('addModule', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url, event.data.options); + }); + }; + overridePostMessage() { + this.ctx.override(this.workerProto, 'postMessage', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ message, transfer = [] ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ message, transfer }, target, that); + this.emit('postMessage', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.message, event.data.transfer); + }); + }; + overrideImportScripts() { + this.ctx.override(this.window, 'importScripts', (target, that, scripts) => { + if (!scripts.length) return target.apply(that, scripts); + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ scripts }, target, that); + this.emit('importScripts', event); + + if (event.intercepted) return event.returnValue; + return event.target.apply(event.that, event.data.scripts); + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Workers); + +/***/ }), +/* 50 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class URLApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = this.ctx.window; + this.URL = this.window.URL || {}; + this.createObjectURL = this.URL.createObjectURL; + this.revokeObjectURL = this.URL.revokeObjectURL; + }; + overrideObjectURL() { + this.ctx.override(this.URL, 'createObjectURL', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ object ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ object }, target, that); + this.emit('createObjectURL', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.object); + }); + this.ctx.override(this.URL, 'revokeObjectURL', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ url ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url }, target, that); + this.emit('revokeObjectURL', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.url); + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (URLApi); + +/***/ }), +/* 51 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class EventSourceApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.EventSource = this.window.EventSource || {}; + this.esProto = this.EventSource.prototype || {}; + this.url = ctx.nativeMethods.getOwnPropertyDescriptor(this.esProto, 'url'); + }; + overrideConstruct() { + this.ctx.override(this.window, 'EventSource', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, config = {} ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url, config }, target, that); + this.emit('construct', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url, event.data.config); + }, true); + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.esProto, 'url', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('url', event); + return event.data.value; + }, + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventSourceApi); + +/***/ }), +/* 52 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class NodeApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Node = ctx.window.Node || {}; + this.nodeProto = this.Node.prototype || {}; + this.compareDocumentPosition = this.nodeProto.compareDocumentPosition; + this.contains = this.nodeProto.contains; + this.insertBefore = this.nodeProto.insertBefore; + this.replaceChild = this.nodeProto.replaceChild; + this.append = this.nodeProto.append; + this.appendChild = this.nodeProto.appendChild; + this.removeChild = this.nodeProto.removeChild; + + this.textContent = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'textContent'); + this.parentNode = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'parentNode'); + this.parentElement = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'parentElement'); + this.childNodes = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'childNodes'); + this.baseURI = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'baseURI'); + this.previousSibling = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'previousSibling'); + this.ownerDocument = ctx.nativeMethods.getOwnPropertyDescriptor(this.nodeProto, 'ownerDocument'); + }; + overrideTextContent() { + this.ctx.overrideDescriptor(this.nodeProto, 'textContent', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('getTextContent', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: val }, target, that); + this.emit('setTextContent', event); + + if (event.intercepted) return event.returnValue; + target.call(that, event.data.value); + }, + }); + }; + overrideAppend() { + this.ctx.override(this.nodeProto, 'append', (target, that, [ ...nodes ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ nodes }, target, that); + this.emit('append', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.nodes); + }); + this.ctx.override(this.nodeProto, 'appendChild', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ node ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ node }, target, that); + this.emit('appendChild', event); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.node); + }); + }; + overrideBaseURI() { + this.ctx.overrideDescriptor(this.nodeProto, 'baseURI', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('baseURI', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }) + }; + overrideParent() { + this.ctx.overrideDescriptor(this.nodeProto, 'parentNode', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ node: target.call(that) }, target, that); + this.emit('parentNode', event); + + if (event.intercepted) return event.returnValue; + return event.data.node; + }, + }); + this.ctx.overrideDescriptor(this.nodeProto, 'parentElement', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ element: target.call(that) }, target, that); + this.emit('parentElement', event); + + if (event.intercepted) return event.returnValue; + return event.data.node; + }, + }); + }; + overrideOwnerDocument() { + this.ctx.overrideDescriptor(this.nodeProto, 'ownerDocument', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ document: target.call(that) }, target, that); + this.emit('ownerDocument', event); + + if (event.intercepted) return event.returnValue; + return event.data.document; + }, + }); + }; + overrideCompareDocumentPosit1ion() { + this.ctx.override(this.nodeProto, 'compareDocumentPosition', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ node ] = args; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ node }, target, that); + + if (event.intercepted) return event.returnValue; + return event.target.call(event.that, event.data.node); + }); + }; + overrideChildMethods() { + this.ctx.override(this.nodeProto, 'removeChild') + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NodeApi); + +/***/ }), +/* 53 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class WebSocketApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.WebSocket = this.window.WebSocket || {}; + this.wsProto = this.WebSocket.prototype || {}; + this.url = ctx.nativeMethods.getOwnPropertyDescriptor(this.wsProto, 'url'); + this.protocol = ctx.nativeMethods.getOwnPropertyDescriptor(this.wsProto, 'protocol'); + this.send = this.wsProto.send; + this.close = this.wsProto.close; + }; + overrideWebSocket() { + this.ctx.override(this.window, 'WebSocket', (target, that, args) => { + if (!args.length) return new target(...args); + let [ url, protocols = [] ] = args; + + if (!this.ctx.nativeMethods.isArray(protocols)) protocols = [ protocols ]; + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ url, protocols }, target, that); + this.emit('websocket', event); + + if (event.intercepted) return event.returnValue; + return new event.target(event.data.url, event.data.protocols); + }, true); + }; + overrideUrl() { + this.ctx.overrideDescriptor(this.wsProto, 'url', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('url', event); + return event.data.value; + }, + }); + }; + overrideProtocol() { + this.ctx.overrideDescriptor(this.wsProto, 'protocol', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('protocol', event); + return event.data.value; + }, + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WebSocketApi); + +/***/ }), +/* 54 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class AttrApi extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Attr = this.window.Attr || {}; + this.attrProto = this.Attr.prototype || {}; + this.value = ctx.nativeMethods.getOwnPropertyDescriptor(this.attrProto, 'value'); + this.name = ctx.nativeMethods.getOwnPropertyDescriptor(this.attrProto, 'name'); + }; + override() { + this.ctx.overrideDescriptor(this.attrProto, 'name', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ value: target.call(that) }, target, that); + this.emit('name', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + }); + + this.ctx.overrideDescriptor(this.attrProto, 'value', { + get: (target, that) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name: this.name.get.call(that), value: target.call(that) }, target, that); + this.emit('getValue', event); + + if (event.intercepted) return event.returnValue; + return event.data.value; + }, + set: (target, that, [ val ]) => { + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ name: this.name.get.call(that), value: val }, target, that); + this.emit('setValue', event); + + if (event.intercepted) return event.returnValue; + event.target.call(event.that, event.data.value); + } + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AttrApi); + +/***/ }), +/* 55 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39); +/* harmony import */ var _hook_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); + + + +class ObjectHook extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.window = ctx.window; + this.Object = this.window.Object; + this.getOwnPropertyDescriptors = this.Object.getOwnPropertyDescriptors; + this.getOwnPropertyDescriptor = this.Object.getOwnPropertyDescriptor; + this.getOwnPropertyNames = this.Object.getOwnPropertyNames; + }; + overrideGetPropertyNames() { + this.ctx.override(this.Object, 'getOwnPropertyNames', (target, that, args) => { + if (!args.length) return target.apply(that, args); + let [ object ] = args; + + const event = new _hook_js__WEBPACK_IMPORTED_MODULE_1__["default"]({ names: target.call(that, object) }, target, that); + this.emit('getOwnPropertyNames', event); + + if (event.intercepted) return event.returnValue; + return event.data.names; + }); + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ObjectHook); + +/***/ }), +/* 56 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "validateCookie": () => (/* binding */ validateCookie), +/* harmony export */ "getCookies": () => (/* binding */ getCookies), +/* harmony export */ "setCookies": () => (/* binding */ setCookies), +/* harmony export */ "db": () => (/* binding */ db), +/* harmony export */ "serialize": () => (/* binding */ serialize) +/* harmony export */ }); +/* harmony import */ var set_cookie_parser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); +// ------------------------------------------------------------- +// WARNING: this file is used by both the client and the server. +// Do not use any browser or node-specific API! +// ------------------------------------------------------------- + + +function validateCookie(cookie, meta, js = false) { + if (cookie.httpOnly && !!js) return false; + + if (cookie.domain.startsWith('.')) { + + if (!meta.url.hostname.endsWith(cookie.domain.slice(1))) return false; + //if (!cookie.domain.endsWith(meta.url.hostname)) return false; + + return true; + }; + + if (cookie.domain !== meta.url.hostname) return false; + if (cookie.secure && meta.url.protocol === 'http:') return false; + if (!meta.url.pathname.startsWith(cookie.path)) return false; + + return true; +}; + +async function db(openDB) { + const db = await openDB('__op', 1, { + upgrade(db, oldVersion, newVersion, transaction) { + const store = db.createObjectStore('cookies', { + keyPath: 'id', + }); + store.createIndex('path', 'path'); + }, + }); + db.transaction(['cookies'], 'readwrite').store.index('path'); + return db; +}; + +/* +async function getCookies(cookies, meta, js = false) { + let cookieStr = ''; + cookies = await cookies; + for (const cookie of cookies) { + + if (!validateCookie(cookie, meta, js)) continue; + + if (cookieStr.length) cookieStr += '; '; + cookieStr += cookie.name; + cookieStr += '=' + cookieStr += cookie.value; + }; + return cookieStr; +}; +*/ + +function serialize(cookies = [], meta, js) { + let str = ''; + for (const cookie of cookies) { + if (!validateCookie(cookie, meta, js)) continue; + if (str.length) str += '; '; + str += cookie.name; + str += '=' + str += cookie.value; + }; + return str; +}; + +async function getCookies(db) { + return await db.getAll('cookies'); +}; + +function setCookies(data, db, meta) { + if (!db) return false; + const cookies = set_cookie_parser__WEBPACK_IMPORTED_MODULE_0__(data, { + decodeValues: false, + }) + + for (const cookie of cookies) { + if (!cookie.domain) cookie.domain = '.' + meta.url.hostname; + if (!cookie.path) cookie.path = '/'; + + if (!cookie.domain.startsWith('.')) { + cookie.domain = '.' + cookie.domain; + }; + + db.put('cookies', { + ...cookie, + id: `${cookie.domain}@${cookie.path}@${cookie.name}`, + }); + }; + return true; +}; + + + +/***/ }), +/* 57 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "attributes": () => (/* binding */ attributes), +/* harmony export */ "text": () => (/* binding */ text), +/* harmony export */ "isUrl": () => (/* binding */ isUrl), +/* harmony export */ "isEvent": () => (/* binding */ isEvent), +/* harmony export */ "isForbidden": () => (/* binding */ isForbidden), +/* harmony export */ "isHtml": () => (/* binding */ isHtml), +/* harmony export */ "isStyle": () => (/* binding */ isStyle), +/* harmony export */ "isSrcset": () => (/* binding */ isSrcset) +/* harmony export */ }); +function attributes(ctx, meta = ctx.meta) { + const { html, js, css, attributePrefix } = ctx; + const origPrefix = attributePrefix + '-attr-'; + + html.on('attr', (attr, type) => { + if (attr.node.tagName === 'base' && attr.name === 'href' && attr.options.document) { + meta.base = new URL(attr.value, meta.url); + }; + + if (type === 'rewrite' && isUrl(attr.name, attr.tagName)) { + attr.node.setAttribute(origPrefix + attr.name, attr.value); + attr.value = ctx.rewriteUrl(attr.value, meta); + }; + + if (type === 'rewrite' && isSrcset(attr.name)) { + attr.node.setAttribute(origPrefix + attr.name, attr.value); + attr.value = html.wrapSrcset(attr.value, meta); + }; + + + if (type === 'rewrite' && isHtml(attr.name)) { + attr.node.setAttribute(origPrefix + attr.name, attr.value); + attr.value = html.rewrite(attr.value, { ...meta, document: true }); + }; + + + if (type === 'rewrite' && isStyle(attr.name)) { + attr.node.setAttribute(origPrefix + attr.name, attr.value); + attr.value = ctx.rewriteCSS(attr.value); + }; + + if (type === 'rewrite' && isForbidden(attr.name)) { + attr.name = origPrefix + attr.name; + }; + + if (type === 'rewrite' && isEvent(attr.name)) { + attr.node.setAttribute(origPrefix + attr.name, attr.value); + attr.value = js.rewrite(attr.value, meta); + }; + + if (type === 'source' && attr.name.startsWith(origPrefix)) { + if (attr.node.hasAttribute(attr.name.slice(origPrefix.length))) attr.node.removeAttribute(attr.name.slice(origPrefix.length)); + attr.name = attr.name.slice(origPrefix.length); + }; + + + /* + if (isHtml(attr.name)) { + + }; + + if (isStyle(attr.name)) { + + }; + + if (isSrcset(attr.name)) { + + }; + */ + }); + +}; + + +function text(ctx, meta = ctx.meta) { + const { html, js, css, attributePrefix } = ctx; + + html.on('text', (text, type) => { + if (text.element.tagName === 'script') { + text.value = type === 'rewrite' ? js.rewrite(text.value) : js.source(text.value); + }; + + if (text.element.tagName === 'style' && type === 'rewrite') { + text.value = css.rewrite(text.value); + }; + }); + return true; +}; + +function isUrl(name, tag) { + return tag === 'object' && name === 'data' || ['src', 'href', 'ping', 'movie', 'action', 'poster', 'profile', 'background'].indexOf(name) > -1; +}; +function isEvent(name) { + return [ + 'onafterprint', + 'onbeforeprint', + 'onbeforeunload', + 'onerror', + 'onhashchange', + 'onload', + 'onmessage', + 'onoffline', + 'ononline', + 'onpagehide', + 'onpopstate', + 'onstorage', + 'onunload', + 'onblur', + 'onchange', + 'oncontextmenu', + 'onfocus', + 'oninput', + 'oninvalid', + 'onreset', + 'onsearch', + 'onselect', + 'onsubmit', + 'onkeydown', + 'onkeypress', + 'onkeyup', + 'onclick', + 'ondblclick', + 'onmousedown', + 'onmousemove', + 'onmouseout', + 'onmouseover', + 'onmouseup', + 'onmousewheel', + 'onwheel', + 'ondrag', + 'ondragend', + 'ondragenter', + 'ondragleave', + 'ondragover', + 'ondragstart', + 'ondrop', + 'onscroll', + 'oncopy', + 'oncut', + 'onpaste', + 'onabort', + 'oncanplay', + 'oncanplaythrough', + 'oncuechange', + 'ondurationchange', + 'onemptied', + 'onended', + 'onerror', + 'onloadeddata', + 'onloadedmetadata', + 'onloadstart', + 'onpause', + 'onplay', + 'onplaying', + 'onprogress', + 'onratechange', + 'onseeked', + 'onseeking', + 'onstalled', + 'onsuspend', + 'ontimeupdate', + 'onvolumechange', + 'onwaiting', + ].indexOf(name) > -1; +}; + +function isForbidden(name) { + return ['http-equiv', 'integrity', 'sandbox', 'nonce', 'crossorigin'].indexOf(name) > -1; +}; + +function isHtml(name){ + return name === 'srcdoc'; +}; + +function isStyle(name) { + return name === 'style'; +}; + +function isSrcset(name) { + return name === 'srcset' || name === 'imagesrcset'; +}; + + + + +/***/ }), +/* 58 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "url": () => (/* binding */ url) +/* harmony export */ }); +function url(ctx, meta = ctx.meta) { + const { css } = ctx; + + css.on('url', event => { + event.value = ctx.rewriteUrl(event.value, meta); + }); +}; + + + +/***/ }), +/* 59 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "property": () => (/* binding */ property), +/* harmony export */ "wrapEval": () => (/* binding */ wrapEval), +/* harmony export */ "dynamicImport": () => (/* binding */ dynamicImport), +/* harmony export */ "importDeclaration": () => (/* binding */ importDeclaration), +/* harmony export */ "identifier": () => (/* binding */ identifier), +/* harmony export */ "unwrap": () => (/* binding */ unwrap) +/* harmony export */ }); +/* harmony import */ var esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); + + +function property(ctx) { + const { js } = ctx; + js.on('MemberExpression', (node, data, type) => { + if (node.object.type === 'Super') return false; + + if (type === 'rewrite' && computedProperty(node)) { + data.changes.push({ + node: '__op.$wrap((', + start: node.property.start, + end: node.property.start, + }) + node.iterateEnd = function() { + data.changes.push({ + node: '))', + start: node.property.end, + end: node.property.end, + }); + }; + + }; + + if (!node.computed && node.property.name === 'location' && type === 'rewrite' || node.property.name === '__opLocation' && type === 'source') { + data.changes.push({ + start: node.property.start, + end: node.property.end, + node: type === 'rewrite' ? '__opLocation' : 'location' + }); + }; + + if (node.object.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.Identifier && node.object.name === 'eval') { + + }; + + + if (!node.computed && node.property.name === 'postMessage' && type === 'rewrite' || node.property.name === '__opPostMessage' && type === 'source') { + data.changes.push({ + start: node.property.start, + end: node.property.end, + node: type === 'rewrite' ? '__opSetSource(__op).__opPostMessage' : 'postMessage' + }); + }; + + + if (!node.computed && node.property.name === 'eval' && type === 'rewrite' || node.property.name === '__opEval' && type === 'source') { + data.changes.push({ + start: node.property.start, + end: node.property.end, + node: type === 'rewrite' ? '__opEval' : 'eval' + }); + }; + + if (!node.computed && node.property.name === '__opSetSource' && type === 'source' && node.parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.CallExpression) { + const { parent, property } = node; + data.changes.push({ + start: property.start - 1, + end: parent.end, + }); + + node.iterateEnd = function() { + data.changes.push({ + start: property.start, + end: parent.end, + }); + }; + }; + }); +}; + +function identifier(ctx) { + const { js } = ctx; + js.on('Identifier', (node, data, type) => { + if (type !== 'rewrite') return false; + const { parent } = node; + if (!['location', 'eval'].includes(node.name)) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.VariableDeclarator && parent.id === node) return false; + if ((parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.AssignmentExpression || parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.AssignmentPattern) && parent.left === node) return false; + if ((parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.FunctionExpression || parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.FunctionDeclaration) && parent.id === node) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.MemberExpression && parent.property === node && !parent.computed) return false; + if (node.name === 'eval' && parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.CallExpression && parent.callee === node) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.Property && parent.key === node) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.Property && parent.value === node && parent.shorthand) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.UpdateExpression && (parent.operator === '++' || parent.operator === '--')) return false; + if ((parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.FunctionExpression || parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.FunctionDeclaration || parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ArrowFunctionExpression) && parent.params.indexOf(node) !== -1) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.MethodDefinition) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ClassDeclaration) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.RestElement) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ExportSpecifier) return false; + if (parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ImportSpecifier) return false; + + data.changes.push({ + start: node.start, + end: node.end, + node: '__op.$get(' + node.name + ')' + }); + }); +}; + +function wrapEval(ctx) { + const { js } = ctx; + js.on('CallExpression', (node, data, type) => { + if (type !== 'rewrite') return false; + if (!node.arguments.length) return false; + if (node.callee.type !== 'Identifier') return false; + if (node.callee.name !== 'eval') return false; + + const [ script ] = node.arguments; + + data.changes.push({ + node: '__op.js.rewrite(', + start: script.start, + end: script.start, + }) + node.iterateEnd = function() { + data.changes.push({ + node: ')', + start: script.end, + end: script.end, + }); + }; + }); +}; + +function importDeclaration(ctx) { + const { js } = ctx; + js.on(esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.Literal, (node, data, type) => { + if (!((node.parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ImportDeclaration || node.parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ExportAllDeclaration || node.parent.type === esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ExportNamedDeclaration) + && node.parent.source === node)) return false; + + data.changes.push({ + start: node.start + 1, + end: node.end - 1, + node: type === 'rewrite' ? ctx.rewriteUrl(node.value) : ctx.sourceUrl(node.value) + }); + }); +}; + +function dynamicImport(ctx) { + const { js } = ctx; + js.on(esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.ImportExpression, (node, data, type) => { + if (type !== 'rewrite') return false; + data.changes.push({ + node: '__op.rewriteUrl(', + start: node.source.start, + end: node.source.start, + }) + node.iterateEnd = function() { + data.changes.push({ + node: ')', + start: node.source.end, + end: node.source.end, + }); + }; + }); +}; + +function unwrap(ctx) { + const { js } = ctx; + js.on('CallExpression', (node, data, type) => { + if (type !== 'source') return false; + if (!isWrapped(node.callee)) return false; + + switch(node.callee.property.name) { + case '$wrap': + if (!node.arguments || node.parent.type !== esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.MemberExpression || node.parent.property !== node) return false; + const [ property ] = node.arguments; + + data.changes.push({ + start: node.callee.start, + end: property.start, + }); + + node.iterateEnd = function() { + data.changes.push({ + start: node.end - 2, + end: node.end, + }); + }; + break; + case '$get': + case 'rewriteUrl': + const [ arg ] = node.arguments; + + data.changes.push({ + start: node.callee.start, + end: arg.start, + }); + + node.iterateEnd = function() { + data.changes.push({ + start: node.end - 1, + end: node.end, + }); + }; + break; + case 'rewrite': + const [ script ] = node.arguments; + data.changes.push({ + start: node.callee.start, + end: script.start, + }); + node.iterateEnd = function() { + data.changes.push({ + start: node.end - 1, + end: node.end, + }); + }; + }; + + }); +}; + +function isWrapped(node) { + if (node.type !== esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.MemberExpression) return false; + if (node.property.name === 'rewrite' && isWrapped(node.object)) return true; + if (node.object.type !== esotope_hammerhead__WEBPACK_IMPORTED_MODULE_0__.Syntax.Identifier || node.object.name !== '__op') return false; + if (!['js', '$get', '$wrap', 'rewriteUrl'].includes(node.property.name)) return false; + return true; +}; + +function computedProperty(parent) { + if (!parent.computed) return false; + const { property: node } = parent; + if (node.type === 'Literal' && node.value !== 'location') return false; + return true; +}; + + + + +/***/ }), +/* 60 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "unwrap": () => (/* reexport safe */ _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.u), +/* harmony export */ "wrap": () => (/* reexport safe */ _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w), +/* harmony export */ "deleteDB": () => (/* binding */ deleteDB), +/* harmony export */ "openDB": () => (/* binding */ openDB) +/* harmony export */ }); +/* harmony import */ var _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61); + + + +/** + * Open a database. + * + * @param name Name of the database. + * @param version Schema version. + * @param callbacks Additional callbacks. + */ +function openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) { + const request = indexedDB.open(name, version); + const openPromise = (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request); + if (upgrade) { + request.addEventListener('upgradeneeded', (event) => { + upgrade((0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request.result), event.oldVersion, event.newVersion, (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request.transaction)); + }); + } + if (blocked) + request.addEventListener('blocked', () => blocked()); + openPromise + .then((db) => { + if (terminated) + db.addEventListener('close', () => terminated()); + if (blocking) + db.addEventListener('versionchange', () => blocking()); + }) + .catch(() => { }); + return openPromise; +} +/** + * Delete a database. + * + * @param name Name of the database. + */ +function deleteDB(name, { blocked } = {}) { + const request = indexedDB.deleteDatabase(name); + if (blocked) + request.addEventListener('blocked', () => blocked()); + return (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request).then(() => undefined); +} + +const readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count']; +const writeMethods = ['put', 'add', 'delete', 'clear']; +const cachedMethods = new Map(); +function getMethod(target, prop) { + if (!(target instanceof IDBDatabase && + !(prop in target) && + typeof prop === 'string')) { + return; + } + if (cachedMethods.get(prop)) + return cachedMethods.get(prop); + const targetFuncName = prop.replace(/FromIndex$/, ''); + const useIndex = prop !== targetFuncName; + const isWrite = writeMethods.includes(targetFuncName); + if ( + // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge. + !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || + !(isWrite || readMethods.includes(targetFuncName))) { + return; + } + const method = async function (storeName, ...args) { + // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :( + const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly'); + let target = tx.store; + if (useIndex) + target = target.index(args.shift()); + // Must reject if op rejects. + // If it's a write operation, must reject if tx.done rejects. + // Must reject with op rejection first. + // Must resolve with op value. + // Must handle both promises (no unhandled rejections) + return (await Promise.all([ + target[targetFuncName](...args), + isWrite && tx.done, + ]))[0]; + }; + cachedMethods.set(prop, method); + return method; +} +(0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.r)((oldTraps) => ({ + ...oldTraps, + get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver), + has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop), +})); + + + + +/***/ }), +/* 61 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "a": () => (/* binding */ reverseTransformCache), +/* harmony export */ "i": () => (/* binding */ instanceOfAny), +/* harmony export */ "r": () => (/* binding */ replaceTraps), +/* harmony export */ "u": () => (/* binding */ unwrap), +/* harmony export */ "w": () => (/* binding */ wrap) +/* harmony export */ }); +const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c); + +let idbProxyableTypes; +let cursorAdvanceMethods; +// This is a function to prevent it throwing up in node environments. +function getIdbProxyableTypes() { + return (idbProxyableTypes || + (idbProxyableTypes = [ + IDBDatabase, + IDBObjectStore, + IDBIndex, + IDBCursor, + IDBTransaction, + ])); +} +// This is a function to prevent it throwing up in node environments. +function getCursorAdvanceMethods() { + return (cursorAdvanceMethods || + (cursorAdvanceMethods = [ + IDBCursor.prototype.advance, + IDBCursor.prototype.continue, + IDBCursor.prototype.continuePrimaryKey, + ])); +} +const cursorRequestMap = new WeakMap(); +const transactionDoneMap = new WeakMap(); +const transactionStoreNamesMap = new WeakMap(); +const transformCache = new WeakMap(); +const reverseTransformCache = new WeakMap(); +function promisifyRequest(request) { + const promise = new Promise((resolve, reject) => { + const unlisten = () => { + request.removeEventListener('success', success); + request.removeEventListener('error', error); + }; + const success = () => { + resolve(wrap(request.result)); + unlisten(); + }; + const error = () => { + reject(request.error); + unlisten(); + }; + request.addEventListener('success', success); + request.addEventListener('error', error); + }); + promise + .then((value) => { + // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval + // (see wrapFunction). + if (value instanceof IDBCursor) { + cursorRequestMap.set(value, request); + } + // Catching to avoid "Uncaught Promise exceptions" + }) + .catch(() => { }); + // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This + // is because we create many promises from a single IDBRequest. + reverseTransformCache.set(promise, request); + return promise; +} +function cacheDonePromiseForTransaction(tx) { + // Early bail if we've already created a done promise for this transaction. + if (transactionDoneMap.has(tx)) + return; + const done = new Promise((resolve, reject) => { + const unlisten = () => { + tx.removeEventListener('complete', complete); + tx.removeEventListener('error', error); + tx.removeEventListener('abort', error); + }; + const complete = () => { + resolve(); + unlisten(); + }; + const error = () => { + reject(tx.error || new DOMException('AbortError', 'AbortError')); + unlisten(); + }; + tx.addEventListener('complete', complete); + tx.addEventListener('error', error); + tx.addEventListener('abort', error); + }); + // Cache it for later retrieval. + transactionDoneMap.set(tx, done); +} +let idbProxyTraps = { + get(target, prop, receiver) { + if (target instanceof IDBTransaction) { + // Special handling for transaction.done. + if (prop === 'done') + return transactionDoneMap.get(target); + // Polyfill for objectStoreNames because of Edge. + if (prop === 'objectStoreNames') { + return target.objectStoreNames || transactionStoreNamesMap.get(target); + } + // Make tx.store return the only store in the transaction, or undefined if there are many. + if (prop === 'store') { + return receiver.objectStoreNames[1] + ? undefined + : receiver.objectStore(receiver.objectStoreNames[0]); + } + } + // Else transform whatever we get back. + return wrap(target[prop]); + }, + set(target, prop, value) { + target[prop] = value; + return true; + }, + has(target, prop) { + if (target instanceof IDBTransaction && + (prop === 'done' || prop === 'store')) { + return true; + } + return prop in target; + }, +}; +function replaceTraps(callback) { + idbProxyTraps = callback(idbProxyTraps); +} +function wrapFunction(func) { + // Due to expected object equality (which is enforced by the caching in `wrap`), we + // only create one new func per func. + // Edge doesn't support objectStoreNames (booo), so we polyfill it here. + if (func === IDBDatabase.prototype.transaction && + !('objectStoreNames' in IDBTransaction.prototype)) { + return function (storeNames, ...args) { + const tx = func.call(unwrap(this), storeNames, ...args); + transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]); + return wrap(tx); + }; + } + // Cursor methods are special, as the behaviour is a little more different to standard IDB. In + // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the + // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense + // with real promises, so each advance methods returns a new promise for the cursor object, or + // undefined if the end of the cursor has been reached. + if (getCursorAdvanceMethods().includes(func)) { + return function (...args) { + // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use + // the original object. + func.apply(unwrap(this), args); + return wrap(cursorRequestMap.get(this)); + }; + } + return function (...args) { + // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use + // the original object. + return wrap(func.apply(unwrap(this), args)); + }; +} +function transformCachableValue(value) { + if (typeof value === 'function') + return wrapFunction(value); + // This doesn't return, it just creates a 'done' promise for the transaction, + // which is later returned for transaction.done (see idbObjectHandler). + if (value instanceof IDBTransaction) + cacheDonePromiseForTransaction(value); + if (instanceOfAny(value, getIdbProxyableTypes())) + return new Proxy(value, idbProxyTraps); + // Return the same value back if we're not going to transform it. + return value; +} +function wrap(value) { + // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because + // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached. + if (value instanceof IDBRequest) + return promisifyRequest(value); + // If we've already transformed this value before, reuse the transformed value. + // This is faster, but it also provides object equality. + if (transformCache.has(value)) + return transformCache.get(value); + const newValue = transformCachableValue(value); + // Not all types are transformed. + // These may be primitive types, so they can't be WeakMap keys. + if (newValue !== value) { + transformCache.set(value, newValue); + reverseTransformCache.set(newValue, value); + } + return newValue; +} +const unwrap = (value) => reverseTransformCache.get(value); + + + + +/***/ }) +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _html_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); +/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27); +/* harmony import */ var _js_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29); +/* harmony import */ var set_cookie_parser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(32); +/* harmony import */ var _codecs_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33); +/* harmony import */ var _mime_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(34); +/* harmony import */ var _Oxidation_js_lib_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(37); +/* harmony import */ var _cookie_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(56); +/* harmony import */ var _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(57); +/* harmony import */ var _rewrite_css_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(58); +/* harmony import */ var _rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(59); +/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(60); +/* harmony import */ var _parsel_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(28); + + + + + + + + + + + + + + +class Rewriter { + constructor(options = {}) { + this.prefix = options.prefix || '/service/'; + //this.urlRegex = /^(#|about:|data:|mailto:|javascript:)/; + this.urlRegex = /^(#|about:|data:|mailto:)/ + this.rewriteUrl = options.rewriteUrl || this.rewriteUrl; + this.sourceUrl = options.sourceUrl || this.sourceUrl; + this.encodeUrl = options.encodeUrl || this.encodeUrl; + this.decodeUrl = options.decodeUrl || this.decodeUrl; + this.meta = options.meta || {}; + this.meta.base ||= undefined; + this.meta.origin ||= ''; + this.meta.url ||= this.meta.base || ''; + this.codec = Rewriter.codec; + this.html = new _html_js__WEBPACK_IMPORTED_MODULE_0__["default"](this); + this.css = new _css_js__WEBPACK_IMPORTED_MODULE_1__["default"](this); + this.js = new _js_js__WEBPACK_IMPORTED_MODULE_2__["default"](this); + this.parsel = _parsel_js__WEBPACK_IMPORTED_MODULE_12__["default"]; + this.oxidation = typeof self !== 'undefined' ? new _Oxidation_js_lib_index_js__WEBPACK_IMPORTED_MODULE_6__["default"]((options.window || self)) : null; // Client-hooking + this.openDB = idb__WEBPACK_IMPORTED_MODULE_11__.openDB; // Wrapper for IndexedDB on the client + this.attributePrefix = '__op'; + this.attrs = { + isUrl: _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.isUrl, + isForbidden: _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.isForbidden, + isHtml: _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.isHtml, + isSrcset: _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.isSrcset, + isStyle: _rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.isStyle, + }; + this.cookie = { + validateCookie: _cookie_js__WEBPACK_IMPORTED_MODULE_7__.validateCookie, + db: () => { + return (0,_cookie_js__WEBPACK_IMPORTED_MODULE_7__.db)(Rewriter.openDB); + }, + getCookies: _cookie_js__WEBPACK_IMPORTED_MODULE_7__.getCookies, + setCookies: _cookie_js__WEBPACK_IMPORTED_MODULE_7__.setCookies, + serialize: _cookie_js__WEBPACK_IMPORTED_MODULE_7__.serialize, + setCookie: set_cookie_parser__WEBPACK_IMPORTED_MODULE_3__, + } + }; + rewriteUrl(str, meta = this.meta) { + str = new String(str).trim(); + if (!str || this.urlRegex.test(str)) return str; + + if (str.startsWith('javascript:')) { + console.log(str); + return 'javascript:' + this.js.rewrite(str.slice('javascript:'.length)); + }; + + try { + return meta.origin + this.prefix + this.encodeUrl(new URL(str, meta.base).href); + } catch(e) { + return meta.origin + this.prefix + this.encodeUrl(str); + }; + }; + sourceUrl(str, meta = this.meta) { + if (!str || this.urlRegex.test(str)) return str; + try { + return new URL( + this.decodeUrl(str.slice(this.prefix.length + meta.origin.length)), + meta.base + ).href; + } catch(e) { + return this.decodeUrl(str.slice(this.prefix.length + meta.origin.length)); + }; + }; + encodeUrl(str) { + return encodeURIComponent(str); + }; + decodeUrl(str) { + return decodeURIComponent(str); + }; + addRewrites() { + (0,_rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.attributes)(this); + (0,_rewrite_css_js__WEBPACK_IMPORTED_MODULE_9__.url)(this); + (0,_rewrite_html_js__WEBPACK_IMPORTED_MODULE_8__.text)(this); + // JS + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.importDeclaration)(this); + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.dynamicImport)(this); + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.property)(this); + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.wrapEval)(this); + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.identifier)(this); + (0,_rewrite_script_js__WEBPACK_IMPORTED_MODULE_10__.unwrap)(this); + }; + get rewriteHtml() { + return this.html.rewrite.bind(this.html); + }; + get sourceHtml() { + return this.html.source.bind(this.html); + }; + get rewriteCSS() { + return this.css.rewrite.bind(this.css); + }; + /* + get rewriteJS() { + return this.js.rewrite.bind(this.js); + }; + get sourceJS() { + return this.js.source.bind(this.js); + }; + */ + static codec = { xor: _codecs_js__WEBPACK_IMPORTED_MODULE_4__.xor, base64: _codecs_js__WEBPACK_IMPORTED_MODULE_4__.base64, plain: _codecs_js__WEBPACK_IMPORTED_MODULE_4__.plain }; + static mime = _mime_js__WEBPACK_IMPORTED_MODULE_5__["default"]; + static setCookie = set_cookie_parser__WEBPACK_IMPORTED_MODULE_3__; + static openDB = idb__WEBPACK_IMPORTED_MODULE_11__.openDB; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rewriter); +if (typeof self === 'object') self.Rewriter = Rewriter; +})(); + +/******/ })() +; \ No newline at end of file diff --git a/example/static/op.handler.js b/example/static/op.handler.js new file mode 100644 index 0000000..298fa54 --- /dev/null +++ b/example/static/op.handler.js @@ -0,0 +1,765 @@ +async function __opHook(window, worker = false) { + if ('__op' in window && window.__op instanceof Rewriter) return false; + + const __op = window.__op = new Rewriter({ + prefix: '/service/', + window + }); + + __op.loc = __op.oxidation.nativeMethods.getOwnPropertyDescriptor(window, 'location') + + // Website data + __op.meta.origin = location.origin; + + let urlStr = __op.sourceUrl(window.location.href); + if (urlStr.startsWith('blob:')) urlStr = urlStr.slice('blob:'.length); + if (urlStr.startsWith('about:')) urlStr = window.parent.__op.meta.url.href; + + __op.cookieStr = window.__opCookies || ''; + __op.meta.base = __op.meta.url = new URL(urlStr); + __op.domain = __op.meta.url.host; + __op.blobUrls = new window.Map(); + __op.referrer = ''; + __op.cookies = []; + __op.brazenKeys = [ + '__opLocation', + '__opSource', + '__opSetSource', + '__opPostMessage', + '__opEval', + '__opOriginalPM', + ]; + __op.sw = 'serviceWorker' in window.navigator ? window.navigator.serviceWorker.controller : false; + + if (window.__opCookies) delete window.__opCookies; + if (window.__opReferrer) { + __op.referrer = __op.sourceUrl(window.__opReferrer); + delete window.__opReferrer; + }; + + window.__opTemp = []; + + // Client-side hooking + const { oxidation: __oxidation } = __op; + + let rawBase = window.document ? __oxidation.node.baseURI.get.call(window.document) : window.location.href; + let base = __op.sourceUrl(rawBase); + __oxidation.initLocation(__op.rewriteUrl.bind(__op), __op.sourceUrl.bind(__op)); + + __oxidation.nativeMethods.defineProperty(__op.meta, 'base', { + get() { + if (!window.document) return __op.meta.url; + + if (__oxidation.node.baseURI.get.call(window.document) !== rawBase) { + rawBase = __oxidation.node.baseURI.get.call(window.document); + base = __op.sourceUrl(rawBase); + }; + + return base; + }, + }); + + const { + HTMLMediaElement, + HTMLScriptElement, + HTMLAudioElement, + HTMLVideoElement, + HTMLInputElement, + HTMLEmbedElement, + HTMLTrackElement, + HTMLAnchorElement, + HTMLIFrameElement, + HTMLAreaElement, + HTMLLinkElement, + HTMLBaseElement, + HTMLFormElement, + HTMLImageElement, + HTMLSourceElement, + } = window; + + // Fetch + __oxidation.fetch.on('request', event => { + event.data.input = __op.rewriteUrl(event.data.input); + }); + + __oxidation.fetch.on('requestUrl', event => { + event.data.value = __op.sourceUrl(event.data.value); + }); + + __oxidation.fetch.on('responseUrl', event => { + event.data.value = __op.sourceUrl(event.data.value); + }); + + // XMLHttpRequest + __oxidation.xhr.on('open', event => { + event.data.input = __op.rewriteUrl(event.data.input); + }); + + __oxidation.xhr.on('responseUrl', event => { + event.data.value = __op.sourceUrl(event.data.value); + }); + + // Workers + __oxidation.workers.on('worker', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + __oxidation.workers.on('addModule', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + __oxidation.workers.on('importScripts', event => { + for (const i in event.data.scripts) { + event.data.scripts[i] = __op.rewriteUrl(event.data.scripts[i]); + }; + }); + + __oxidation.workers.on('postMessage', event => { + let to = event.data.origin; + + event.data.origin = '*'; + event.data.message = { + __data: event.data.message, + __origin: __op.meta.url.origin, + __to: to, + }; + }); + + + + // Navigator + __oxidation.navigator.on('sendBeacon', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + // Cookies + __oxidation.document.on('getCookie', event => { + event.data.value = __op.cookieStr; + }); + + __oxidation.document.on('setCookie', event => { + Promise.resolve(__op.cookie.setCookies(event.data.value, __op.db, __op.meta)).then(() => { + __op.cookie.db().then(db => { + __op.cookie.getCookies(db).then(cookies => { + __op.cookieStr = __op.cookie.serialize(cookies, __op.meta, true); + }); + }); + }); + const cookie = __op.cookie.setCookie(event.data.value)[0]; + + if (!cookie.path) cookie.path = '/'; + if (!cookie.domain) cookie.domain = __op.meta.url.hostname; + + if (__op.cookie.validateCookie(cookie, __op.meta, true)) { + if (__op.cookieStr.length) __op.cookieStr += '; '; + __op.cookieStr += `${cookie.name}=${cookie.value}`; + }; + + event.respondWith(event.data.value); + }); + + // HTML + __oxidation.element.on('setInnerHTML', event => { + switch(event.that.tagName) { + case 'SCRIPT': + event.data.value = __op.js.rewrite(event.data.value); + break; + case 'STYLE': + event.data.value = __op.rewriteCSS(event.data.value); + break; + default: + event.data.value = __op.rewriteHtml(event.data.value); + }; + }); + + __oxidation.element.on('getInnerHTML', event => { + switch(event.that.tagName) { + case 'SCRIPT': + event.data.value = __op.js.source(event.data.value); + break; + default: + event.data.value = __op.sourceHtml(event.data.value); + }; + }); + + __oxidation.element.on('setOuterHTML', event => { + event.data.value = __op.rewriteHtml(event.data.value, { document: event.that.tagName === 'HTML' }); + }); + + __oxidation.element.on('getOuterHTML', event => { + switch(event.that.tagName) { + case 'HEAD': + event.data.value = __op.sourceHtml( + event.data.value.replace(/(.*)<\/head>/s, ' $2 ') + ).replace(/(.*)<\/op-head>/s, '$2'); + break; + case 'BODY': + event.data.value = __op.sourceHtml( + event.data.value.replace(/(.*)<\/body>/s, ' $2 ') + ).replace(/(.*)<\/op-body>/s, '$2'); + break; + default: + event.data.value = __op.sourceHtml(event.data.value, { document: event.that.tagName === 'HTML' }); + break; + }; + + //event.data.value = __op.sourceHtml(event.data.value, { document: event.that.tagName === 'HTML' }); + }); + + __oxidation.document.on('write', event => { + if (!event.data.html.length) return false; + event.data.html = [ __op.rewriteHtml(event.data.html.join('')) ]; + }); + + __oxidation.document.on('writeln', event => { + if (!event.data.html.length) return false; + event.data.html = [ __op.rewriteHtml(event.data.html.join('')) ]; + }); + + __oxidation.element.on('insertAdjacentHTML', event => { + event.data.html = __op.rewriteHtml(event.data.html); + }); + + // EventSource + + __oxidation.eventSource.on('construct', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + + __oxidation.eventSource.on('url', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + // History + __oxidation.history.on('replaceState', event => { + if (event.data.url) event.data.url = __op.rewriteUrl(event.data.url, '__op' in event.that ? event.that.__op.meta : __op.meta); + }); + __oxidation.history.on('pushState', event => { + if (event.data.url) event.data.url = __op.rewriteUrl(event.data.url, '__op' in event.that ? event.that.__op.meta : __op.meta); + }); + + // Element get set attribute methods + __oxidation.element.on('getAttribute', event => { + if (__oxidation.element.hasAttribute.call(event.that, __op.attributePrefix + '-attr-' + event.data.name)) { + event.respondWith( + event.target.call(event.that, __op.attributePrefix + '-attr-' + event.data.name) + ); + }; + }); + + // Message + __oxidation.message.on('postMessage', event => { + let to = event.data.origin; + + event.data.origin = '*'; + event.data.message = { + __data: event.data.message, + __origin: __op.meta.url.origin, + __to: to, + }; + }); + + __oxidation.message.on('data', event => { + const { value: data } = event.data; + if (typeof data === 'object' && '__data' in data && '__origin' in data) { + event.respondWith(data.__data); + }; + }); + + __oxidation.message.on('origin', event => { + const data = __oxidation.message.messageData.get.call(event.that); + if (typeof data === 'object' && data.__data && data.__origin) { + event.respondWith(data.__origin); + }; + }); + + __oxidation.overrideDescriptor(window, 'origin', { + get: (target, that) => { + return __oxidation.location.origin; + }, + }); + + __oxidation.node.on('baseURI', event => { + if (event.data.value.startsWith(window.location.origin)) event.data.value = __op.sourceUrl(event.data.value); + }); + + __oxidation.element.on('setAttribute', event => { + if (event.that instanceof HTMLMediaElement && event.data.name === 'src' && event.data.value.startsWith('blob:')) { + event.target.call(event.that, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.blobUrls.get(event.data.value); + return; + }; + + if (__op.attrs.isUrl(event.data.name)) { + event.target.call(event.that, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteUrl(event.data.value); + }; + + if (__op.attrs.isStyle(event.data.name)) { + event.target.call(event.that, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteCSS(event.data.value); + }; + + if (__op.attrs.isHtml(event.data.name)) { + event.target.call(event.that, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteHtml(event.data.value, { ...__op.meta, document: true }); + }; + + if (__op.attrs.isForbidden(event.data.name)) { + event.data.name = __op.attributePrefix + '-attr-' + event.data.name; + }; + }); + + __oxidation.element.on('audio', event => { + event.data.url = __op.rewriteUrl(event.data.url); + }); + + // Element Property Attributes + __oxidation.element.hookProperty([ HTMLAnchorElement, HTMLAreaElement, HTMLLinkElement, HTMLBaseElement ], 'href', { + get: (target, that) => { + return __op.sourceUrl( + target.call(that) + ); + }, + set: (target, that, [ val ]) => { + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-href', val) + target.call(that, __op.rewriteUrl(val)); + }, + }); + + __oxidation.element.hookProperty([ HTMLScriptElement, HTMLMediaElement, HTMLImageElement, HTMLInputElement, HTMLEmbedElement, HTMLIFrameElement, HTMLTrackElement, HTMLSourceElement ], 'src', { + get: (target, that) => { + return __op.sourceUrl( + target.call(that) + ); + }, + set: (target, that, [ val ]) => { + if (new String(val).toString().trim().startsWith('blob:') && that instanceof HTMLMediaElement) { + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-src', val) + return target.call(that, __op.blobUrls.get(val) || val); + }; + + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-src', val) + target.call(that, __op.rewriteUrl(val)); + }, + }); + + __oxidation.element.hookProperty([ HTMLFormElement ], 'action', { + get: (target, that) => { + return __op.sourceUrl( + target.call(that) + ); + }, + set: (target, that, [ val ]) => { + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-action', val) + target.call(that, __op.rewriteUrl(val)); + }, + }); + + __oxidation.element.hookProperty(HTMLScriptElement, 'integrity', { + get: (target, that) => { + return __oxidation.element.getAttribute.call(that, __op.attributePrefix + '-attr-integrity'); + }, + set: (target, that, [ val ]) => { + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-integrity', val); + }, + }); + + __oxidation.element.hookProperty(HTMLIFrameElement, 'sandbox', { + get: (target, that) => { + return __oxidation.element.getAttribute.call(that, __op.attributePrefix + '-attr-sandbox') || target.call(that); + }, + set: (target, that, [ val ]) => { + __oxidation.element.setAttribute.call(that, __op.attributePrefix + '-attr-sandbox', val); + }, + }); + + __oxidation.element.hookProperty(HTMLIFrameElement, 'contentWindow', { + get: (target, that) => { + const win = target.call(that); + try { + if (!win.__op) __opHook(win); + return win; + } catch(e) { + return win; + }; + }, + }); + + __oxidation.element.hookProperty(HTMLIFrameElement, 'contentDocument', { + get: (target, that) => { + const doc = target.call(that); + try { + const win = doc.defaultView + if (!win.__op) __opHook(win); + return doc; + } catch(e) { + return win; + }; + }, + }); + + __oxidation.node.on('getTextContent', event => { + if (event.that.tagName === 'SCRIPT') { + event.data.value = __op.js.source(event.data.value); + }; + }); + + __oxidation.node.on('setTextContent', event => { + if (event.that.tagName === 'SCRIPT') { + event.data.value = __op.js.rewrite(event.data.value); + }; + }); + + __oxidation.object.on('getOwnPropertyNames', event => { + event.data.names = event.data.names.filter(element => !(__op.brazenKeys.includes(element))); + }); + + // Document + __oxidation.document.on('getDomain', event => { + event.data.value = __op.domain; + }); + __oxidation.document.on('setDomain', event => { + if (!event.data.value.toString().endsWith(__op.meta.url.hostname.split('.').slice(-2).join('.'))) return event.respondWith(''); + event.respondWith(__op.domain = event.data.value); + }) + + __oxidation.document.on('url', event => { + event.data.value = __oxidation.location.href; + }); + + __oxidation.document.on('documentURI', event => { + event.data.value = __oxidation.location.href; + }); + + __oxidation.document.on('referrer', event => { + event.data.value = __op.referrer || __op.sourceUrl(event.data.value); + }); + + __oxidation.document.on('parseFromString', event => { + if (event.data.type !== 'text/html') return false; + event.data.string = __op.rewriteHtml(event.data.string, { ...__op.meta, document: true, }); + }); + + // Attribute (node.attributes) + __oxidation.attribute.on('getValue', event => { + if (__oxidation.element.hasAttribute.call(event.that.ownerElement, __op.attributePrefix + '-attr-' + event.data.name)) { + event.data.value = __oxidation.element.getAttribute.call(event.that.ownerElement, __op.attributePrefix + '-attr-' + event.data.name); + }; + }); + + __oxidation.attribute.on('setValue', event => { + if (__op.attrs.isUrl(event.data.name)) { + __oxidation.element.setAttribute.call(event.that.ownerElement, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteUrl(event.data.value); + }; + + if (__op.attrs.isStyle(event.data.name)) { + __oxidation.element.setAttribute.call(event.that.ownerElement, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteCSS(event.data.value); + }; + + if (__op.attrs.isHtml(event.data.name)) { + __oxidation.element.setAttribute.call(event.that.ownerElement, __op.attributePrefix + '-attr-' + event.data.name, event.data.value); + event.data.value = __op.rewriteHtml(event.data.value, { ...__op.meta, document: true }); + }; + + }); + + // URL + __oxidation.url.on('createObjectURL', event => { + let url = event.target.call(event.that, event.data.object); + if (url.startsWith('blob:' + location.origin)) { + let newUrl = 'blob:' + __op.meta.url.origin + url.slice('blob:'.length + location.origin.length); + + __op.blobUrls.set(newUrl, url); + event.respondWith(newUrl); + } else { + event.respondWith(url); + }; + }); + + __oxidation.url.on('revokeObjectURL', event => { + if (__op.blobUrls.has(event.data.url)) { + const old = event.data.url; + event.data.url = __op.blobUrls.get(event.data.url); + __op.blobUrls.delete(old); + }; + }); + + __oxidation.websocket.on('websocket', event => { + const url = new URL(event.data.url); + + const headers = { + Host: url.host, + Origin: __op.meta.url.origin, + Pragma: 'no-cache', + 'Cache-Control': 'no-cache', + Upgrade: 'websocket', + 'User-Agent': window.navigator.userAgent, + 'Connection': 'Upgrade', + }; + + const cookies = __op.cookie.serialize(__op.cookies, { url }, false); + + if (cookies) headers.Cookie = cookies; + const protocols = [...event.data.protocols]; + + const remote = { + protocol: url.protocol === 'wss:' ? 'https:' : 'http:', + host: url.hostname, + port: url.port, + path: url.pathname + url.search, + }; + + if (protocols.length) headers['Sec-WebSocket-Protocol'] = protocols.join(', '); + + event.data.url = `wss://${window.location.host}/bare/v1/`; + event.data.protocols = [ + 'bare', + encodeProtocol(JSON.stringify({ + remote, + headers, + forward_headers: [ + 'accept', + 'accept-encoding', + 'accept-language', + 'sec-websocket-extensions', + 'sec-websocket-key', + 'sec-websocket-version', + ] + })), + ]; + }); + + // Function + + __oxidation.function.on('function', event => { + event.data.script = __op.js.rewrite(event.data.script); + }); + + __oxidation.function.on('toString', event => { + if (__oxidation.fnStrings.has(event.data.fn)) return event.respondWith(__oxidation.fnStrings.get(event.data.fn)); + + /* + const str = event.target.call(event.that); + let sourced; + + try { + const padding = !str.startsWith('function') && str[0] !== '('; + sourced = __op.js.source((padding ? '({' : 'x=') + str + (padding ? '})' : '')).slice(2, str.length + 2); + } catch(e) { + sourced = str; + }; + + event.respondWith(sourced); + */ + }); + + if ('WorkerGlobalScope' in window) { + __oxidation.overrideDescriptor(window.WorkerGlobalScope.prototype, 'location', { + get: (target, that) => { + if (!(that instanceof window.WorkerGlobalScope)) return target.call(that); + return __oxidation.location; + }, + }); + }; + + __op.pm = null + __op.eval = __oxidation.wrap(window, 'eval', (target, that, args) => { + if (!args.length || typeof args[0] !== 'string') return target.apply(that, args); + let [ script ] = args; + + script = __op.js.rewrite(script); + return target.call(that, script); + }); + + __oxidation.nativeMethods.defineProperty(window.Object.prototype, '__opLocation', { + configurable: true, + get() { + return (this === window.document || this === window) ? __oxidation.location : this.location; + }, + set(val) { + if (this === window.document || this === window) { + __oxidation.location.href = val; + } else { + this.location = val; + }; + }, + }); + + __oxidation.nativeMethods.defineProperty(window.Object.prototype, '__opEval', { + configurable: true, + get() { + return this === window ? __op.eval : this.eval; + }, + set(val) { + this.eval = val; + }, + }); + + __oxidation.nativeMethods.defineProperty(window.Object.prototype, '__opSource', { + writable: true, + value: __op, + }); + + __oxidation.nativeMethods.defineProperty(window.Object.prototype, '__opSetSource', { + configurable: true, + get() { + return (__op) => { + this.__opSource = __op; + return this; + }; + }, + }); + + __oxidation.nativeMethods.defineProperty(window.Object.prototype, '__opPostMessage', { + configurable: true, + get() { + if (window.DedicatedWorkerGlobalScope && this instanceof window.DedicatedWorkerGlobalScope || window.window && this instanceof window.Window) { + + const source = this.__opSource || __op; + + if (!__op.pm) __op.pm = source.oxidation.message.wrapPostMessage(this, '__opOriginalPM', !window.window); + return __op.pm; + }; + + return this.postMessage; + }, + set(val) { + this.postMessage = val; + }, + }); + + __oxidation.document.on('querySelector', event => { + const elem = event.target.call(event.that, __op.css.rewriteSelector(event.data.selectors, ['src', 'href'], true)); + event.respondWith((elem || event.target.call(event.that, event.data.selectors))); + }); + + __oxidation.element.on('querySelector', event => { + //console.log('Element:', event.data); + }); + + /* + if (window.document) { + __oxidation.override(__oxidation.document.docProto, 'querySelector', (target, that, args) => { + console.log(args[0]); + return target.apply(that, args); + }); + }; + */ + + + window.__opOriginalPM = window.postMessage; + + if (window.History && !worker) __oxidation.nativeMethods.defineProperty(window.History.prototype, '__op', { + writable: true, + value: __op, + enumerable: false, + }); + + // Hooking functions & descriptors + __oxidation.fetch.overrideRequest(); + __oxidation.fetch.overrideUrl(); + __oxidation.xhr.overrideOpen(); + __oxidation.xhr.overrideResponseUrl(); + __oxidation.element.overrideHtml(); + __oxidation.element.overrideAttribute(); + __oxidation.element.overrideInsertAdjacentHTML(); + __oxidation.element.overrideAudio(); + // __oxidation.element.overrideQuerySelector(); + __oxidation.node.overrideBaseURI(); + __oxidation.node.overrideTextContent(); + __oxidation.attribute.override(); + __oxidation.document.overrideDomain(); + __oxidation.document.overrideURL(); + __oxidation.document.overrideDocumentURI(); + __oxidation.document.overrideWrite(); + __oxidation.document.overrideReferrer(); + __oxidation.document.overrideParseFromString(); + //__oxidation.document.overrideQuerySelector(); + __oxidation.object.overrideGetPropertyNames(); + __oxidation.history.overridePushState(); + __oxidation.history.overrideReplaceState(); + __oxidation.eventSource.overrideConstruct(); + __oxidation.eventSource.overrideUrl(); + __oxidation.websocket.overrideWebSocket(); + __oxidation.websocket.overrideProtocol(); + __oxidation.websocket.overrideUrl(); + __oxidation.url.overrideObjectURL(); + __oxidation.document.overrideCookie(); + __oxidation.message.overridePostMessage(); + __oxidation.message.overrideMessageOrigin(); + __oxidation.message.overrideMessageData(); + __oxidation.workers.overrideWorker(); + __oxidation.workers.overrideAddModule(); + __oxidation.workers.overrideImportScripts(); + __oxidation.workers.overridePostMessage(); + __oxidation.navigator.overrideSendBeacon(); + __oxidation.function.overrideFunction(); + __oxidation.function.overrideToString(); + __op.addRewrites(); + + __op.$wrap = function(name) { + if (name === 'location') return '__opLocation'; + if (name === 'eval') return '__opEval'; + + return name; + }; + + __op.$get = function(that) { + if (that === window.location) return __oxidation.location; + if (that === window.eval) return __op.eval; + return that; + }; + + __op.db = await __op.cookie.db(); + //_op.cookieStr = await __op.cookie.getCookies(__op.db.getAll('cookies'), __op.meta, true); + + const valid_chars = "!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~"; + const reserved_chars = "%"; + + function encodeProtocol(protocol){ + protocol = protocol.toString(); + + let result = ''; + + for(let i = 0; i < protocol.length; i++){ + const char = protocol[i]; + + if(valid_chars.includes(char) && !reserved_chars.includes(char)){ + result += char; + }else{ + const code = char.charCodeAt(); + result += '%' + code.toString(16).padStart(2, 0); + } + } + + return result; + }; + + if (window.Location) { + window.Location = __oxidation.location.constructor; + }; + + if (!worker && window.navigator && window.navigator.serviceWorker) { + window.navigator.serviceWorker.addEventListener('message', event => { + if (typeof event.data !== 'object') return false; + + if (event.data.msg === 'updateCookies') { + __op.cookie.getCookies(__op.db).then(cookies => { + __op.cookies = cookies; + __op.cookieStr = __op.cookie.serialize(cookies, __op.meta, true); + }); + }; + }); + }; +}; + +if (!self.__op) { __opHook(self); } + + +function instrument(obj, prop, wrapper) { + return (...args) => obj[prop].apply(this, args); +}; \ No newline at end of file diff --git a/example/static/op.sw.js b/example/static/op.sw.js new file mode 100644 index 0000000..0645640 --- /dev/null +++ b/example/static/op.sw.js @@ -0,0 +1,304 @@ +importScripts('/op.bundle.js'); + +const csp = [ + 'cross-origin-embedder-policy', + 'cross-origin-opener-policy', + 'cross-origin-resource-policy', + 'content-security-policy', + 'content-security-policy-report-only', + 'expect-ct', + 'feature-policy', + 'origin-isolation', + 'strict-transport-security', + 'upgrade-insecure-requests', + 'x-content-type-options', + 'x-download-options', + 'x-frame-options', + 'x-permitted-cross-domain-policies', + 'x-powered-by', + 'x-xss-protection', +]; + +const headers = { + csp: [ + 'cross-origin-embedder-policy', + 'cross-origin-opener-policy', + 'cross-origin-resource-policy', + 'content-security-policy', + 'content-security-policy-report-only', + 'expect-ct', + 'feature-policy', + 'origin-isolation', + 'strict-transport-security', + 'upgrade-insecure-requests', + 'x-content-type-options', + 'x-download-options', + 'x-frame-options', + 'x-permitted-cross-domain-policies', + 'x-powered-by', + 'x-xss-protection', + ], + forward: [ + 'accept-encoding', + 'accept', + 'connection', + 'content-length', + 'content-type', + ], +}; + +const method = { + empty: ['GET', 'HEAD'] +}; + +const statusCode = { + empty: [ + 204, + 304, + ], +}; + +Brazen('/bare/v1/', { + prefix: '/service/', +}); + +function Brazen(bare, config = {}) { + if (!bare) throw new Error('No barer server given. Cannot make connections without one.'); + addEventListener('fetch', event => { + event.respondWith(handler(event.request, config, bare)); + }); +}; + + +async function handler(request, config = {}, bare) { + try { + let blob = false; + const clientRequest = request; + const _url = new URL(clientRequest.url); + const rewrite = new Rewriter(config); + const db = await rewrite.cookie.db(); + let fetchUrl = bare; + + if (!request.url.startsWith(location.origin) || !_url.pathname.startsWith(rewrite.prefix) || (config.skip || []).includes(request.url)) { + return fetch(request); + }; + + rewrite.meta.origin = location.origin; + rewrite.meta.base = rewrite.meta.url = new URL(rewrite.sourceUrl(request.url)); + + rewrite.html.on('element', (element, type) => { + if (type !== 'rewrite') return false; + if (element.tagName !== 'head') return false; + + element.childNodes.unshift( + { + tagName: 'script', + nodeName: 'script', + childNodes: [], + attrs: [ + { name: 'src', value: '/op.handler.js', skip: true } + ], + } + ); + + element.childNodes.unshift( + { + tagName: 'script', + nodeName: 'script', + childNodes: [], + attrs: [ + { name: 'src', value: '/op.bundle.js', skip: true } + ], + } + ); + + element.childNodes.unshift( + { + tagName: 'script', + nodeName: 'script', + childNodes: [ + { + nodeName: '#text', + value: `window.__opCookies = atob("${btoa(rewrite.cookie.serialize(element.options.cookies, rewrite.meta, true))}");\nwindow.__opReferrer = atob("${btoa(request.referrer)}");` + }, + ], + attrs: [], + skip: true, + } + ); + }); + + rewrite.addRewrites(); + + if (rewrite.meta.url.protocol === 'blob:') { + blob = true; + rewrite.meta.base = rewrite.meta.url = new URL(rewrite.meta.url.pathname); + fetchUrl = 'blob:' + location.origin + rewrite.meta.url.pathname; + }; + + const { url } = rewrite.meta; + const sendHeaders = Object.fromEntries([...request.headers.entries()]); + + sendHeaders['user-agent'] = navigator.userAgent; + + if (request.referrer && request.referrer.startsWith(location.origin)) { + const referer = new URL(rewrite.sourceUrl(request.referrer)); + + if (rewrite.meta.url.origin !== referer.origin && request.mode === 'cors') { + sendHeaders.origin = referer.origin; + }; + + sendHeaders.referer = referer.href; + }; + + //const cookies = await rewrite.cookie.getCookies(await db.getAll('cookies'), rewrite.meta) || ''; + const cookies = await rewrite.cookie.getCookies(db) || []; + const cookieStr = rewrite.cookie.serialize(cookies, rewrite.meta, false); + if (cookieStr) sendHeaders.cookie = cookieStr; + + const barer = { + 'x-bare-protocol': url.protocol, + 'x-bare-host': url.hostname, + 'x-bare-path': url.pathname + url.search, + 'x-bare-port': url.port, + 'x-bare-headers': JSON.stringify(sendHeaders), + 'x-bare-forward-headers': JSON.stringify(headers.forward), + }; + + const options = { + method: request.method, + headers: !blob ? barer : request.headers, + redirect: request.redirect, + credentials: 'omit', + mode: request.mode === 'cors' ? request.mode : 'same-origin', + }; + + if (!method.empty.includes(request.method.toUpperCase())) options.body = await request.blob(); + + const remoteRequest = !blob ? new Request(fetchUrl, options) : new Request(fetchUrl); + const remoteResponse = await fetch(remoteRequest); + + if (remoteResponse.status === 500) { + return Promise.reject('Err'); + }; + + const sendData = !blob ? getBarerResponse(remoteResponse) : { + status: remoteResponse.status, + statusText: remoteResponse.statusText, + headers: Object.fromEntries([...remoteResponse.headers.entries()]), + body: remoteResponse.body, + }; + + for (const name of headers.csp) { + if (sendData.headers[name]) delete sendData.headers[name]; + }; + + if (sendData.headers.location) { + sendData.headers.location = rewrite.rewriteUrl(sendData.headers.location); + }; + + if (sendData.headers['set-cookie']) { + Promise.resolve(rewrite.cookie.setCookies(sendData.headers['set-cookie'], db, rewrite.meta)).then(() => { + self.clients.matchAll().then(function (clients){ + clients.forEach(function(client){ + client.postMessage({ + msg: 'updateCookies', + url: rewrite.meta.url.href, + }); + }); + }); + }); + delete sendData.headers['set-cookie']; + }; + + if (statusCode.empty.includes(sendData.status)) { + return new Response(null, { + headers: sendData.headers, + status: sendData.status, + statusText: sendData.statusText, + }); + }; + + + switch(request.destination) { + case 'script': + sendData.body = rewrite.js.rewrite( + await remoteResponse.text() + ); + break; + case 'worker': + sendData.body = `if (!self.__op) importScripts('/op.bundle.js', '/op.handler.js');\n`; + sendData.body += rewrite.js.rewrite( + await remoteResponse.text() + ); + break; + case 'style': + sendData.body = rewrite.rewriteCSS( + await remoteResponse.text() + ); + break; + /* + case 'document': + case 'iframe': + sendData.body = rewrite.rewriteHtml( + await remoteResponse.text(), + { + document: true, + cookies, + } + ); + */ + /* + default: + if (request.mode !== 'cors' && isHtml(rewrite.meta.url, (sendData.headers['content-type'] || ''))) { + sendData.body = rewrite.rewriteHtml( + await remoteResponse.text(), + { + document: true , + cookies, + } + ); + }; + */ + case 'iframe': + case 'document': + if (isHtml(rewrite.meta.url, (sendData.headers['content-type'] || ''))) { + sendData.body = rewrite.rewriteHtml( + await remoteResponse.text(), + { + document: true , + cookies, + } + ); + }; + }; + + // EventSource support + if (sendHeaders.accept === 'text/event-stream') { + sendData.headers['content-type'] = 'text/event-stream'; + }; + + return new Response(sendData.body, { + headers: sendData.headers, + status: sendData.status, + statusText: sendData.statusText, + }); + } catch(e) { + return new Response(e.toString(), { + status: 500, + }); + }; +}; + +function getBarerResponse(response) { + return { + headers: JSON.parse(response.headers.get('x-bare-headers')), + status: +response.headers.get('x-bare-status'), + statusText: response.headers.get('x-bare-status-text'), + body: response.body, + }; +}; + +function isHtml(url, contentType = '') { + return (Rewriter.mime.contentType((contentType || url.pathname)) || 'text/html').split(';')[0] === 'text/html'; +}; \ No newline at end of file diff --git a/example/static/op.test.sw.js b/example/static/op.test.sw.js new file mode 100644 index 0000000..b455d1c --- /dev/null +++ b/example/static/op.test.sw.js @@ -0,0 +1,206 @@ +importScripts('/op.bundle.js'); + +const csp = [ + 'cross-origin-embedder-policy', + 'cross-origin-opener-policy', + 'cross-origin-resource-policy', + 'content-security-policy', + 'content-security-policy-report-only', + 'expect-ct', + 'feature-policy', + 'origin-isolation', + 'strict-transport-security', + 'upgrade-insecure-requests', + 'x-content-type-options', + 'x-download-options', + 'x-frame-options', + 'x-permitted-cross-domain-policies', + 'x-powered-by', + 'x-xss-protection', +]; + +const emptyBody = ['204']; + +async function handle(request) { + try { + const parsed = new URL(request.url); + + if (parsed.pathname === '/op.bundle.js' || parsed.pathname === '/favicon.ico' || parsed.pathname === '/op.handler.js') return fetch(request); + + const rewrite = new Rewriter({ + meta: { + origin: location.origin, + }, + prefix: '/service/', + }); + + const db = await rewrite.cookie.db(); + + rewrite.html.on('element', (element, type) => { + if (type !== 'rewrite') return false; + if (element.tagName !== 'head') return false; + + element.childNodes.unshift( + { + tagName: 'script', + nodeName: 'script', + childNodes: [], + attrs: [ + { name: 'src', value: '/op.handler.js', skip: true } + ], + } + ); + + element.childNodes.unshift( + { + tagName: 'script', + nodeName: 'script', + childNodes: [], + attrs: [ + { name: 'src', value: '/op.bundle.js', skip: true } + ], + } + ); + }); + + rewrite.addRewrites(); + + if (!request.url.startsWith(location.origin) || request.url.startsWith(location.origin + rewrite.prefix)) { + let blob = false; + let requestUrl = '/fetch/asdsaadsad'; + + rewrite.meta.base = rewrite.meta.url = !request.url.startsWith(location.origin) ? new URL(request.url) : new URL(rewrite.sourceUrl(request.url)); + + if (rewrite.meta.url.protocol === 'blob:') { + blob = true; + rewrite.meta.base = rewrite.meta.url = new URL(rewrite.meta.url.pathname); + requestUrl = 'blob:' + location.origin + rewrite.meta.url.pathname; + }; + + const requestHeaders = request.headers instanceof Headers ? Object.fromEntries([...request.headers.entries()]) : request.headers; + let cookieStr = ''; + + if (request.referrer && request.referrer.startsWith(location.origin)) { + const referer = new URL(rewrite.sourceUrl(request.referrer)); + + if (rewrite.meta.url.origin !== referer.origin && request.mode === 'cors') { + request.headers.origin = referer.origin; + }; + + request.headers.referer = referer.href; + }; + + cookieStr = await rewrite.cookie.getCookies(await db.getAll('cookies'), rewrite.meta); + + requestHeaders.cookie = cookieStr; + + const headers = { + 'x-tomp-protocol': rewrite.meta.url.protocol, + 'x-tomp-host': rewrite.meta.url.hostname, + 'x-tomp-path': rewrite.meta.url.pathname + rewrite.meta.url.search, + 'x-tomp-port': rewrite.meta.url.port, + 'x-tomp-headers': JSON.stringify(requestHeaders), + 'x-tomp-forward-headers': JSON.stringify(['user-agent', 'accept', 'accept-encoding', 'accept', 'connection']), + }; + + const options = { + method: request.method, + headers: !blob ? headers : request.headers, + redirect: request.redirect, + mode: request.mode === 'cors' ? request.mode : 'same-origin', + }; + + if (!['GET', 'HEAD'].includes(request.method.toUpperCase())) options.body = await request.blob(); + + const newRequest = new Request(requestUrl, options); + + const processed = fetch(newRequest).then(async response => { + let body = response.body; + + const resHeaders = new Headers(response.headers); + + const rawHeaders = response.headers.has('x-tomp-headers') ? JSON.parse(response.headers.get('x-tomp-headers')) : Object.fromEntries([...response.headers.entries()]); + const status = response.headers.get('x-tomp-status') || response.status; + const statusText = response.headers.get('x-tomp-status-text') || response.statusText; + + for (let header in rawHeaders) { + if (csp.indexOf(header) > -1) delete rawHeaders[header]; + }; + + if (rawHeaders.location) { + rawHeaders.location = rewrite.rewriteUrl(rawHeaders.location); + }; + + if (rawHeaders['set-cookie']) { + Promise.resolve(rewrite.cookie.setCookies(rawHeaders['set-cookie'], db, rewrite.meta)).then(() => { + self.clients.matchAll().then(function (clients){ + clients.forEach(function(client){ + client.postMessage({ + msg: 'updateCookies', + url: rewrite.meta.url.href, + }); + }); + }); + }); + delete rawHeaders['set-cookie']; + }; + + if (isHtml(rewrite.meta.url, (resHeaders.get('content-type') || ''))) { + body = rewrite.rewriteHtml( + await response.text(), + { + document: true + } + ); + }; + + if (request.destination === 'script') { + body = rewrite.js.rewrite( + await response.text() + ); + }; + + if (request.destination === 'worker') { + body = `if (!self.__op) importScripts('/op.bundle.js', '/op.handler.js');\n`; + body += rewrite.js.rewrite( + await response.text() + ); + }; + + if (request.destination === 'style') { + body = rewrite.rewriteCSS( + await response.text() + ); + }; + + if (emptyBody.includes(status)) { + return new Response(null, { + headers: rawHeaders, + status, + statusText, + }); + }; + + return new Response(body, { + headers: rawHeaders, + status, + statusText, + }); + }); + + return processed; + + }; + } catch(e) { + return new Response(e.toString()); + }; +} + +self.addEventListener('fetch', event => { + if (event.request.url) event.respondWith(handle(event.request)); +}); + + +function isHtml(url, contentType = '') { + return (Rewriter.mime.contentType((contentType || url.pathname)) || 'text/html').split(';')[0] === 'text/html'; +}; \ No newline at end of file diff --git a/example/static/test.html b/example/static/test.html new file mode 100644 index 0000000..e69de29 diff --git a/index.js b/index.js new file mode 100644 index 0000000..994066c --- /dev/null +++ b/index.js @@ -0,0 +1,27 @@ +import Ultraviolet from './rewrite/index.js' + +import { generate } from 'esotope-hammerhead'; +import { parseScript } from 'meriyah'; + +const uv = new Ultraviolet({ + meta: { + url: new URL('https://www.google.com'), + base: new URL('https://www.google.com') + } +}); + +/* +console.log( + uv.css.recast('body { background: url ( \n " coohcie " ) }') +) + +*/ + +console.log( + uv.rewriteJS('window.eval(saasdsd)') +) + +/* +const used = process.memoryUsage().heapUsed / 1024 / 1024; +console.log(`The script uses approximately ${Math.round(used * 100) / 100} MB`); +*/ \ No newline at end of file diff --git a/lib/uv.bundle.js b/lib/uv.bundle.js new file mode 100644 index 0000000..c5dcf0b --- /dev/null +++ b/lib/uv.bundle.js @@ -0,0 +1,38848 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +/* harmony import */ var parse5__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); + + + +class HTML extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.rewriteUrl = ctx.rewriteUrl; + this.sourceUrl = ctx.sourceUrl; + }; + rewrite(str, options = {}) { + if (!str) return str; + return this.recast(str, node => { + if (node.tagName) this.emit('element', node, 'rewrite'); + if (node.attr) this.emit('attr', node, 'rewrite'); + if (node.nodeName === '#text') this.emit('text', node, 'rewrite'); + }, options) + }; + source(str, options = {}) { + if (!str) return str; + return this.recast(str, node => { + if (node.tagName) this.emit('element', node, 'source'); + if (node.attr) this.emit('attr', node, 'source'); + if (node.nodeName === '#text') this.emit('text', node, 'source'); + }, options) + }; + recast(str, fn, options = {}) { + try { + const ast = (options.document ? parse5__WEBPACK_IMPORTED_MODULE_1__.parse : parse5__WEBPACK_IMPORTED_MODULE_1__.parseFragment)(new String(str).toString()); + this.iterate(ast, fn, options); + return (0,parse5__WEBPACK_IMPORTED_MODULE_1__.serialize)(ast); + } catch(e) { + return str; + }; + }; + iterate(ast, fn, fnOptions) { + if (!ast) return ast; + + if (ast.tagName) { + const element = new P5Element(ast, false, fnOptions); + fn(element); + if (ast.attrs) { + for (const attr of ast.attrs) { + if (!attr.skip) fn(new AttributeEvent(element, attr, fnOptions)); + }; + }; + }; + + if (ast.childNodes) { + for (const child of ast.childNodes) { + if (!child.skip) this.iterate(child, fn, fnOptions); + }; + }; + + if (ast.nodeName === '#text') { + fn(new TextEvent(ast, new P5Element(ast.parentNode), false, fnOptions)); + }; + + return ast; + }; + wrapSrcset(str, meta = this.ctx.meta) { + return str.split(',').map(src => { + const parts = src.trimStart().split(' '); + if (parts[0]) parts[0] = this.ctx.rewriteUrl(parts[0], meta); + return parts.join(' '); + }).join(', '); + }; + unwrapSrcset(str, meta = this.ctx.meta) { + return str.split(',').map(src => { + const parts = src.trimStart().split(' '); + if (parts[0]) parts[0] = this.ctx.sourceUrl(parts[0], meta); + return parts.join(' '); + }).join(', '); + }; + static parse = parse5__WEBPACK_IMPORTED_MODULE_1__.parse; + static parseFragment = parse5__WEBPACK_IMPORTED_MODULE_1__.parseFragment; + static serialize = parse5__WEBPACK_IMPORTED_MODULE_1__.serialize; +}; + +class P5Element extends _events_js__WEBPACK_IMPORTED_MODULE_0__["default"] { + constructor(node, stream = false, options = {}) { + super(); + this.stream = stream; + this.node = node; + this.options = options; + }; + setAttribute(name, value) { + for (const attr of this.attrs) { + if (attr.name === name) { + attr.value = value; + return true; + }; + }; + + this.attrs.push( + { + name, + value, + } + ); + }; + getAttribute(name) { + const attr = this.attrs.find(attr => attr.name === name) || {}; + return attr.value; + }; + hasAttribute(name) { + return !!this.attrs.find(attr => attr.name === name); + }; + removeAttribute(name) { + const i = this.attrs.findIndex(attr => attr.name === name); + if (typeof i !== 'undefined') this.attrs.splice(i, 1); + }; + get tagName() { + return this.node.tagName; + }; + set tagName(val) { + this.node.tagName = val; + }; + get childNodes() { + return !this.stream ? this.node.childNodes : null; + }; + get innerHTML() { + return !this.stream ? (0,parse5__WEBPACK_IMPORTED_MODULE_1__.serialize)( + { + nodeName: '#document-fragment', + childNodes: this.childNodes, + } + ) : null; + }; + set innerHTML(val) { + if (!this.stream) this.node.childNodes = (0,parse5__WEBPACK_IMPORTED_MODULE_1__.parseFragment)(val).childNodes; + }; + get outerHTML() { + return !this.stream ? (0,parse5__WEBPACK_IMPORTED_MODULE_1__.serialize)( + { + nodeName: '#document-fragment', + childNodes: [ this ], + } + ) : null; + }; + set outerHTML(val) { + if (!this.stream) this.parentNode.childNodes.splice(this.parentNode.childNodes.findIndex(node => node === this.node), 1, ...(0,parse5__WEBPACK_IMPORTED_MODULE_1__.parseFragment)(val).childNodes); + }; + get textContent() { + if (this.stream) return null; + + let str = ''; + iterate(this.node, node => { + if (node.nodeName === '#text') str += node.value; + }); + + return str; + }; + set textContent(val) { + if (!this.stream) this.node.childNodes = [ + { + nodeName: '#text', + value: val, + parentNode: this.node + } + ]; + }; + get nodeName() { + return this.node.nodeName; + } + get parentNode() { + return this.node.parentNode ? new P5Element(this.node.parentNode) : null; + }; + get attrs() { + return this.node.attrs; + } + get namespaceURI() { + return this.node.namespaceURI; + } +}; + +class AttributeEvent { + constructor(node, attr, options = {}) { + this.attr = attr; + this.attrs = node.attrs; + this.node = node; + this.options = options; + }; + delete() { + const i = this.attrs.findIndex(attr => attr === this.attr); + + this.attrs.splice(i, 1); + + Object.defineProperty(this, 'deleted', { + get: () => true, + }); + + return true; + }; + get name() { + return this.attr.name; + }; + + set name(val) { + this.attr.name = val; + }; + get value() { + return this.attr.value; + }; + + set value(val) { + this.attr.value = val; + }; + get deleted() { + return false; + }; +}; + +class TextEvent { + constructor(node, element, stream = false, options = {}) { + this.stream = stream; + this.node = node; + this.element = element; + this.options = options; + }; + get nodeName() { + return this.node.nodeName; + } + get parentNode() { + return this.element; + }; + get value() { + return this.stream ? this.node.text : this.node.value; + }; + set value(val) { + + if (this.stream) this.node.text = val; + else this.node.value = val; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HTML); + +/***/ }), +/* 2 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventEmitter); + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + +/***/ }), +/* 3 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const Parser = __webpack_require__(4); +const Serializer = __webpack_require__(26); + +// Shorthands +exports.parse = function parse(html, options) { + const parser = new Parser(options); + + return parser.parse(html); +}; + +exports.parseFragment = function parseFragment(fragmentContext, html, options) { + if (typeof fragmentContext === 'string') { + options = html; + html = fragmentContext; + fragmentContext = null; + } + + const parser = new Parser(options); + + return parser.parseFragment(html, fragmentContext); +}; + +exports.serialize = function(node, options) { + const serializer = new Serializer(node, options); + + return serializer.serialize(); +}; + + +/***/ }), +/* 4 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Tokenizer = __webpack_require__(5); +const OpenElementStack = __webpack_require__(10); +const FormattingElementList = __webpack_require__(12); +const LocationInfoParserMixin = __webpack_require__(13); +const ErrorReportingParserMixin = __webpack_require__(18); +const Mixin = __webpack_require__(14); +const defaultTreeAdapter = __webpack_require__(22); +const mergeOptions = __webpack_require__(23); +const doctype = __webpack_require__(24); +const foreignContent = __webpack_require__(25); +const ERR = __webpack_require__(8); +const unicode = __webpack_require__(7); +const HTML = __webpack_require__(11); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; +const ATTRS = HTML.ATTRS; + +const DEFAULT_OPTIONS = { + scriptingEnabled: true, + sourceCodeLocationInfo: false, + onParseError: null, + treeAdapter: defaultTreeAdapter +}; + +//Misc constants +const HIDDEN_INPUT_TYPE = 'hidden'; + +//Adoption agency loops iteration count +const AA_OUTER_LOOP_ITER = 8; +const AA_INNER_LOOP_ITER = 3; + +//Insertion modes +const INITIAL_MODE = 'INITIAL_MODE'; +const BEFORE_HTML_MODE = 'BEFORE_HTML_MODE'; +const BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE'; +const IN_HEAD_MODE = 'IN_HEAD_MODE'; +const IN_HEAD_NO_SCRIPT_MODE = 'IN_HEAD_NO_SCRIPT_MODE'; +const AFTER_HEAD_MODE = 'AFTER_HEAD_MODE'; +const IN_BODY_MODE = 'IN_BODY_MODE'; +const TEXT_MODE = 'TEXT_MODE'; +const IN_TABLE_MODE = 'IN_TABLE_MODE'; +const IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE'; +const IN_CAPTION_MODE = 'IN_CAPTION_MODE'; +const IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE'; +const IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE'; +const IN_ROW_MODE = 'IN_ROW_MODE'; +const IN_CELL_MODE = 'IN_CELL_MODE'; +const IN_SELECT_MODE = 'IN_SELECT_MODE'; +const IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE'; +const IN_TEMPLATE_MODE = 'IN_TEMPLATE_MODE'; +const AFTER_BODY_MODE = 'AFTER_BODY_MODE'; +const IN_FRAMESET_MODE = 'IN_FRAMESET_MODE'; +const AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE'; +const AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE'; +const AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE'; + +//Insertion mode reset map +const INSERTION_MODE_RESET_MAP = { + [$.TR]: IN_ROW_MODE, + [$.TBODY]: IN_TABLE_BODY_MODE, + [$.THEAD]: IN_TABLE_BODY_MODE, + [$.TFOOT]: IN_TABLE_BODY_MODE, + [$.CAPTION]: IN_CAPTION_MODE, + [$.COLGROUP]: IN_COLUMN_GROUP_MODE, + [$.TABLE]: IN_TABLE_MODE, + [$.BODY]: IN_BODY_MODE, + [$.FRAMESET]: IN_FRAMESET_MODE +}; + +//Template insertion mode switch map +const TEMPLATE_INSERTION_MODE_SWITCH_MAP = { + [$.CAPTION]: IN_TABLE_MODE, + [$.COLGROUP]: IN_TABLE_MODE, + [$.TBODY]: IN_TABLE_MODE, + [$.TFOOT]: IN_TABLE_MODE, + [$.THEAD]: IN_TABLE_MODE, + [$.COL]: IN_COLUMN_GROUP_MODE, + [$.TR]: IN_TABLE_BODY_MODE, + [$.TD]: IN_ROW_MODE, + [$.TH]: IN_ROW_MODE +}; + +//Token handlers map for insertion modes +const TOKEN_HANDLERS = { + [INITIAL_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInInitialMode, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInInitialMode, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: doctypeInInitialMode, + [Tokenizer.START_TAG_TOKEN]: tokenInInitialMode, + [Tokenizer.END_TAG_TOKEN]: tokenInInitialMode, + [Tokenizer.EOF_TOKEN]: tokenInInitialMode + }, + [BEFORE_HTML_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHtml, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHtml, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagBeforeHtml, + [Tokenizer.END_TAG_TOKEN]: endTagBeforeHtml, + [Tokenizer.EOF_TOKEN]: tokenBeforeHtml + }, + [BEFORE_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagBeforeHead, + [Tokenizer.END_TAG_TOKEN]: endTagBeforeHead, + [Tokenizer.EOF_TOKEN]: tokenBeforeHead + }, + [IN_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagInHead, + [Tokenizer.END_TAG_TOKEN]: endTagInHead, + [Tokenizer.EOF_TOKEN]: tokenInHead + }, + [IN_HEAD_NO_SCRIPT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInHeadNoScript, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHeadNoScript, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagInHeadNoScript, + [Tokenizer.END_TAG_TOKEN]: endTagInHeadNoScript, + [Tokenizer.EOF_TOKEN]: tokenInHeadNoScript + }, + [AFTER_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagAfterHead, + [Tokenizer.END_TAG_TOKEN]: endTagAfterHead, + [Tokenizer.EOF_TOKEN]: tokenAfterHead + }, + [IN_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInBody, + [Tokenizer.END_TAG_TOKEN]: endTagInBody, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [TEXT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: ignoreToken, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: ignoreToken, + [Tokenizer.END_TAG_TOKEN]: endTagInText, + [Tokenizer.EOF_TOKEN]: eofInText + }, + [IN_TABLE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTable, + [Tokenizer.END_TAG_TOKEN]: endTagInTable, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TABLE_TEXT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTableText, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInTableText, + [Tokenizer.COMMENT_TOKEN]: tokenInTableText, + [Tokenizer.DOCTYPE_TOKEN]: tokenInTableText, + [Tokenizer.START_TAG_TOKEN]: tokenInTableText, + [Tokenizer.END_TAG_TOKEN]: tokenInTableText, + [Tokenizer.EOF_TOKEN]: tokenInTableText + }, + [IN_CAPTION_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInCaption, + [Tokenizer.END_TAG_TOKEN]: endTagInCaption, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_COLUMN_GROUP_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInColumnGroup, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInColumnGroup, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInColumnGroup, + [Tokenizer.END_TAG_TOKEN]: endTagInColumnGroup, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TABLE_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTableBody, + [Tokenizer.END_TAG_TOKEN]: endTagInTableBody, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_ROW_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInRow, + [Tokenizer.END_TAG_TOKEN]: endTagInRow, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_CELL_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInCell, + [Tokenizer.END_TAG_TOKEN]: endTagInCell, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_SELECT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInSelect, + [Tokenizer.END_TAG_TOKEN]: endTagInSelect, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_SELECT_IN_TABLE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInSelectInTable, + [Tokenizer.END_TAG_TOKEN]: endTagInSelectInTable, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TEMPLATE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTemplate, + [Tokenizer.END_TAG_TOKEN]: endTagInTemplate, + [Tokenizer.EOF_TOKEN]: eofInTemplate + }, + [AFTER_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterBody, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToRootHtmlElement, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterBody, + [Tokenizer.END_TAG_TOKEN]: endTagAfterBody, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [IN_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInFrameset, + [Tokenizer.END_TAG_TOKEN]: endTagInFrameset, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterFrameset, + [Tokenizer.END_TAG_TOKEN]: endTagAfterFrameset, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_AFTER_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterAfterBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterAfterBody, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterBody, + [Tokenizer.END_TAG_TOKEN]: tokenAfterAfterBody, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_AFTER_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterFrameset, + [Tokenizer.END_TAG_TOKEN]: ignoreToken, + [Tokenizer.EOF_TOKEN]: stopParsing + } +}; + +//Parser +class Parser { + constructor(options) { + this.options = mergeOptions(DEFAULT_OPTIONS, options); + + this.treeAdapter = this.options.treeAdapter; + this.pendingScript = null; + + if (this.options.sourceCodeLocationInfo) { + Mixin.install(this, LocationInfoParserMixin); + } + + if (this.options.onParseError) { + Mixin.install(this, ErrorReportingParserMixin, { onParseError: this.options.onParseError }); + } + } + + // API + parse(html) { + const document = this.treeAdapter.createDocument(); + + this._bootstrap(document, null); + this.tokenizer.write(html, true); + this._runParsingLoop(null); + + return document; + } + + parseFragment(html, fragmentContext) { + //NOTE: use element as a fragment context if context element was not provided, + //so we will parse in "forgiving" manner + if (!fragmentContext) { + fragmentContext = this.treeAdapter.createElement($.TEMPLATE, NS.HTML, []); + } + + //NOTE: create fake element which will be used as 'document' for fragment parsing. + //This is important for jsdom there 'document' can't be recreated, therefore + //fragment parsing causes messing of the main `document`. + const documentMock = this.treeAdapter.createElement('documentmock', NS.HTML, []); + + this._bootstrap(documentMock, fragmentContext); + + if (this.treeAdapter.getTagName(fragmentContext) === $.TEMPLATE) { + this._pushTmplInsertionMode(IN_TEMPLATE_MODE); + } + + this._initTokenizerForFragmentParsing(); + this._insertFakeRootElement(); + this._resetInsertionMode(); + this._findFormInFragmentContext(); + this.tokenizer.write(html, true); + this._runParsingLoop(null); + + const rootElement = this.treeAdapter.getFirstChild(documentMock); + const fragment = this.treeAdapter.createDocumentFragment(); + + this._adoptNodes(rootElement, fragment); + + return fragment; + } + + //Bootstrap parser + _bootstrap(document, fragmentContext) { + this.tokenizer = new Tokenizer(this.options); + + this.stopped = false; + + this.insertionMode = INITIAL_MODE; + this.originalInsertionMode = ''; + + this.document = document; + this.fragmentContext = fragmentContext; + + this.headElement = null; + this.formElement = null; + + this.openElements = new OpenElementStack(this.document, this.treeAdapter); + this.activeFormattingElements = new FormattingElementList(this.treeAdapter); + + this.tmplInsertionModeStack = []; + this.tmplInsertionModeStackTop = -1; + this.currentTmplInsertionMode = null; + + this.pendingCharacterTokens = []; + this.hasNonWhitespacePendingCharacterToken = false; + + this.framesetOk = true; + this.skipNextNewLine = false; + this.fosterParentingEnabled = false; + } + + //Errors + _err() { + // NOTE: err reporting is noop by default. Enabled by mixin. + } + + //Parsing loop + _runParsingLoop(scriptHandler) { + while (!this.stopped) { + this._setupTokenizerCDATAMode(); + + const token = this.tokenizer.getNextToken(); + + if (token.type === Tokenizer.HIBERNATION_TOKEN) { + break; + } + + if (this.skipNextNewLine) { + this.skipNextNewLine = false; + + if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { + if (token.chars.length === 1) { + continue; + } + + token.chars = token.chars.substr(1); + } + } + + this._processInputToken(token); + + if (scriptHandler && this.pendingScript) { + break; + } + } + } + + runParsingLoopForCurrentChunk(writeCallback, scriptHandler) { + this._runParsingLoop(scriptHandler); + + if (scriptHandler && this.pendingScript) { + const script = this.pendingScript; + + this.pendingScript = null; + + scriptHandler(script); + + return; + } + + if (writeCallback) { + writeCallback(); + } + } + + //Text parsing + _setupTokenizerCDATAMode() { + const current = this._getAdjustedCurrentElement(); + + this.tokenizer.allowCDATA = + current && + current !== this.document && + this.treeAdapter.getNamespaceURI(current) !== NS.HTML && + !this._isIntegrationPoint(current); + } + + _switchToTextParsing(currentToken, nextTokenizerState) { + this._insertElement(currentToken, NS.HTML); + this.tokenizer.state = nextTokenizerState; + this.originalInsertionMode = this.insertionMode; + this.insertionMode = TEXT_MODE; + } + + switchToPlaintextParsing() { + this.insertionMode = TEXT_MODE; + this.originalInsertionMode = IN_BODY_MODE; + this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; + } + + //Fragment parsing + _getAdjustedCurrentElement() { + return this.openElements.stackTop === 0 && this.fragmentContext + ? this.fragmentContext + : this.openElements.current; + } + + _findFormInFragmentContext() { + let node = this.fragmentContext; + + do { + if (this.treeAdapter.getTagName(node) === $.FORM) { + this.formElement = node; + break; + } + + node = this.treeAdapter.getParentNode(node); + } while (node); + } + + _initTokenizerForFragmentParsing() { + if (this.treeAdapter.getNamespaceURI(this.fragmentContext) === NS.HTML) { + const tn = this.treeAdapter.getTagName(this.fragmentContext); + + if (tn === $.TITLE || tn === $.TEXTAREA) { + this.tokenizer.state = Tokenizer.MODE.RCDATA; + } else if ( + tn === $.STYLE || + tn === $.XMP || + tn === $.IFRAME || + tn === $.NOEMBED || + tn === $.NOFRAMES || + tn === $.NOSCRIPT + ) { + this.tokenizer.state = Tokenizer.MODE.RAWTEXT; + } else if (tn === $.SCRIPT) { + this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; + } else if (tn === $.PLAINTEXT) { + this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; + } + } + } + + //Tree mutation + _setDocumentType(token) { + const name = token.name || ''; + const publicId = token.publicId || ''; + const systemId = token.systemId || ''; + + this.treeAdapter.setDocumentType(this.document, name, publicId, systemId); + } + + _attachElementToTree(element) { + if (this._shouldFosterParentOnInsertion()) { + this._fosterParentElement(element); + } else { + const parent = this.openElements.currentTmplContent || this.openElements.current; + + this.treeAdapter.appendChild(parent, element); + } + } + + _appendElement(token, namespaceURI) { + const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); + + this._attachElementToTree(element); + } + + _insertElement(token, namespaceURI) { + const element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); + + this._attachElementToTree(element); + this.openElements.push(element); + } + + _insertFakeElement(tagName) { + const element = this.treeAdapter.createElement(tagName, NS.HTML, []); + + this._attachElementToTree(element); + this.openElements.push(element); + } + + _insertTemplate(token) { + const tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs); + const content = this.treeAdapter.createDocumentFragment(); + + this.treeAdapter.setTemplateContent(tmpl, content); + this._attachElementToTree(tmpl); + this.openElements.push(tmpl); + } + + _insertFakeRootElement() { + const element = this.treeAdapter.createElement($.HTML, NS.HTML, []); + + this.treeAdapter.appendChild(this.openElements.current, element); + this.openElements.push(element); + } + + _appendCommentNode(token, parent) { + const commentNode = this.treeAdapter.createCommentNode(token.data); + + this.treeAdapter.appendChild(parent, commentNode); + } + + _insertCharacters(token) { + if (this._shouldFosterParentOnInsertion()) { + this._fosterParentText(token.chars); + } else { + const parent = this.openElements.currentTmplContent || this.openElements.current; + + this.treeAdapter.insertText(parent, token.chars); + } + } + + _adoptNodes(donor, recipient) { + for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) { + this.treeAdapter.detachNode(child); + this.treeAdapter.appendChild(recipient, child); + } + } + + //Token processing + _shouldProcessTokenInForeignContent(token) { + const current = this._getAdjustedCurrentElement(); + + if (!current || current === this.document) { + return false; + } + + const ns = this.treeAdapter.getNamespaceURI(current); + + if (ns === NS.HTML) { + return false; + } + + if ( + this.treeAdapter.getTagName(current) === $.ANNOTATION_XML && + ns === NS.MATHML && + token.type === Tokenizer.START_TAG_TOKEN && + token.tagName === $.SVG + ) { + return false; + } + + const isCharacterToken = + token.type === Tokenizer.CHARACTER_TOKEN || + token.type === Tokenizer.NULL_CHARACTER_TOKEN || + token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN; + + const isMathMLTextStartTag = + token.type === Tokenizer.START_TAG_TOKEN && token.tagName !== $.MGLYPH && token.tagName !== $.MALIGNMARK; + + if ((isMathMLTextStartTag || isCharacterToken) && this._isIntegrationPoint(current, NS.MATHML)) { + return false; + } + + if ( + (token.type === Tokenizer.START_TAG_TOKEN || isCharacterToken) && + this._isIntegrationPoint(current, NS.HTML) + ) { + return false; + } + + return token.type !== Tokenizer.EOF_TOKEN; + } + + _processToken(token) { + TOKEN_HANDLERS[this.insertionMode][token.type](this, token); + } + + _processTokenInBodyMode(token) { + TOKEN_HANDLERS[IN_BODY_MODE][token.type](this, token); + } + + _processTokenInForeignContent(token) { + if (token.type === Tokenizer.CHARACTER_TOKEN) { + characterInForeignContent(this, token); + } else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN) { + nullCharacterInForeignContent(this, token); + } else if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN) { + insertCharacters(this, token); + } else if (token.type === Tokenizer.COMMENT_TOKEN) { + appendComment(this, token); + } else if (token.type === Tokenizer.START_TAG_TOKEN) { + startTagInForeignContent(this, token); + } else if (token.type === Tokenizer.END_TAG_TOKEN) { + endTagInForeignContent(this, token); + } + } + + _processInputToken(token) { + if (this._shouldProcessTokenInForeignContent(token)) { + this._processTokenInForeignContent(token); + } else { + this._processToken(token); + } + + if (token.type === Tokenizer.START_TAG_TOKEN && token.selfClosing && !token.ackSelfClosing) { + this._err(ERR.nonVoidHtmlElementStartTagWithTrailingSolidus); + } + } + + //Integration points + _isIntegrationPoint(element, foreignNS) { + const tn = this.treeAdapter.getTagName(element); + const ns = this.treeAdapter.getNamespaceURI(element); + const attrs = this.treeAdapter.getAttrList(element); + + return foreignContent.isIntegrationPoint(tn, ns, attrs, foreignNS); + } + + //Active formatting elements reconstruction + _reconstructActiveFormattingElements() { + const listLength = this.activeFormattingElements.length; + + if (listLength) { + let unopenIdx = listLength; + let entry = null; + + do { + unopenIdx--; + entry = this.activeFormattingElements.entries[unopenIdx]; + + if (entry.type === FormattingElementList.MARKER_ENTRY || this.openElements.contains(entry.element)) { + unopenIdx++; + break; + } + } while (unopenIdx > 0); + + for (let i = unopenIdx; i < listLength; i++) { + entry = this.activeFormattingElements.entries[i]; + this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element)); + entry.element = this.openElements.current; + } + } + } + + //Close elements + _closeTableCell() { + this.openElements.generateImpliedEndTags(); + this.openElements.popUntilTableCellPopped(); + this.activeFormattingElements.clearToLastMarker(); + this.insertionMode = IN_ROW_MODE; + } + + _closePElement() { + this.openElements.generateImpliedEndTagsWithExclusion($.P); + this.openElements.popUntilTagNamePopped($.P); + } + + //Insertion modes + _resetInsertionMode() { + for (let i = this.openElements.stackTop, last = false; i >= 0; i--) { + let element = this.openElements.items[i]; + + if (i === 0) { + last = true; + + if (this.fragmentContext) { + element = this.fragmentContext; + } + } + + const tn = this.treeAdapter.getTagName(element); + const newInsertionMode = INSERTION_MODE_RESET_MAP[tn]; + + if (newInsertionMode) { + this.insertionMode = newInsertionMode; + break; + } else if (!last && (tn === $.TD || tn === $.TH)) { + this.insertionMode = IN_CELL_MODE; + break; + } else if (!last && tn === $.HEAD) { + this.insertionMode = IN_HEAD_MODE; + break; + } else if (tn === $.SELECT) { + this._resetInsertionModeForSelect(i); + break; + } else if (tn === $.TEMPLATE) { + this.insertionMode = this.currentTmplInsertionMode; + break; + } else if (tn === $.HTML) { + this.insertionMode = this.headElement ? AFTER_HEAD_MODE : BEFORE_HEAD_MODE; + break; + } else if (last) { + this.insertionMode = IN_BODY_MODE; + break; + } + } + } + + _resetInsertionModeForSelect(selectIdx) { + if (selectIdx > 0) { + for (let i = selectIdx - 1; i > 0; i--) { + const ancestor = this.openElements.items[i]; + const tn = this.treeAdapter.getTagName(ancestor); + + if (tn === $.TEMPLATE) { + break; + } else if (tn === $.TABLE) { + this.insertionMode = IN_SELECT_IN_TABLE_MODE; + return; + } + } + } + + this.insertionMode = IN_SELECT_MODE; + } + + _pushTmplInsertionMode(mode) { + this.tmplInsertionModeStack.push(mode); + this.tmplInsertionModeStackTop++; + this.currentTmplInsertionMode = mode; + } + + _popTmplInsertionMode() { + this.tmplInsertionModeStack.pop(); + this.tmplInsertionModeStackTop--; + this.currentTmplInsertionMode = this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]; + } + + //Foster parenting + _isElementCausesFosterParenting(element) { + const tn = this.treeAdapter.getTagName(element); + + return tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR; + } + + _shouldFosterParentOnInsertion() { + return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.current); + } + + _findFosterParentingLocation() { + const location = { + parent: null, + beforeElement: null + }; + + for (let i = this.openElements.stackTop; i >= 0; i--) { + const openElement = this.openElements.items[i]; + const tn = this.treeAdapter.getTagName(openElement); + const ns = this.treeAdapter.getNamespaceURI(openElement); + + if (tn === $.TEMPLATE && ns === NS.HTML) { + location.parent = this.treeAdapter.getTemplateContent(openElement); + break; + } else if (tn === $.TABLE) { + location.parent = this.treeAdapter.getParentNode(openElement); + + if (location.parent) { + location.beforeElement = openElement; + } else { + location.parent = this.openElements.items[i - 1]; + } + + break; + } + } + + if (!location.parent) { + location.parent = this.openElements.items[0]; + } + + return location; + } + + _fosterParentElement(element) { + const location = this._findFosterParentingLocation(); + + if (location.beforeElement) { + this.treeAdapter.insertBefore(location.parent, element, location.beforeElement); + } else { + this.treeAdapter.appendChild(location.parent, element); + } + } + + _fosterParentText(chars) { + const location = this._findFosterParentingLocation(); + + if (location.beforeElement) { + this.treeAdapter.insertTextBefore(location.parent, chars, location.beforeElement); + } else { + this.treeAdapter.insertText(location.parent, chars); + } + } + + //Special elements + _isSpecialElement(element) { + const tn = this.treeAdapter.getTagName(element); + const ns = this.treeAdapter.getNamespaceURI(element); + + return HTML.SPECIAL_ELEMENTS[ns][tn]; + } +} + +module.exports = Parser; + +//Adoption agency algorithm +//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency) +//------------------------------------------------------------------ + +//Steps 5-8 of the algorithm +function aaObtainFormattingElementEntry(p, token) { + let formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName); + + if (formattingElementEntry) { + if (!p.openElements.contains(formattingElementEntry.element)) { + p.activeFormattingElements.removeEntry(formattingElementEntry); + formattingElementEntry = null; + } else if (!p.openElements.hasInScope(token.tagName)) { + formattingElementEntry = null; + } + } else { + genericEndTagInBody(p, token); + } + + return formattingElementEntry; +} + +//Steps 9 and 10 of the algorithm +function aaObtainFurthestBlock(p, formattingElementEntry) { + let furthestBlock = null; + + for (let i = p.openElements.stackTop; i >= 0; i--) { + const element = p.openElements.items[i]; + + if (element === formattingElementEntry.element) { + break; + } + + if (p._isSpecialElement(element)) { + furthestBlock = element; + } + } + + if (!furthestBlock) { + p.openElements.popUntilElementPopped(formattingElementEntry.element); + p.activeFormattingElements.removeEntry(formattingElementEntry); + } + + return furthestBlock; +} + +//Step 13 of the algorithm +function aaInnerLoop(p, furthestBlock, formattingElement) { + let lastElement = furthestBlock; + let nextElement = p.openElements.getCommonAncestor(furthestBlock); + + for (let i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) { + //NOTE: store next element for the next loop iteration (it may be deleted from the stack by step 9.5) + nextElement = p.openElements.getCommonAncestor(element); + + const elementEntry = p.activeFormattingElements.getElementEntry(element); + const counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER; + const shouldRemoveFromOpenElements = !elementEntry || counterOverflow; + + if (shouldRemoveFromOpenElements) { + if (counterOverflow) { + p.activeFormattingElements.removeEntry(elementEntry); + } + + p.openElements.remove(element); + } else { + element = aaRecreateElementFromEntry(p, elementEntry); + + if (lastElement === furthestBlock) { + p.activeFormattingElements.bookmark = elementEntry; + } + + p.treeAdapter.detachNode(lastElement); + p.treeAdapter.appendChild(element, lastElement); + lastElement = element; + } + } + + return lastElement; +} + +//Step 13.7 of the algorithm +function aaRecreateElementFromEntry(p, elementEntry) { + const ns = p.treeAdapter.getNamespaceURI(elementEntry.element); + const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs); + + p.openElements.replace(elementEntry.element, newElement); + elementEntry.element = newElement; + + return newElement; +} + +//Step 14 of the algorithm +function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) { + if (p._isElementCausesFosterParenting(commonAncestor)) { + p._fosterParentElement(lastElement); + } else { + const tn = p.treeAdapter.getTagName(commonAncestor); + const ns = p.treeAdapter.getNamespaceURI(commonAncestor); + + if (tn === $.TEMPLATE && ns === NS.HTML) { + commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor); + } + + p.treeAdapter.appendChild(commonAncestor, lastElement); + } +} + +//Steps 15-19 of the algorithm +function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) { + const ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element); + const token = formattingElementEntry.token; + const newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs); + + p._adoptNodes(furthestBlock, newElement); + p.treeAdapter.appendChild(furthestBlock, newElement); + + p.activeFormattingElements.insertElementAfterBookmark(newElement, formattingElementEntry.token); + p.activeFormattingElements.removeEntry(formattingElementEntry); + + p.openElements.remove(formattingElementEntry.element); + p.openElements.insertAfter(furthestBlock, newElement); +} + +//Algorithm entry point +function callAdoptionAgency(p, token) { + let formattingElementEntry; + + for (let i = 0; i < AA_OUTER_LOOP_ITER; i++) { + formattingElementEntry = aaObtainFormattingElementEntry(p, token, formattingElementEntry); + + if (!formattingElementEntry) { + break; + } + + const furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry); + + if (!furthestBlock) { + break; + } + + p.activeFormattingElements.bookmark = formattingElementEntry; + + const lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element); + const commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element); + + p.treeAdapter.detachNode(lastElement); + aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement); + aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry); + } +} + +//Generic token handlers +//------------------------------------------------------------------ +function ignoreToken() { + //NOTE: do nothing =) +} + +function misplacedDoctype(p) { + p._err(ERR.misplacedDoctype); +} + +function appendComment(p, token) { + p._appendCommentNode(token, p.openElements.currentTmplContent || p.openElements.current); +} + +function appendCommentToRootHtmlElement(p, token) { + p._appendCommentNode(token, p.openElements.items[0]); +} + +function appendCommentToDocument(p, token) { + p._appendCommentNode(token, p.document); +} + +function insertCharacters(p, token) { + p._insertCharacters(token); +} + +function stopParsing(p) { + p.stopped = true; +} + +// The "initial" insertion mode +//------------------------------------------------------------------ +function doctypeInInitialMode(p, token) { + p._setDocumentType(token); + + const mode = token.forceQuirks ? HTML.DOCUMENT_MODE.QUIRKS : doctype.getDocumentMode(token); + + if (!doctype.isConforming(token)) { + p._err(ERR.nonConformingDoctype); + } + + p.treeAdapter.setDocumentMode(p.document, mode); + + p.insertionMode = BEFORE_HTML_MODE; +} + +function tokenInInitialMode(p, token) { + p._err(ERR.missingDoctype, { beforeToken: true }); + p.treeAdapter.setDocumentMode(p.document, HTML.DOCUMENT_MODE.QUIRKS); + p.insertionMode = BEFORE_HTML_MODE; + p._processToken(token); +} + +// The "before html" insertion mode +//------------------------------------------------------------------ +function startTagBeforeHtml(p, token) { + if (token.tagName === $.HTML) { + p._insertElement(token, NS.HTML); + p.insertionMode = BEFORE_HEAD_MODE; + } else { + tokenBeforeHtml(p, token); + } +} + +function endTagBeforeHtml(p, token) { + const tn = token.tagName; + + if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) { + tokenBeforeHtml(p, token); + } +} + +function tokenBeforeHtml(p, token) { + p._insertFakeRootElement(); + p.insertionMode = BEFORE_HEAD_MODE; + p._processToken(token); +} + +// The "before head" insertion mode +//------------------------------------------------------------------ +function startTagBeforeHead(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.HEAD) { + p._insertElement(token, NS.HTML); + p.headElement = p.openElements.current; + p.insertionMode = IN_HEAD_MODE; + } else { + tokenBeforeHead(p, token); + } +} + +function endTagBeforeHead(p, token) { + const tn = token.tagName; + + if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) { + tokenBeforeHead(p, token); + } else { + p._err(ERR.endTagWithoutMatchingOpenElement); + } +} + +function tokenBeforeHead(p, token) { + p._insertFakeElement($.HEAD); + p.headElement = p.openElements.current; + p.insertionMode = IN_HEAD_MODE; + p._processToken(token); +} + +// The "in head" insertion mode +//------------------------------------------------------------------ +function startTagInHead(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META) { + p._appendElement(token, NS.HTML); + token.ackSelfClosing = true; + } else if (tn === $.TITLE) { + p._switchToTextParsing(token, Tokenizer.MODE.RCDATA); + } else if (tn === $.NOSCRIPT) { + if (p.options.scriptingEnabled) { + p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); + } else { + p._insertElement(token, NS.HTML); + p.insertionMode = IN_HEAD_NO_SCRIPT_MODE; + } + } else if (tn === $.NOFRAMES || tn === $.STYLE) { + p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); + } else if (tn === $.SCRIPT) { + p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA); + } else if (tn === $.TEMPLATE) { + p._insertTemplate(token, NS.HTML); + p.activeFormattingElements.insertMarker(); + p.framesetOk = false; + p.insertionMode = IN_TEMPLATE_MODE; + p._pushTmplInsertionMode(IN_TEMPLATE_MODE); + } else if (tn === $.HEAD) { + p._err(ERR.misplacedStartTagForHeadElement); + } else { + tokenInHead(p, token); + } +} + +function endTagInHead(p, token) { + const tn = token.tagName; + + if (tn === $.HEAD) { + p.openElements.pop(); + p.insertionMode = AFTER_HEAD_MODE; + } else if (tn === $.BODY || tn === $.BR || tn === $.HTML) { + tokenInHead(p, token); + } else if (tn === $.TEMPLATE) { + if (p.openElements.tmplCount > 0) { + p.openElements.generateImpliedEndTagsThoroughly(); + + if (p.openElements.currentTagName !== $.TEMPLATE) { + p._err(ERR.closingOfElementWithOpenChildElements); + } + + p.openElements.popUntilTagNamePopped($.TEMPLATE); + p.activeFormattingElements.clearToLastMarker(); + p._popTmplInsertionMode(); + p._resetInsertionMode(); + } else { + p._err(ERR.endTagWithoutMatchingOpenElement); + } + } else { + p._err(ERR.endTagWithoutMatchingOpenElement); + } +} + +function tokenInHead(p, token) { + p.openElements.pop(); + p.insertionMode = AFTER_HEAD_MODE; + p._processToken(token); +} + +// The "in head no script" insertion mode +//------------------------------------------------------------------ +function startTagInHeadNoScript(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if ( + tn === $.BASEFONT || + tn === $.BGSOUND || + tn === $.HEAD || + tn === $.LINK || + tn === $.META || + tn === $.NOFRAMES || + tn === $.STYLE + ) { + startTagInHead(p, token); + } else if (tn === $.NOSCRIPT) { + p._err(ERR.nestedNoscriptInHead); + } else { + tokenInHeadNoScript(p, token); + } +} + +function endTagInHeadNoScript(p, token) { + const tn = token.tagName; + + if (tn === $.NOSCRIPT) { + p.openElements.pop(); + p.insertionMode = IN_HEAD_MODE; + } else if (tn === $.BR) { + tokenInHeadNoScript(p, token); + } else { + p._err(ERR.endTagWithoutMatchingOpenElement); + } +} + +function tokenInHeadNoScript(p, token) { + const errCode = + token.type === Tokenizer.EOF_TOKEN ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead; + + p._err(errCode); + p.openElements.pop(); + p.insertionMode = IN_HEAD_MODE; + p._processToken(token); +} + +// The "after head" insertion mode +//------------------------------------------------------------------ +function startTagAfterHead(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.BODY) { + p._insertElement(token, NS.HTML); + p.framesetOk = false; + p.insertionMode = IN_BODY_MODE; + } else if (tn === $.FRAMESET) { + p._insertElement(token, NS.HTML); + p.insertionMode = IN_FRAMESET_MODE; + } else if ( + tn === $.BASE || + tn === $.BASEFONT || + tn === $.BGSOUND || + tn === $.LINK || + tn === $.META || + tn === $.NOFRAMES || + tn === $.SCRIPT || + tn === $.STYLE || + tn === $.TEMPLATE || + tn === $.TITLE + ) { + p._err(ERR.abandonedHeadElementChild); + p.openElements.push(p.headElement); + startTagInHead(p, token); + p.openElements.remove(p.headElement); + } else if (tn === $.HEAD) { + p._err(ERR.misplacedStartTagForHeadElement); + } else { + tokenAfterHead(p, token); + } +} + +function endTagAfterHead(p, token) { + const tn = token.tagName; + + if (tn === $.BODY || tn === $.HTML || tn === $.BR) { + tokenAfterHead(p, token); + } else if (tn === $.TEMPLATE) { + endTagInHead(p, token); + } else { + p._err(ERR.endTagWithoutMatchingOpenElement); + } +} + +function tokenAfterHead(p, token) { + p._insertFakeElement($.BODY); + p.insertionMode = IN_BODY_MODE; + p._processToken(token); +} + +// The "in body" insertion mode +//------------------------------------------------------------------ +function whitespaceCharacterInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertCharacters(token); +} + +function characterInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertCharacters(token); + p.framesetOk = false; +} + +function htmlStartTagInBody(p, token) { + if (p.openElements.tmplCount === 0) { + p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs); + } +} + +function bodyStartTagInBody(p, token) { + const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); + + if (bodyElement && p.openElements.tmplCount === 0) { + p.framesetOk = false; + p.treeAdapter.adoptAttributes(bodyElement, token.attrs); + } +} + +function framesetStartTagInBody(p, token) { + const bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); + + if (p.framesetOk && bodyElement) { + p.treeAdapter.detachNode(bodyElement); + p.openElements.popAllUpToHtmlElement(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_FRAMESET_MODE; + } +} + +function addressStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); +} + +function numberedHeaderStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + const tn = p.openElements.currentTagName; + + if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) { + p.openElements.pop(); + } + + p._insertElement(token, NS.HTML); +} + +function preStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); + //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move + //on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.) + p.skipNextNewLine = true; + p.framesetOk = false; +} + +function formStartTagInBody(p, token) { + const inTemplate = p.openElements.tmplCount > 0; + + if (!p.formElement || inTemplate) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); + + if (!inTemplate) { + p.formElement = p.openElements.current; + } + } +} + +function listItemStartTagInBody(p, token) { + p.framesetOk = false; + + const tn = token.tagName; + + for (let i = p.openElements.stackTop; i >= 0; i--) { + const element = p.openElements.items[i]; + const elementTn = p.treeAdapter.getTagName(element); + let closeTn = null; + + if (tn === $.LI && elementTn === $.LI) { + closeTn = $.LI; + } else if ((tn === $.DD || tn === $.DT) && (elementTn === $.DD || elementTn === $.DT)) { + closeTn = elementTn; + } + + if (closeTn) { + p.openElements.generateImpliedEndTagsWithExclusion(closeTn); + p.openElements.popUntilTagNamePopped(closeTn); + break; + } + + if (elementTn !== $.ADDRESS && elementTn !== $.DIV && elementTn !== $.P && p._isSpecialElement(element)) { + break; + } + } + + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); +} + +function plaintextStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); + p.tokenizer.state = Tokenizer.MODE.PLAINTEXT; +} + +function buttonStartTagInBody(p, token) { + if (p.openElements.hasInScope($.BUTTON)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped($.BUTTON); + } + + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); + p.framesetOk = false; +} + +function aStartTagInBody(p, token) { + const activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName($.A); + + if (activeElementEntry) { + callAdoptionAgency(p, token); + p.openElements.remove(activeElementEntry.element); + p.activeFormattingElements.removeEntry(activeElementEntry); + } + + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); + p.activeFormattingElements.pushElement(p.openElements.current, token); +} + +function bStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); + p.activeFormattingElements.pushElement(p.openElements.current, token); +} + +function nobrStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + + if (p.openElements.hasInScope($.NOBR)) { + callAdoptionAgency(p, token); + p._reconstructActiveFormattingElements(); + } + + p._insertElement(token, NS.HTML); + p.activeFormattingElements.pushElement(p.openElements.current, token); +} + +function appletStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); + p.activeFormattingElements.insertMarker(); + p.framesetOk = false; +} + +function tableStartTagInBody(p, token) { + if ( + p.treeAdapter.getDocumentMode(p.document) !== HTML.DOCUMENT_MODE.QUIRKS && + p.openElements.hasInButtonScope($.P) + ) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); + p.framesetOk = false; + p.insertionMode = IN_TABLE_MODE; +} + +function areaStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._appendElement(token, NS.HTML); + p.framesetOk = false; + token.ackSelfClosing = true; +} + +function inputStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._appendElement(token, NS.HTML); + + const inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); + + if (!inputType || inputType.toLowerCase() !== HIDDEN_INPUT_TYPE) { + p.framesetOk = false; + } + + token.ackSelfClosing = true; +} + +function paramStartTagInBody(p, token) { + p._appendElement(token, NS.HTML); + token.ackSelfClosing = true; +} + +function hrStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._appendElement(token, NS.HTML); + p.framesetOk = false; + token.ackSelfClosing = true; +} + +function imageStartTagInBody(p, token) { + token.tagName = $.IMG; + areaStartTagInBody(p, token); +} + +function textareaStartTagInBody(p, token) { + p._insertElement(token, NS.HTML); + //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move + //on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) + p.skipNextNewLine = true; + p.tokenizer.state = Tokenizer.MODE.RCDATA; + p.originalInsertionMode = p.insertionMode; + p.framesetOk = false; + p.insertionMode = TEXT_MODE; +} + +function xmpStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._reconstructActiveFormattingElements(); + p.framesetOk = false; + p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); +} + +function iframeStartTagInBody(p, token) { + p.framesetOk = false; + p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); +} + +//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse +// as a rawtext. +function noembedStartTagInBody(p, token) { + p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); +} + +function selectStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); + p.framesetOk = false; + + if ( + p.insertionMode === IN_TABLE_MODE || + p.insertionMode === IN_CAPTION_MODE || + p.insertionMode === IN_TABLE_BODY_MODE || + p.insertionMode === IN_ROW_MODE || + p.insertionMode === IN_CELL_MODE + ) { + p.insertionMode = IN_SELECT_IN_TABLE_MODE; + } else { + p.insertionMode = IN_SELECT_MODE; + } +} + +function optgroupStartTagInBody(p, token) { + if (p.openElements.currentTagName === $.OPTION) { + p.openElements.pop(); + } + + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); +} + +function rbStartTagInBody(p, token) { + if (p.openElements.hasInScope($.RUBY)) { + p.openElements.generateImpliedEndTags(); + } + + p._insertElement(token, NS.HTML); +} + +function rtStartTagInBody(p, token) { + if (p.openElements.hasInScope($.RUBY)) { + p.openElements.generateImpliedEndTagsWithExclusion($.RTC); + } + + p._insertElement(token, NS.HTML); +} + +function menuStartTagInBody(p, token) { + if (p.openElements.hasInButtonScope($.P)) { + p._closePElement(); + } + + p._insertElement(token, NS.HTML); +} + +function mathStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + + foreignContent.adjustTokenMathMLAttrs(token); + foreignContent.adjustTokenXMLAttrs(token); + + if (token.selfClosing) { + p._appendElement(token, NS.MATHML); + } else { + p._insertElement(token, NS.MATHML); + } + + token.ackSelfClosing = true; +} + +function svgStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + + foreignContent.adjustTokenSVGAttrs(token); + foreignContent.adjustTokenXMLAttrs(token); + + if (token.selfClosing) { + p._appendElement(token, NS.SVG); + } else { + p._insertElement(token, NS.SVG); + } + + token.ackSelfClosing = true; +} + +function genericStartTagInBody(p, token) { + p._reconstructActiveFormattingElements(); + p._insertElement(token, NS.HTML); +} + +//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. +//It's faster than using dictionary. +function startTagInBody(p, token) { + const tn = token.tagName; + + switch (tn.length) { + case 1: + if (tn === $.I || tn === $.S || tn === $.B || tn === $.U) { + bStartTagInBody(p, token); + } else if (tn === $.P) { + addressStartTagInBody(p, token); + } else if (tn === $.A) { + aStartTagInBody(p, token); + } else { + genericStartTagInBody(p, token); + } + + break; + + case 2: + if (tn === $.DL || tn === $.OL || tn === $.UL) { + addressStartTagInBody(p, token); + } else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) { + numberedHeaderStartTagInBody(p, token); + } else if (tn === $.LI || tn === $.DD || tn === $.DT) { + listItemStartTagInBody(p, token); + } else if (tn === $.EM || tn === $.TT) { + bStartTagInBody(p, token); + } else if (tn === $.BR) { + areaStartTagInBody(p, token); + } else if (tn === $.HR) { + hrStartTagInBody(p, token); + } else if (tn === $.RB) { + rbStartTagInBody(p, token); + } else if (tn === $.RT || tn === $.RP) { + rtStartTagInBody(p, token); + } else if (tn !== $.TH && tn !== $.TD && tn !== $.TR) { + genericStartTagInBody(p, token); + } + + break; + + case 3: + if (tn === $.DIV || tn === $.DIR || tn === $.NAV) { + addressStartTagInBody(p, token); + } else if (tn === $.PRE) { + preStartTagInBody(p, token); + } else if (tn === $.BIG) { + bStartTagInBody(p, token); + } else if (tn === $.IMG || tn === $.WBR) { + areaStartTagInBody(p, token); + } else if (tn === $.XMP) { + xmpStartTagInBody(p, token); + } else if (tn === $.SVG) { + svgStartTagInBody(p, token); + } else if (tn === $.RTC) { + rbStartTagInBody(p, token); + } else if (tn !== $.COL) { + genericStartTagInBody(p, token); + } + + break; + + case 4: + if (tn === $.HTML) { + htmlStartTagInBody(p, token); + } else if (tn === $.BASE || tn === $.LINK || tn === $.META) { + startTagInHead(p, token); + } else if (tn === $.BODY) { + bodyStartTagInBody(p, token); + } else if (tn === $.MAIN || tn === $.MENU) { + addressStartTagInBody(p, token); + } else if (tn === $.FORM) { + formStartTagInBody(p, token); + } else if (tn === $.CODE || tn === $.FONT) { + bStartTagInBody(p, token); + } else if (tn === $.NOBR) { + nobrStartTagInBody(p, token); + } else if (tn === $.AREA) { + areaStartTagInBody(p, token); + } else if (tn === $.MATH) { + mathStartTagInBody(p, token); + } else if (tn === $.MENU) { + menuStartTagInBody(p, token); + } else if (tn !== $.HEAD) { + genericStartTagInBody(p, token); + } + + break; + + case 5: + if (tn === $.STYLE || tn === $.TITLE) { + startTagInHead(p, token); + } else if (tn === $.ASIDE) { + addressStartTagInBody(p, token); + } else if (tn === $.SMALL) { + bStartTagInBody(p, token); + } else if (tn === $.TABLE) { + tableStartTagInBody(p, token); + } else if (tn === $.EMBED) { + areaStartTagInBody(p, token); + } else if (tn === $.INPUT) { + inputStartTagInBody(p, token); + } else if (tn === $.PARAM || tn === $.TRACK) { + paramStartTagInBody(p, token); + } else if (tn === $.IMAGE) { + imageStartTagInBody(p, token); + } else if (tn !== $.FRAME && tn !== $.TBODY && tn !== $.TFOOT && tn !== $.THEAD) { + genericStartTagInBody(p, token); + } + + break; + + case 6: + if (tn === $.SCRIPT) { + startTagInHead(p, token); + } else if ( + tn === $.CENTER || + tn === $.FIGURE || + tn === $.FOOTER || + tn === $.HEADER || + tn === $.HGROUP || + tn === $.DIALOG + ) { + addressStartTagInBody(p, token); + } else if (tn === $.BUTTON) { + buttonStartTagInBody(p, token); + } else if (tn === $.STRIKE || tn === $.STRONG) { + bStartTagInBody(p, token); + } else if (tn === $.APPLET || tn === $.OBJECT) { + appletStartTagInBody(p, token); + } else if (tn === $.KEYGEN) { + areaStartTagInBody(p, token); + } else if (tn === $.SOURCE) { + paramStartTagInBody(p, token); + } else if (tn === $.IFRAME) { + iframeStartTagInBody(p, token); + } else if (tn === $.SELECT) { + selectStartTagInBody(p, token); + } else if (tn === $.OPTION) { + optgroupStartTagInBody(p, token); + } else { + genericStartTagInBody(p, token); + } + + break; + + case 7: + if (tn === $.BGSOUND) { + startTagInHead(p, token); + } else if ( + tn === $.DETAILS || + tn === $.ADDRESS || + tn === $.ARTICLE || + tn === $.SECTION || + tn === $.SUMMARY + ) { + addressStartTagInBody(p, token); + } else if (tn === $.LISTING) { + preStartTagInBody(p, token); + } else if (tn === $.MARQUEE) { + appletStartTagInBody(p, token); + } else if (tn === $.NOEMBED) { + noembedStartTagInBody(p, token); + } else if (tn !== $.CAPTION) { + genericStartTagInBody(p, token); + } + + break; + + case 8: + if (tn === $.BASEFONT) { + startTagInHead(p, token); + } else if (tn === $.FRAMESET) { + framesetStartTagInBody(p, token); + } else if (tn === $.FIELDSET) { + addressStartTagInBody(p, token); + } else if (tn === $.TEXTAREA) { + textareaStartTagInBody(p, token); + } else if (tn === $.TEMPLATE) { + startTagInHead(p, token); + } else if (tn === $.NOSCRIPT) { + if (p.options.scriptingEnabled) { + noembedStartTagInBody(p, token); + } else { + genericStartTagInBody(p, token); + } + } else if (tn === $.OPTGROUP) { + optgroupStartTagInBody(p, token); + } else if (tn !== $.COLGROUP) { + genericStartTagInBody(p, token); + } + + break; + + case 9: + if (tn === $.PLAINTEXT) { + plaintextStartTagInBody(p, token); + } else { + genericStartTagInBody(p, token); + } + + break; + + case 10: + if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) { + addressStartTagInBody(p, token); + } else { + genericStartTagInBody(p, token); + } + + break; + + default: + genericStartTagInBody(p, token); + } +} + +function bodyEndTagInBody(p) { + if (p.openElements.hasInScope($.BODY)) { + p.insertionMode = AFTER_BODY_MODE; + } +} + +function htmlEndTagInBody(p, token) { + if (p.openElements.hasInScope($.BODY)) { + p.insertionMode = AFTER_BODY_MODE; + p._processToken(token); + } +} + +function addressEndTagInBody(p, token) { + const tn = token.tagName; + + if (p.openElements.hasInScope(tn)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped(tn); + } +} + +function formEndTagInBody(p) { + const inTemplate = p.openElements.tmplCount > 0; + const formElement = p.formElement; + + if (!inTemplate) { + p.formElement = null; + } + + if ((formElement || inTemplate) && p.openElements.hasInScope($.FORM)) { + p.openElements.generateImpliedEndTags(); + + if (inTemplate) { + p.openElements.popUntilTagNamePopped($.FORM); + } else { + p.openElements.remove(formElement); + } + } +} + +function pEndTagInBody(p) { + if (!p.openElements.hasInButtonScope($.P)) { + p._insertFakeElement($.P); + } + + p._closePElement(); +} + +function liEndTagInBody(p) { + if (p.openElements.hasInListItemScope($.LI)) { + p.openElements.generateImpliedEndTagsWithExclusion($.LI); + p.openElements.popUntilTagNamePopped($.LI); + } +} + +function ddEndTagInBody(p, token) { + const tn = token.tagName; + + if (p.openElements.hasInScope(tn)) { + p.openElements.generateImpliedEndTagsWithExclusion(tn); + p.openElements.popUntilTagNamePopped(tn); + } +} + +function numberedHeaderEndTagInBody(p) { + if (p.openElements.hasNumberedHeaderInScope()) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilNumberedHeaderPopped(); + } +} + +function appletEndTagInBody(p, token) { + const tn = token.tagName; + + if (p.openElements.hasInScope(tn)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped(tn); + p.activeFormattingElements.clearToLastMarker(); + } +} + +function brEndTagInBody(p) { + p._reconstructActiveFormattingElements(); + p._insertFakeElement($.BR); + p.openElements.pop(); + p.framesetOk = false; +} + +function genericEndTagInBody(p, token) { + const tn = token.tagName; + + for (let i = p.openElements.stackTop; i > 0; i--) { + const element = p.openElements.items[i]; + + if (p.treeAdapter.getTagName(element) === tn) { + p.openElements.generateImpliedEndTagsWithExclusion(tn); + p.openElements.popUntilElementPopped(element); + break; + } + + if (p._isSpecialElement(element)) { + break; + } + } +} + +//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. +//It's faster than using dictionary. +function endTagInBody(p, token) { + const tn = token.tagName; + + switch (tn.length) { + case 1: + if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn === $.U) { + callAdoptionAgency(p, token); + } else if (tn === $.P) { + pEndTagInBody(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 2: + if (tn === $.DL || tn === $.UL || tn === $.OL) { + addressEndTagInBody(p, token); + } else if (tn === $.LI) { + liEndTagInBody(p, token); + } else if (tn === $.DD || tn === $.DT) { + ddEndTagInBody(p, token); + } else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) { + numberedHeaderEndTagInBody(p, token); + } else if (tn === $.BR) { + brEndTagInBody(p, token); + } else if (tn === $.EM || tn === $.TT) { + callAdoptionAgency(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 3: + if (tn === $.BIG) { + callAdoptionAgency(p, token); + } else if (tn === $.DIR || tn === $.DIV || tn === $.NAV || tn === $.PRE) { + addressEndTagInBody(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 4: + if (tn === $.BODY) { + bodyEndTagInBody(p, token); + } else if (tn === $.HTML) { + htmlEndTagInBody(p, token); + } else if (tn === $.FORM) { + formEndTagInBody(p, token); + } else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) { + callAdoptionAgency(p, token); + } else if (tn === $.MAIN || tn === $.MENU) { + addressEndTagInBody(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 5: + if (tn === $.ASIDE) { + addressEndTagInBody(p, token); + } else if (tn === $.SMALL) { + callAdoptionAgency(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 6: + if ( + tn === $.CENTER || + tn === $.FIGURE || + tn === $.FOOTER || + tn === $.HEADER || + tn === $.HGROUP || + tn === $.DIALOG + ) { + addressEndTagInBody(p, token); + } else if (tn === $.APPLET || tn === $.OBJECT) { + appletEndTagInBody(p, token); + } else if (tn === $.STRIKE || tn === $.STRONG) { + callAdoptionAgency(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 7: + if ( + tn === $.ADDRESS || + tn === $.ARTICLE || + tn === $.DETAILS || + tn === $.SECTION || + tn === $.SUMMARY || + tn === $.LISTING + ) { + addressEndTagInBody(p, token); + } else if (tn === $.MARQUEE) { + appletEndTagInBody(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 8: + if (tn === $.FIELDSET) { + addressEndTagInBody(p, token); + } else if (tn === $.TEMPLATE) { + endTagInHead(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + case 10: + if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) { + addressEndTagInBody(p, token); + } else { + genericEndTagInBody(p, token); + } + + break; + + default: + genericEndTagInBody(p, token); + } +} + +function eofInBody(p, token) { + if (p.tmplInsertionModeStackTop > -1) { + eofInTemplate(p, token); + } else { + p.stopped = true; + } +} + +// The "text" insertion mode +//------------------------------------------------------------------ +function endTagInText(p, token) { + if (token.tagName === $.SCRIPT) { + p.pendingScript = p.openElements.current; + } + + p.openElements.pop(); + p.insertionMode = p.originalInsertionMode; +} + +function eofInText(p, token) { + p._err(ERR.eofInElementThatCanContainOnlyText); + p.openElements.pop(); + p.insertionMode = p.originalInsertionMode; + p._processToken(token); +} + +// The "in table" insertion mode +//------------------------------------------------------------------ +function characterInTable(p, token) { + const curTn = p.openElements.currentTagName; + + if (curTn === $.TABLE || curTn === $.TBODY || curTn === $.TFOOT || curTn === $.THEAD || curTn === $.TR) { + p.pendingCharacterTokens = []; + p.hasNonWhitespacePendingCharacterToken = false; + p.originalInsertionMode = p.insertionMode; + p.insertionMode = IN_TABLE_TEXT_MODE; + p._processToken(token); + } else { + tokenInTable(p, token); + } +} + +function captionStartTagInTable(p, token) { + p.openElements.clearBackToTableContext(); + p.activeFormattingElements.insertMarker(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_CAPTION_MODE; +} + +function colgroupStartTagInTable(p, token) { + p.openElements.clearBackToTableContext(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_COLUMN_GROUP_MODE; +} + +function colStartTagInTable(p, token) { + p.openElements.clearBackToTableContext(); + p._insertFakeElement($.COLGROUP); + p.insertionMode = IN_COLUMN_GROUP_MODE; + p._processToken(token); +} + +function tbodyStartTagInTable(p, token) { + p.openElements.clearBackToTableContext(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_TABLE_BODY_MODE; +} + +function tdStartTagInTable(p, token) { + p.openElements.clearBackToTableContext(); + p._insertFakeElement($.TBODY); + p.insertionMode = IN_TABLE_BODY_MODE; + p._processToken(token); +} + +function tableStartTagInTable(p, token) { + if (p.openElements.hasInTableScope($.TABLE)) { + p.openElements.popUntilTagNamePopped($.TABLE); + p._resetInsertionMode(); + p._processToken(token); + } +} + +function inputStartTagInTable(p, token) { + const inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); + + if (inputType && inputType.toLowerCase() === HIDDEN_INPUT_TYPE) { + p._appendElement(token, NS.HTML); + } else { + tokenInTable(p, token); + } + + token.ackSelfClosing = true; +} + +function formStartTagInTable(p, token) { + if (!p.formElement && p.openElements.tmplCount === 0) { + p._insertElement(token, NS.HTML); + p.formElement = p.openElements.current; + p.openElements.pop(); + } +} + +function startTagInTable(p, token) { + const tn = token.tagName; + + switch (tn.length) { + case 2: + if (tn === $.TD || tn === $.TH || tn === $.TR) { + tdStartTagInTable(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 3: + if (tn === $.COL) { + colStartTagInTable(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 4: + if (tn === $.FORM) { + formStartTagInTable(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 5: + if (tn === $.TABLE) { + tableStartTagInTable(p, token); + } else if (tn === $.STYLE) { + startTagInHead(p, token); + } else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { + tbodyStartTagInTable(p, token); + } else if (tn === $.INPUT) { + inputStartTagInTable(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 6: + if (tn === $.SCRIPT) { + startTagInHead(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 7: + if (tn === $.CAPTION) { + captionStartTagInTable(p, token); + } else { + tokenInTable(p, token); + } + + break; + + case 8: + if (tn === $.COLGROUP) { + colgroupStartTagInTable(p, token); + } else if (tn === $.TEMPLATE) { + startTagInHead(p, token); + } else { + tokenInTable(p, token); + } + + break; + + default: + tokenInTable(p, token); + } +} + +function endTagInTable(p, token) { + const tn = token.tagName; + + if (tn === $.TABLE) { + if (p.openElements.hasInTableScope($.TABLE)) { + p.openElements.popUntilTagNamePopped($.TABLE); + p._resetInsertionMode(); + } + } else if (tn === $.TEMPLATE) { + endTagInHead(p, token); + } else if ( + tn !== $.BODY && + tn !== $.CAPTION && + tn !== $.COL && + tn !== $.COLGROUP && + tn !== $.HTML && + tn !== $.TBODY && + tn !== $.TD && + tn !== $.TFOOT && + tn !== $.TH && + tn !== $.THEAD && + tn !== $.TR + ) { + tokenInTable(p, token); + } +} + +function tokenInTable(p, token) { + const savedFosterParentingState = p.fosterParentingEnabled; + + p.fosterParentingEnabled = true; + p._processTokenInBodyMode(token); + p.fosterParentingEnabled = savedFosterParentingState; +} + +// The "in table text" insertion mode +//------------------------------------------------------------------ +function whitespaceCharacterInTableText(p, token) { + p.pendingCharacterTokens.push(token); +} + +function characterInTableText(p, token) { + p.pendingCharacterTokens.push(token); + p.hasNonWhitespacePendingCharacterToken = true; +} + +function tokenInTableText(p, token) { + let i = 0; + + if (p.hasNonWhitespacePendingCharacterToken) { + for (; i < p.pendingCharacterTokens.length; i++) { + tokenInTable(p, p.pendingCharacterTokens[i]); + } + } else { + for (; i < p.pendingCharacterTokens.length; i++) { + p._insertCharacters(p.pendingCharacterTokens[i]); + } + } + + p.insertionMode = p.originalInsertionMode; + p._processToken(token); +} + +// The "in caption" insertion mode +//------------------------------------------------------------------ +function startTagInCaption(p, token) { + const tn = token.tagName; + + if ( + tn === $.CAPTION || + tn === $.COL || + tn === $.COLGROUP || + tn === $.TBODY || + tn === $.TD || + tn === $.TFOOT || + tn === $.TH || + tn === $.THEAD || + tn === $.TR + ) { + if (p.openElements.hasInTableScope($.CAPTION)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped($.CAPTION); + p.activeFormattingElements.clearToLastMarker(); + p.insertionMode = IN_TABLE_MODE; + p._processToken(token); + } + } else { + startTagInBody(p, token); + } +} + +function endTagInCaption(p, token) { + const tn = token.tagName; + + if (tn === $.CAPTION || tn === $.TABLE) { + if (p.openElements.hasInTableScope($.CAPTION)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped($.CAPTION); + p.activeFormattingElements.clearToLastMarker(); + p.insertionMode = IN_TABLE_MODE; + + if (tn === $.TABLE) { + p._processToken(token); + } + } + } else if ( + tn !== $.BODY && + tn !== $.COL && + tn !== $.COLGROUP && + tn !== $.HTML && + tn !== $.TBODY && + tn !== $.TD && + tn !== $.TFOOT && + tn !== $.TH && + tn !== $.THEAD && + tn !== $.TR + ) { + endTagInBody(p, token); + } +} + +// The "in column group" insertion mode +//------------------------------------------------------------------ +function startTagInColumnGroup(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.COL) { + p._appendElement(token, NS.HTML); + token.ackSelfClosing = true; + } else if (tn === $.TEMPLATE) { + startTagInHead(p, token); + } else { + tokenInColumnGroup(p, token); + } +} + +function endTagInColumnGroup(p, token) { + const tn = token.tagName; + + if (tn === $.COLGROUP) { + if (p.openElements.currentTagName === $.COLGROUP) { + p.openElements.pop(); + p.insertionMode = IN_TABLE_MODE; + } + } else if (tn === $.TEMPLATE) { + endTagInHead(p, token); + } else if (tn !== $.COL) { + tokenInColumnGroup(p, token); + } +} + +function tokenInColumnGroup(p, token) { + if (p.openElements.currentTagName === $.COLGROUP) { + p.openElements.pop(); + p.insertionMode = IN_TABLE_MODE; + p._processToken(token); + } +} + +// The "in table body" insertion mode +//------------------------------------------------------------------ +function startTagInTableBody(p, token) { + const tn = token.tagName; + + if (tn === $.TR) { + p.openElements.clearBackToTableBodyContext(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_ROW_MODE; + } else if (tn === $.TH || tn === $.TD) { + p.openElements.clearBackToTableBodyContext(); + p._insertFakeElement($.TR); + p.insertionMode = IN_ROW_MODE; + p._processToken(token); + } else if ( + tn === $.CAPTION || + tn === $.COL || + tn === $.COLGROUP || + tn === $.TBODY || + tn === $.TFOOT || + tn === $.THEAD + ) { + if (p.openElements.hasTableBodyContextInTableScope()) { + p.openElements.clearBackToTableBodyContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_MODE; + p._processToken(token); + } + } else { + startTagInTable(p, token); + } +} + +function endTagInTableBody(p, token) { + const tn = token.tagName; + + if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { + if (p.openElements.hasInTableScope(tn)) { + p.openElements.clearBackToTableBodyContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_MODE; + } + } else if (tn === $.TABLE) { + if (p.openElements.hasTableBodyContextInTableScope()) { + p.openElements.clearBackToTableBodyContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_MODE; + p._processToken(token); + } + } else if ( + (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP) || + (tn !== $.HTML && tn !== $.TD && tn !== $.TH && tn !== $.TR) + ) { + endTagInTable(p, token); + } +} + +// The "in row" insertion mode +//------------------------------------------------------------------ +function startTagInRow(p, token) { + const tn = token.tagName; + + if (tn === $.TH || tn === $.TD) { + p.openElements.clearBackToTableRowContext(); + p._insertElement(token, NS.HTML); + p.insertionMode = IN_CELL_MODE; + p.activeFormattingElements.insertMarker(); + } else if ( + tn === $.CAPTION || + tn === $.COL || + tn === $.COLGROUP || + tn === $.TBODY || + tn === $.TFOOT || + tn === $.THEAD || + tn === $.TR + ) { + if (p.openElements.hasInTableScope($.TR)) { + p.openElements.clearBackToTableRowContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_BODY_MODE; + p._processToken(token); + } + } else { + startTagInTable(p, token); + } +} + +function endTagInRow(p, token) { + const tn = token.tagName; + + if (tn === $.TR) { + if (p.openElements.hasInTableScope($.TR)) { + p.openElements.clearBackToTableRowContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_BODY_MODE; + } + } else if (tn === $.TABLE) { + if (p.openElements.hasInTableScope($.TR)) { + p.openElements.clearBackToTableRowContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_BODY_MODE; + p._processToken(token); + } + } else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { + if (p.openElements.hasInTableScope(tn) || p.openElements.hasInTableScope($.TR)) { + p.openElements.clearBackToTableRowContext(); + p.openElements.pop(); + p.insertionMode = IN_TABLE_BODY_MODE; + p._processToken(token); + } + } else if ( + (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP) || + (tn !== $.HTML && tn !== $.TD && tn !== $.TH) + ) { + endTagInTable(p, token); + } +} + +// The "in cell" insertion mode +//------------------------------------------------------------------ +function startTagInCell(p, token) { + const tn = token.tagName; + + if ( + tn === $.CAPTION || + tn === $.COL || + tn === $.COLGROUP || + tn === $.TBODY || + tn === $.TD || + tn === $.TFOOT || + tn === $.TH || + tn === $.THEAD || + tn === $.TR + ) { + if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) { + p._closeTableCell(); + p._processToken(token); + } + } else { + startTagInBody(p, token); + } +} + +function endTagInCell(p, token) { + const tn = token.tagName; + + if (tn === $.TD || tn === $.TH) { + if (p.openElements.hasInTableScope(tn)) { + p.openElements.generateImpliedEndTags(); + p.openElements.popUntilTagNamePopped(tn); + p.activeFormattingElements.clearToLastMarker(); + p.insertionMode = IN_ROW_MODE; + } + } else if (tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) { + if (p.openElements.hasInTableScope(tn)) { + p._closeTableCell(); + p._processToken(token); + } + } else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML) { + endTagInBody(p, token); + } +} + +// The "in select" insertion mode +//------------------------------------------------------------------ +function startTagInSelect(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.OPTION) { + if (p.openElements.currentTagName === $.OPTION) { + p.openElements.pop(); + } + + p._insertElement(token, NS.HTML); + } else if (tn === $.OPTGROUP) { + if (p.openElements.currentTagName === $.OPTION) { + p.openElements.pop(); + } + + if (p.openElements.currentTagName === $.OPTGROUP) { + p.openElements.pop(); + } + + p._insertElement(token, NS.HTML); + } else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA || tn === $.SELECT) { + if (p.openElements.hasInSelectScope($.SELECT)) { + p.openElements.popUntilTagNamePopped($.SELECT); + p._resetInsertionMode(); + + if (tn !== $.SELECT) { + p._processToken(token); + } + } + } else if (tn === $.SCRIPT || tn === $.TEMPLATE) { + startTagInHead(p, token); + } +} + +function endTagInSelect(p, token) { + const tn = token.tagName; + + if (tn === $.OPTGROUP) { + const prevOpenElement = p.openElements.items[p.openElements.stackTop - 1]; + const prevOpenElementTn = prevOpenElement && p.treeAdapter.getTagName(prevOpenElement); + + if (p.openElements.currentTagName === $.OPTION && prevOpenElementTn === $.OPTGROUP) { + p.openElements.pop(); + } + + if (p.openElements.currentTagName === $.OPTGROUP) { + p.openElements.pop(); + } + } else if (tn === $.OPTION) { + if (p.openElements.currentTagName === $.OPTION) { + p.openElements.pop(); + } + } else if (tn === $.SELECT && p.openElements.hasInSelectScope($.SELECT)) { + p.openElements.popUntilTagNamePopped($.SELECT); + p._resetInsertionMode(); + } else if (tn === $.TEMPLATE) { + endTagInHead(p, token); + } +} + +//12.2.5.4.17 The "in select in table" insertion mode +//------------------------------------------------------------------ +function startTagInSelectInTable(p, token) { + const tn = token.tagName; + + if ( + tn === $.CAPTION || + tn === $.TABLE || + tn === $.TBODY || + tn === $.TFOOT || + tn === $.THEAD || + tn === $.TR || + tn === $.TD || + tn === $.TH + ) { + p.openElements.popUntilTagNamePopped($.SELECT); + p._resetInsertionMode(); + p._processToken(token); + } else { + startTagInSelect(p, token); + } +} + +function endTagInSelectInTable(p, token) { + const tn = token.tagName; + + if ( + tn === $.CAPTION || + tn === $.TABLE || + tn === $.TBODY || + tn === $.TFOOT || + tn === $.THEAD || + tn === $.TR || + tn === $.TD || + tn === $.TH + ) { + if (p.openElements.hasInTableScope(tn)) { + p.openElements.popUntilTagNamePopped($.SELECT); + p._resetInsertionMode(); + p._processToken(token); + } + } else { + endTagInSelect(p, token); + } +} + +// The "in template" insertion mode +//------------------------------------------------------------------ +function startTagInTemplate(p, token) { + const tn = token.tagName; + + if ( + tn === $.BASE || + tn === $.BASEFONT || + tn === $.BGSOUND || + tn === $.LINK || + tn === $.META || + tn === $.NOFRAMES || + tn === $.SCRIPT || + tn === $.STYLE || + tn === $.TEMPLATE || + tn === $.TITLE + ) { + startTagInHead(p, token); + } else { + const newInsertionMode = TEMPLATE_INSERTION_MODE_SWITCH_MAP[tn] || IN_BODY_MODE; + + p._popTmplInsertionMode(); + p._pushTmplInsertionMode(newInsertionMode); + p.insertionMode = newInsertionMode; + p._processToken(token); + } +} + +function endTagInTemplate(p, token) { + if (token.tagName === $.TEMPLATE) { + endTagInHead(p, token); + } +} + +function eofInTemplate(p, token) { + if (p.openElements.tmplCount > 0) { + p.openElements.popUntilTagNamePopped($.TEMPLATE); + p.activeFormattingElements.clearToLastMarker(); + p._popTmplInsertionMode(); + p._resetInsertionMode(); + p._processToken(token); + } else { + p.stopped = true; + } +} + +// The "after body" insertion mode +//------------------------------------------------------------------ +function startTagAfterBody(p, token) { + if (token.tagName === $.HTML) { + startTagInBody(p, token); + } else { + tokenAfterBody(p, token); + } +} + +function endTagAfterBody(p, token) { + if (token.tagName === $.HTML) { + if (!p.fragmentContext) { + p.insertionMode = AFTER_AFTER_BODY_MODE; + } + } else { + tokenAfterBody(p, token); + } +} + +function tokenAfterBody(p, token) { + p.insertionMode = IN_BODY_MODE; + p._processToken(token); +} + +// The "in frameset" insertion mode +//------------------------------------------------------------------ +function startTagInFrameset(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.FRAMESET) { + p._insertElement(token, NS.HTML); + } else if (tn === $.FRAME) { + p._appendElement(token, NS.HTML); + token.ackSelfClosing = true; + } else if (tn === $.NOFRAMES) { + startTagInHead(p, token); + } +} + +function endTagInFrameset(p, token) { + if (token.tagName === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) { + p.openElements.pop(); + + if (!p.fragmentContext && p.openElements.currentTagName !== $.FRAMESET) { + p.insertionMode = AFTER_FRAMESET_MODE; + } + } +} + +// The "after frameset" insertion mode +//------------------------------------------------------------------ +function startTagAfterFrameset(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.NOFRAMES) { + startTagInHead(p, token); + } +} + +function endTagAfterFrameset(p, token) { + if (token.tagName === $.HTML) { + p.insertionMode = AFTER_AFTER_FRAMESET_MODE; + } +} + +// The "after after body" insertion mode +//------------------------------------------------------------------ +function startTagAfterAfterBody(p, token) { + if (token.tagName === $.HTML) { + startTagInBody(p, token); + } else { + tokenAfterAfterBody(p, token); + } +} + +function tokenAfterAfterBody(p, token) { + p.insertionMode = IN_BODY_MODE; + p._processToken(token); +} + +// The "after after frameset" insertion mode +//------------------------------------------------------------------ +function startTagAfterAfterFrameset(p, token) { + const tn = token.tagName; + + if (tn === $.HTML) { + startTagInBody(p, token); + } else if (tn === $.NOFRAMES) { + startTagInHead(p, token); + } +} + +// The rules for parsing tokens in foreign content +//------------------------------------------------------------------ +function nullCharacterInForeignContent(p, token) { + token.chars = unicode.REPLACEMENT_CHARACTER; + p._insertCharacters(token); +} + +function characterInForeignContent(p, token) { + p._insertCharacters(token); + p.framesetOk = false; +} + +function startTagInForeignContent(p, token) { + if (foreignContent.causesExit(token) && !p.fragmentContext) { + while ( + p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && + !p._isIntegrationPoint(p.openElements.current) + ) { + p.openElements.pop(); + } + + p._processToken(token); + } else { + const current = p._getAdjustedCurrentElement(); + const currentNs = p.treeAdapter.getNamespaceURI(current); + + if (currentNs === NS.MATHML) { + foreignContent.adjustTokenMathMLAttrs(token); + } else if (currentNs === NS.SVG) { + foreignContent.adjustTokenSVGTagName(token); + foreignContent.adjustTokenSVGAttrs(token); + } + + foreignContent.adjustTokenXMLAttrs(token); + + if (token.selfClosing) { + p._appendElement(token, currentNs); + } else { + p._insertElement(token, currentNs); + } + + token.ackSelfClosing = true; + } +} + +function endTagInForeignContent(p, token) { + for (let i = p.openElements.stackTop; i > 0; i--) { + const element = p.openElements.items[i]; + + if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) { + p._processToken(token); + break; + } + + if (p.treeAdapter.getTagName(element).toLowerCase() === token.tagName) { + p.openElements.popUntilElementPopped(element); + break; + } + } +} + + +/***/ }), +/* 5 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Preprocessor = __webpack_require__(6); +const unicode = __webpack_require__(7); +const neTree = __webpack_require__(9); +const ERR = __webpack_require__(8); + +//Aliases +const $ = unicode.CODE_POINTS; +const $$ = unicode.CODE_POINT_SEQUENCES; + +//C1 Unicode control character reference replacements +const C1_CONTROLS_REFERENCE_REPLACEMENTS = { + 0x80: 0x20ac, + 0x82: 0x201a, + 0x83: 0x0192, + 0x84: 0x201e, + 0x85: 0x2026, + 0x86: 0x2020, + 0x87: 0x2021, + 0x88: 0x02c6, + 0x89: 0x2030, + 0x8a: 0x0160, + 0x8b: 0x2039, + 0x8c: 0x0152, + 0x8e: 0x017d, + 0x91: 0x2018, + 0x92: 0x2019, + 0x93: 0x201c, + 0x94: 0x201d, + 0x95: 0x2022, + 0x96: 0x2013, + 0x97: 0x2014, + 0x98: 0x02dc, + 0x99: 0x2122, + 0x9a: 0x0161, + 0x9b: 0x203a, + 0x9c: 0x0153, + 0x9e: 0x017e, + 0x9f: 0x0178 +}; + +// Named entity tree flags +const HAS_DATA_FLAG = 1 << 0; +const DATA_DUPLET_FLAG = 1 << 1; +const HAS_BRANCHES_FLAG = 1 << 2; +const MAX_BRANCH_MARKER_VALUE = HAS_DATA_FLAG | DATA_DUPLET_FLAG | HAS_BRANCHES_FLAG; + +//States +const DATA_STATE = 'DATA_STATE'; +const RCDATA_STATE = 'RCDATA_STATE'; +const RAWTEXT_STATE = 'RAWTEXT_STATE'; +const SCRIPT_DATA_STATE = 'SCRIPT_DATA_STATE'; +const PLAINTEXT_STATE = 'PLAINTEXT_STATE'; +const TAG_OPEN_STATE = 'TAG_OPEN_STATE'; +const END_TAG_OPEN_STATE = 'END_TAG_OPEN_STATE'; +const TAG_NAME_STATE = 'TAG_NAME_STATE'; +const RCDATA_LESS_THAN_SIGN_STATE = 'RCDATA_LESS_THAN_SIGN_STATE'; +const RCDATA_END_TAG_OPEN_STATE = 'RCDATA_END_TAG_OPEN_STATE'; +const RCDATA_END_TAG_NAME_STATE = 'RCDATA_END_TAG_NAME_STATE'; +const RAWTEXT_LESS_THAN_SIGN_STATE = 'RAWTEXT_LESS_THAN_SIGN_STATE'; +const RAWTEXT_END_TAG_OPEN_STATE = 'RAWTEXT_END_TAG_OPEN_STATE'; +const RAWTEXT_END_TAG_NAME_STATE = 'RAWTEXT_END_TAG_NAME_STATE'; +const SCRIPT_DATA_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_LESS_THAN_SIGN_STATE'; +const SCRIPT_DATA_END_TAG_OPEN_STATE = 'SCRIPT_DATA_END_TAG_OPEN_STATE'; +const SCRIPT_DATA_END_TAG_NAME_STATE = 'SCRIPT_DATA_END_TAG_NAME_STATE'; +const SCRIPT_DATA_ESCAPE_START_STATE = 'SCRIPT_DATA_ESCAPE_START_STATE'; +const SCRIPT_DATA_ESCAPE_START_DASH_STATE = 'SCRIPT_DATA_ESCAPE_START_DASH_STATE'; +const SCRIPT_DATA_ESCAPED_STATE = 'SCRIPT_DATA_ESCAPED_STATE'; +const SCRIPT_DATA_ESCAPED_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_STATE'; +const SCRIPT_DATA_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_DASH_STATE'; +const SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE'; +const SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE'; +const SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPED_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE'; +const SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE'; +const BEFORE_ATTRIBUTE_NAME_STATE = 'BEFORE_ATTRIBUTE_NAME_STATE'; +const ATTRIBUTE_NAME_STATE = 'ATTRIBUTE_NAME_STATE'; +const AFTER_ATTRIBUTE_NAME_STATE = 'AFTER_ATTRIBUTE_NAME_STATE'; +const BEFORE_ATTRIBUTE_VALUE_STATE = 'BEFORE_ATTRIBUTE_VALUE_STATE'; +const ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE'; +const ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE'; +const ATTRIBUTE_VALUE_UNQUOTED_STATE = 'ATTRIBUTE_VALUE_UNQUOTED_STATE'; +const AFTER_ATTRIBUTE_VALUE_QUOTED_STATE = 'AFTER_ATTRIBUTE_VALUE_QUOTED_STATE'; +const SELF_CLOSING_START_TAG_STATE = 'SELF_CLOSING_START_TAG_STATE'; +const BOGUS_COMMENT_STATE = 'BOGUS_COMMENT_STATE'; +const MARKUP_DECLARATION_OPEN_STATE = 'MARKUP_DECLARATION_OPEN_STATE'; +const COMMENT_START_STATE = 'COMMENT_START_STATE'; +const COMMENT_START_DASH_STATE = 'COMMENT_START_DASH_STATE'; +const COMMENT_STATE = 'COMMENT_STATE'; +const COMMENT_LESS_THAN_SIGN_STATE = 'COMMENT_LESS_THAN_SIGN_STATE'; +const COMMENT_LESS_THAN_SIGN_BANG_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_STATE'; +const COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE'; +const COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE = 'COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE'; +const COMMENT_END_DASH_STATE = 'COMMENT_END_DASH_STATE'; +const COMMENT_END_STATE = 'COMMENT_END_STATE'; +const COMMENT_END_BANG_STATE = 'COMMENT_END_BANG_STATE'; +const DOCTYPE_STATE = 'DOCTYPE_STATE'; +const BEFORE_DOCTYPE_NAME_STATE = 'BEFORE_DOCTYPE_NAME_STATE'; +const DOCTYPE_NAME_STATE = 'DOCTYPE_NAME_STATE'; +const AFTER_DOCTYPE_NAME_STATE = 'AFTER_DOCTYPE_NAME_STATE'; +const AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE = 'AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE'; +const BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE'; +const DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE'; +const DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE'; +const AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE'; +const BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE = 'BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE'; +const AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE = 'AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE'; +const BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE'; +const DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE'; +const DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE'; +const AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE'; +const BOGUS_DOCTYPE_STATE = 'BOGUS_DOCTYPE_STATE'; +const CDATA_SECTION_STATE = 'CDATA_SECTION_STATE'; +const CDATA_SECTION_BRACKET_STATE = 'CDATA_SECTION_BRACKET_STATE'; +const CDATA_SECTION_END_STATE = 'CDATA_SECTION_END_STATE'; +const CHARACTER_REFERENCE_STATE = 'CHARACTER_REFERENCE_STATE'; +const NAMED_CHARACTER_REFERENCE_STATE = 'NAMED_CHARACTER_REFERENCE_STATE'; +const AMBIGUOUS_AMPERSAND_STATE = 'AMBIGUOS_AMPERSAND_STATE'; +const NUMERIC_CHARACTER_REFERENCE_STATE = 'NUMERIC_CHARACTER_REFERENCE_STATE'; +const HEXADEMICAL_CHARACTER_REFERENCE_START_STATE = 'HEXADEMICAL_CHARACTER_REFERENCE_START_STATE'; +const DECIMAL_CHARACTER_REFERENCE_START_STATE = 'DECIMAL_CHARACTER_REFERENCE_START_STATE'; +const HEXADEMICAL_CHARACTER_REFERENCE_STATE = 'HEXADEMICAL_CHARACTER_REFERENCE_STATE'; +const DECIMAL_CHARACTER_REFERENCE_STATE = 'DECIMAL_CHARACTER_REFERENCE_STATE'; +const NUMERIC_CHARACTER_REFERENCE_END_STATE = 'NUMERIC_CHARACTER_REFERENCE_END_STATE'; + +//Utils + +//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline +//this functions if they will be situated in another module due to context switch. +//Always perform inlining check before modifying this functions ('node --trace-inlining'). +function isWhitespace(cp) { + return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED; +} + +function isAsciiDigit(cp) { + return cp >= $.DIGIT_0 && cp <= $.DIGIT_9; +} + +function isAsciiUpper(cp) { + return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z; +} + +function isAsciiLower(cp) { + return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z; +} + +function isAsciiLetter(cp) { + return isAsciiLower(cp) || isAsciiUpper(cp); +} + +function isAsciiAlphaNumeric(cp) { + return isAsciiLetter(cp) || isAsciiDigit(cp); +} + +function isAsciiUpperHexDigit(cp) { + return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_F; +} + +function isAsciiLowerHexDigit(cp) { + return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_F; +} + +function isAsciiHexDigit(cp) { + return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp); +} + +function toAsciiLowerCodePoint(cp) { + return cp + 0x0020; +} + +//NOTE: String.fromCharCode() function can handle only characters from BMP subset. +//So, we need to workaround this manually. +//(see: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode#Getting_it_to_work_with_higher_values) +function toChar(cp) { + if (cp <= 0xffff) { + return String.fromCharCode(cp); + } + + cp -= 0x10000; + return String.fromCharCode(((cp >>> 10) & 0x3ff) | 0xd800) + String.fromCharCode(0xdc00 | (cp & 0x3ff)); +} + +function toAsciiLowerChar(cp) { + return String.fromCharCode(toAsciiLowerCodePoint(cp)); +} + +function findNamedEntityTreeBranch(nodeIx, cp) { + const branchCount = neTree[++nodeIx]; + let lo = ++nodeIx; + let hi = lo + branchCount - 1; + + while (lo <= hi) { + const mid = (lo + hi) >>> 1; + const midCp = neTree[mid]; + + if (midCp < cp) { + lo = mid + 1; + } else if (midCp > cp) { + hi = mid - 1; + } else { + return neTree[mid + branchCount]; + } + } + + return -1; +} + +//Tokenizer +class Tokenizer { + constructor() { + this.preprocessor = new Preprocessor(); + + this.tokenQueue = []; + + this.allowCDATA = false; + + this.state = DATA_STATE; + this.returnState = ''; + + this.charRefCode = -1; + this.tempBuff = []; + this.lastStartTagName = ''; + + this.consumedAfterSnapshot = -1; + this.active = false; + + this.currentCharacterToken = null; + this.currentToken = null; + this.currentAttr = null; + } + + //Errors + _err() { + // NOTE: err reporting is noop by default. Enabled by mixin. + } + + _errOnNextCodePoint(err) { + this._consume(); + this._err(err); + this._unconsume(); + } + + //API + getNextToken() { + while (!this.tokenQueue.length && this.active) { + this.consumedAfterSnapshot = 0; + + const cp = this._consume(); + + if (!this._ensureHibernation()) { + this[this.state](cp); + } + } + + return this.tokenQueue.shift(); + } + + write(chunk, isLastChunk) { + this.active = true; + this.preprocessor.write(chunk, isLastChunk); + } + + insertHtmlAtCurrentPos(chunk) { + this.active = true; + this.preprocessor.insertHtmlAtCurrentPos(chunk); + } + + //Hibernation + _ensureHibernation() { + if (this.preprocessor.endOfChunkHit) { + for (; this.consumedAfterSnapshot > 0; this.consumedAfterSnapshot--) { + this.preprocessor.retreat(); + } + + this.active = false; + this.tokenQueue.push({ type: Tokenizer.HIBERNATION_TOKEN }); + + return true; + } + + return false; + } + + //Consumption + _consume() { + this.consumedAfterSnapshot++; + return this.preprocessor.advance(); + } + + _unconsume() { + this.consumedAfterSnapshot--; + this.preprocessor.retreat(); + } + + _reconsumeInState(state) { + this.state = state; + this._unconsume(); + } + + _consumeSequenceIfMatch(pattern, startCp, caseSensitive) { + let consumedCount = 0; + let isMatch = true; + const patternLength = pattern.length; + let patternPos = 0; + let cp = startCp; + let patternCp = void 0; + + for (; patternPos < patternLength; patternPos++) { + if (patternPos > 0) { + cp = this._consume(); + consumedCount++; + } + + if (cp === $.EOF) { + isMatch = false; + break; + } + + patternCp = pattern[patternPos]; + + if (cp !== patternCp && (caseSensitive || cp !== toAsciiLowerCodePoint(patternCp))) { + isMatch = false; + break; + } + } + + if (!isMatch) { + while (consumedCount--) { + this._unconsume(); + } + } + + return isMatch; + } + + //Temp buffer + _isTempBufferEqualToScriptString() { + if (this.tempBuff.length !== $$.SCRIPT_STRING.length) { + return false; + } + + for (let i = 0; i < this.tempBuff.length; i++) { + if (this.tempBuff[i] !== $$.SCRIPT_STRING[i]) { + return false; + } + } + + return true; + } + + //Token creation + _createStartTagToken() { + this.currentToken = { + type: Tokenizer.START_TAG_TOKEN, + tagName: '', + selfClosing: false, + ackSelfClosing: false, + attrs: [] + }; + } + + _createEndTagToken() { + this.currentToken = { + type: Tokenizer.END_TAG_TOKEN, + tagName: '', + selfClosing: false, + attrs: [] + }; + } + + _createCommentToken() { + this.currentToken = { + type: Tokenizer.COMMENT_TOKEN, + data: '' + }; + } + + _createDoctypeToken(initialName) { + this.currentToken = { + type: Tokenizer.DOCTYPE_TOKEN, + name: initialName, + forceQuirks: false, + publicId: null, + systemId: null + }; + } + + _createCharacterToken(type, ch) { + this.currentCharacterToken = { + type: type, + chars: ch + }; + } + + _createEOFToken() { + this.currentToken = { type: Tokenizer.EOF_TOKEN }; + } + + //Tag attributes + _createAttr(attrNameFirstCh) { + this.currentAttr = { + name: attrNameFirstCh, + value: '' + }; + } + + _leaveAttrName(toState) { + if (Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) === null) { + this.currentToken.attrs.push(this.currentAttr); + } else { + this._err(ERR.duplicateAttribute); + } + + this.state = toState; + } + + _leaveAttrValue(toState) { + this.state = toState; + } + + //Token emission + _emitCurrentToken() { + this._emitCurrentCharacterToken(); + + const ct = this.currentToken; + + this.currentToken = null; + + //NOTE: store emited start tag's tagName to determine is the following end tag token is appropriate. + if (ct.type === Tokenizer.START_TAG_TOKEN) { + this.lastStartTagName = ct.tagName; + } else if (ct.type === Tokenizer.END_TAG_TOKEN) { + if (ct.attrs.length > 0) { + this._err(ERR.endTagWithAttributes); + } + + if (ct.selfClosing) { + this._err(ERR.endTagWithTrailingSolidus); + } + } + + this.tokenQueue.push(ct); + } + + _emitCurrentCharacterToken() { + if (this.currentCharacterToken) { + this.tokenQueue.push(this.currentCharacterToken); + this.currentCharacterToken = null; + } + } + + _emitEOFToken() { + this._createEOFToken(); + this._emitCurrentToken(); + } + + //Characters emission + + //OPTIMIZATION: specification uses only one type of character tokens (one token per character). + //This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters. + //If we have a sequence of characters that belong to the same group, parser can process it + //as a single solid character token. + //So, there are 3 types of character tokens in parse5: + //1)NULL_CHARACTER_TOKEN - \u0000-character sequences (e.g. '\u0000\u0000\u0000') + //2)WHITESPACE_CHARACTER_TOKEN - any whitespace/new-line character sequences (e.g. '\n \r\t \f') + //3)CHARACTER_TOKEN - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^') + _appendCharToCurrentCharacterToken(type, ch) { + if (this.currentCharacterToken && this.currentCharacterToken.type !== type) { + this._emitCurrentCharacterToken(); + } + + if (this.currentCharacterToken) { + this.currentCharacterToken.chars += ch; + } else { + this._createCharacterToken(type, ch); + } + } + + _emitCodePoint(cp) { + let type = Tokenizer.CHARACTER_TOKEN; + + if (isWhitespace(cp)) { + type = Tokenizer.WHITESPACE_CHARACTER_TOKEN; + } else if (cp === $.NULL) { + type = Tokenizer.NULL_CHARACTER_TOKEN; + } + + this._appendCharToCurrentCharacterToken(type, toChar(cp)); + } + + _emitSeveralCodePoints(codePoints) { + for (let i = 0; i < codePoints.length; i++) { + this._emitCodePoint(codePoints[i]); + } + } + + //NOTE: used then we emit character explicitly. This is always a non-whitespace and a non-null character. + //So we can avoid additional checks here. + _emitChars(ch) { + this._appendCharToCurrentCharacterToken(Tokenizer.CHARACTER_TOKEN, ch); + } + + // Character reference helpers + _matchNamedCharacterReference(startCp) { + let result = null; + let excess = 1; + let i = findNamedEntityTreeBranch(0, startCp); + + this.tempBuff.push(startCp); + + while (i > -1) { + const current = neTree[i]; + const inNode = current < MAX_BRANCH_MARKER_VALUE; + const nodeWithData = inNode && current & HAS_DATA_FLAG; + + if (nodeWithData) { + //NOTE: we use greedy search, so we continue lookup at this point + result = current & DATA_DUPLET_FLAG ? [neTree[++i], neTree[++i]] : [neTree[++i]]; + excess = 0; + } + + const cp = this._consume(); + + this.tempBuff.push(cp); + excess++; + + if (cp === $.EOF) { + break; + } + + if (inNode) { + i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp) : -1; + } else { + i = cp === current ? ++i : -1; + } + } + + while (excess--) { + this.tempBuff.pop(); + this._unconsume(); + } + + return result; + } + + _isCharacterReferenceInAttribute() { + return ( + this.returnState === ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE || + this.returnState === ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE || + this.returnState === ATTRIBUTE_VALUE_UNQUOTED_STATE + ); + } + + _isCharacterReferenceAttributeQuirk(withSemicolon) { + if (!withSemicolon && this._isCharacterReferenceInAttribute()) { + const nextCp = this._consume(); + + this._unconsume(); + + return nextCp === $.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp); + } + + return false; + } + + _flushCodePointsConsumedAsCharacterReference() { + if (this._isCharacterReferenceInAttribute()) { + for (let i = 0; i < this.tempBuff.length; i++) { + this.currentAttr.value += toChar(this.tempBuff[i]); + } + } else { + this._emitSeveralCodePoints(this.tempBuff); + } + + this.tempBuff = []; + } + + // State machine + + // Data state + //------------------------------------------------------------------ + [DATA_STATE](cp) { + this.preprocessor.dropParsedChunk(); + + if (cp === $.LESS_THAN_SIGN) { + this.state = TAG_OPEN_STATE; + } else if (cp === $.AMPERSAND) { + this.returnState = DATA_STATE; + this.state = CHARACTER_REFERENCE_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitCodePoint(cp); + } else if (cp === $.EOF) { + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // RCDATA state + //------------------------------------------------------------------ + [RCDATA_STATE](cp) { + this.preprocessor.dropParsedChunk(); + + if (cp === $.AMPERSAND) { + this.returnState = RCDATA_STATE; + this.state = CHARACTER_REFERENCE_STATE; + } else if (cp === $.LESS_THAN_SIGN) { + this.state = RCDATA_LESS_THAN_SIGN_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // RAWTEXT state + //------------------------------------------------------------------ + [RAWTEXT_STATE](cp) { + this.preprocessor.dropParsedChunk(); + + if (cp === $.LESS_THAN_SIGN) { + this.state = RAWTEXT_LESS_THAN_SIGN_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // Script data state + //------------------------------------------------------------------ + [SCRIPT_DATA_STATE](cp) { + this.preprocessor.dropParsedChunk(); + + if (cp === $.LESS_THAN_SIGN) { + this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // PLAINTEXT state + //------------------------------------------------------------------ + [PLAINTEXT_STATE](cp) { + this.preprocessor.dropParsedChunk(); + + if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // Tag open state + //------------------------------------------------------------------ + [TAG_OPEN_STATE](cp) { + if (cp === $.EXCLAMATION_MARK) { + this.state = MARKUP_DECLARATION_OPEN_STATE; + } else if (cp === $.SOLIDUS) { + this.state = END_TAG_OPEN_STATE; + } else if (isAsciiLetter(cp)) { + this._createStartTagToken(); + this._reconsumeInState(TAG_NAME_STATE); + } else if (cp === $.QUESTION_MARK) { + this._err(ERR.unexpectedQuestionMarkInsteadOfTagName); + this._createCommentToken(); + this._reconsumeInState(BOGUS_COMMENT_STATE); + } else if (cp === $.EOF) { + this._err(ERR.eofBeforeTagName); + this._emitChars('<'); + this._emitEOFToken(); + } else { + this._err(ERR.invalidFirstCharacterOfTagName); + this._emitChars('<'); + this._reconsumeInState(DATA_STATE); + } + } + + // End tag open state + //------------------------------------------------------------------ + [END_TAG_OPEN_STATE](cp) { + if (isAsciiLetter(cp)) { + this._createEndTagToken(); + this._reconsumeInState(TAG_NAME_STATE); + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingEndTagName); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofBeforeTagName); + this._emitChars(''); + this._emitEOFToken(); + } else { + this._err(ERR.invalidFirstCharacterOfTagName); + this._createCommentToken(); + this._reconsumeInState(BOGUS_COMMENT_STATE); + } + } + + // Tag name state + //------------------------------------------------------------------ + [TAG_NAME_STATE](cp) { + if (isWhitespace(cp)) { + this.state = BEFORE_ATTRIBUTE_NAME_STATE; + } else if (cp === $.SOLIDUS) { + this.state = SELF_CLOSING_START_TAG_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (isAsciiUpper(cp)) { + this.currentToken.tagName += toAsciiLowerChar(cp); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.tagName += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this.currentToken.tagName += toChar(cp); + } + } + + // RCDATA less-than sign state + //------------------------------------------------------------------ + [RCDATA_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.SOLIDUS) { + this.tempBuff = []; + this.state = RCDATA_END_TAG_OPEN_STATE; + } else { + this._emitChars('<'); + this._reconsumeInState(RCDATA_STATE); + } + } + + // RCDATA end tag open state + //------------------------------------------------------------------ + [RCDATA_END_TAG_OPEN_STATE](cp) { + if (isAsciiLetter(cp)) { + this._createEndTagToken(); + this._reconsumeInState(RCDATA_END_TAG_NAME_STATE); + } else { + this._emitChars(''); + this._reconsumeInState(RCDATA_STATE); + } + } + + // RCDATA end tag name state + //------------------------------------------------------------------ + [RCDATA_END_TAG_NAME_STATE](cp) { + if (isAsciiUpper(cp)) { + this.currentToken.tagName += toAsciiLowerChar(cp); + this.tempBuff.push(cp); + } else if (isAsciiLower(cp)) { + this.currentToken.tagName += toChar(cp); + this.tempBuff.push(cp); + } else { + if (this.lastStartTagName === this.currentToken.tagName) { + if (isWhitespace(cp)) { + this.state = BEFORE_ATTRIBUTE_NAME_STATE; + return; + } + + if (cp === $.SOLIDUS) { + this.state = SELF_CLOSING_START_TAG_STATE; + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + return; + } + } + + this._emitChars(''); + this._emitSeveralCodePoints(this.tempBuff); + this._reconsumeInState(RCDATA_STATE); + } + } + + // RAWTEXT less-than sign state + //------------------------------------------------------------------ + [RAWTEXT_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.SOLIDUS) { + this.tempBuff = []; + this.state = RAWTEXT_END_TAG_OPEN_STATE; + } else { + this._emitChars('<'); + this._reconsumeInState(RAWTEXT_STATE); + } + } + + // RAWTEXT end tag open state + //------------------------------------------------------------------ + [RAWTEXT_END_TAG_OPEN_STATE](cp) { + if (isAsciiLetter(cp)) { + this._createEndTagToken(); + this._reconsumeInState(RAWTEXT_END_TAG_NAME_STATE); + } else { + this._emitChars(''); + this._reconsumeInState(RAWTEXT_STATE); + } + } + + // RAWTEXT end tag name state + //------------------------------------------------------------------ + [RAWTEXT_END_TAG_NAME_STATE](cp) { + if (isAsciiUpper(cp)) { + this.currentToken.tagName += toAsciiLowerChar(cp); + this.tempBuff.push(cp); + } else if (isAsciiLower(cp)) { + this.currentToken.tagName += toChar(cp); + this.tempBuff.push(cp); + } else { + if (this.lastStartTagName === this.currentToken.tagName) { + if (isWhitespace(cp)) { + this.state = BEFORE_ATTRIBUTE_NAME_STATE; + return; + } + + if (cp === $.SOLIDUS) { + this.state = SELF_CLOSING_START_TAG_STATE; + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this._emitCurrentToken(); + this.state = DATA_STATE; + return; + } + } + + this._emitChars(''); + this._emitSeveralCodePoints(this.tempBuff); + this._reconsumeInState(RAWTEXT_STATE); + } + } + + // Script data less-than sign state + //------------------------------------------------------------------ + [SCRIPT_DATA_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.SOLIDUS) { + this.tempBuff = []; + this.state = SCRIPT_DATA_END_TAG_OPEN_STATE; + } else if (cp === $.EXCLAMATION_MARK) { + this.state = SCRIPT_DATA_ESCAPE_START_STATE; + this._emitChars(''); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.state = SCRIPT_DATA_ESCAPED_STATE; + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._err(ERR.eofInScriptHtmlCommentLikeText); + this._emitEOFToken(); + } else { + this.state = SCRIPT_DATA_ESCAPED_STATE; + this._emitCodePoint(cp); + } + } + + // Script data escaped less-than sign state + //------------------------------------------------------------------ + [SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.SOLIDUS) { + this.tempBuff = []; + this.state = SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE; + } else if (isAsciiLetter(cp)) { + this.tempBuff = []; + this._emitChars('<'); + this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE); + } else { + this._emitChars('<'); + this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + } + } + + // Script data escaped end tag open state + //------------------------------------------------------------------ + [SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE](cp) { + if (isAsciiLetter(cp)) { + this._createEndTagToken(); + this._reconsumeInState(SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE); + } else { + this._emitChars(''); + this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + } + } + + // Script data escaped end tag name state + //------------------------------------------------------------------ + [SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE](cp) { + if (isAsciiUpper(cp)) { + this.currentToken.tagName += toAsciiLowerChar(cp); + this.tempBuff.push(cp); + } else if (isAsciiLower(cp)) { + this.currentToken.tagName += toChar(cp); + this.tempBuff.push(cp); + } else { + if (this.lastStartTagName === this.currentToken.tagName) { + if (isWhitespace(cp)) { + this.state = BEFORE_ATTRIBUTE_NAME_STATE; + return; + } + + if (cp === $.SOLIDUS) { + this.state = SELF_CLOSING_START_TAG_STATE; + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this._emitCurrentToken(); + this.state = DATA_STATE; + return; + } + } + + this._emitChars(''); + this._emitSeveralCodePoints(this.tempBuff); + this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + } + } + + // Script data double escape start state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE](cp) { + if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { + this.state = this._isTempBufferEqualToScriptString() + ? SCRIPT_DATA_DOUBLE_ESCAPED_STATE + : SCRIPT_DATA_ESCAPED_STATE; + this._emitCodePoint(cp); + } else if (isAsciiUpper(cp)) { + this.tempBuff.push(toAsciiLowerCodePoint(cp)); + this._emitCodePoint(cp); + } else if (isAsciiLower(cp)) { + this.tempBuff.push(cp); + this._emitCodePoint(cp); + } else { + this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + } + } + + // Script data double escaped state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPED_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE; + this._emitChars('-'); + } else if (cp === $.LESS_THAN_SIGN) { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; + this._emitChars('<'); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._err(ERR.eofInScriptHtmlCommentLikeText); + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // Script data double escaped dash state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE; + this._emitChars('-'); + } else if (cp === $.LESS_THAN_SIGN) { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; + this._emitChars('<'); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._err(ERR.eofInScriptHtmlCommentLikeText); + this._emitEOFToken(); + } else { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; + this._emitCodePoint(cp); + } + } + + // Script data double escaped dash dash state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this._emitChars('-'); + } else if (cp === $.LESS_THAN_SIGN) { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; + this._emitChars('<'); + } else if (cp === $.GREATER_THAN_SIGN) { + this.state = SCRIPT_DATA_STATE; + this._emitChars('>'); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; + this._emitChars(unicode.REPLACEMENT_CHARACTER); + } else if (cp === $.EOF) { + this._err(ERR.eofInScriptHtmlCommentLikeText); + this._emitEOFToken(); + } else { + this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; + this._emitCodePoint(cp); + } + } + + // Script data double escaped less-than sign state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.SOLIDUS) { + this.tempBuff = []; + this.state = SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE; + this._emitChars('/'); + } else { + this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); + } + } + + // Script data double escape end state + //------------------------------------------------------------------ + [SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE](cp) { + if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { + this.state = this._isTempBufferEqualToScriptString() + ? SCRIPT_DATA_ESCAPED_STATE + : SCRIPT_DATA_DOUBLE_ESCAPED_STATE; + + this._emitCodePoint(cp); + } else if (isAsciiUpper(cp)) { + this.tempBuff.push(toAsciiLowerCodePoint(cp)); + this._emitCodePoint(cp); + } else if (isAsciiLower(cp)) { + this.tempBuff.push(cp); + this._emitCodePoint(cp); + } else { + this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); + } + } + + // Before attribute name state + //------------------------------------------------------------------ + [BEFORE_ATTRIBUTE_NAME_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) { + this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE); + } else if (cp === $.EQUALS_SIGN) { + this._err(ERR.unexpectedEqualsSignBeforeAttributeName); + this._createAttr('='); + this.state = ATTRIBUTE_NAME_STATE; + } else { + this._createAttr(''); + this._reconsumeInState(ATTRIBUTE_NAME_STATE); + } + } + + // Attribute name state + //------------------------------------------------------------------ + [ATTRIBUTE_NAME_STATE](cp) { + if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) { + this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE); + this._unconsume(); + } else if (cp === $.EQUALS_SIGN) { + this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE); + } else if (isAsciiUpper(cp)) { + this.currentAttr.name += toAsciiLowerChar(cp); + } else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) { + this._err(ERR.unexpectedCharacterInAttributeName); + this.currentAttr.name += toChar(cp); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentAttr.name += unicode.REPLACEMENT_CHARACTER; + } else { + this.currentAttr.name += toChar(cp); + } + } + + // After attribute name state + //------------------------------------------------------------------ + [AFTER_ATTRIBUTE_NAME_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.SOLIDUS) { + this.state = SELF_CLOSING_START_TAG_STATE; + } else if (cp === $.EQUALS_SIGN) { + this.state = BEFORE_ATTRIBUTE_VALUE_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this._createAttr(''); + this._reconsumeInState(ATTRIBUTE_NAME_STATE); + } + } + + // Before attribute value state + //------------------------------------------------------------------ + [BEFORE_ATTRIBUTE_VALUE_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.QUOTATION_MARK) { + this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingAttributeValue); + this.state = DATA_STATE; + this._emitCurrentToken(); + } else { + this._reconsumeInState(ATTRIBUTE_VALUE_UNQUOTED_STATE); + } + } + + // Attribute value (double-quoted) state + //------------------------------------------------------------------ + [ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE](cp) { + if (cp === $.QUOTATION_MARK) { + this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; + } else if (cp === $.AMPERSAND) { + this.returnState = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; + this.state = CHARACTER_REFERENCE_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentAttr.value += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this.currentAttr.value += toChar(cp); + } + } + + // Attribute value (single-quoted) state + //------------------------------------------------------------------ + [ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE](cp) { + if (cp === $.APOSTROPHE) { + this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; + } else if (cp === $.AMPERSAND) { + this.returnState = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; + this.state = CHARACTER_REFERENCE_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentAttr.value += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this.currentAttr.value += toChar(cp); + } + } + + // Attribute value (unquoted) state + //------------------------------------------------------------------ + [ATTRIBUTE_VALUE_UNQUOTED_STATE](cp) { + if (isWhitespace(cp)) { + this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE); + } else if (cp === $.AMPERSAND) { + this.returnState = ATTRIBUTE_VALUE_UNQUOTED_STATE; + this.state = CHARACTER_REFERENCE_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._leaveAttrValue(DATA_STATE); + this._emitCurrentToken(); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentAttr.value += unicode.REPLACEMENT_CHARACTER; + } else if ( + cp === $.QUOTATION_MARK || + cp === $.APOSTROPHE || + cp === $.LESS_THAN_SIGN || + cp === $.EQUALS_SIGN || + cp === $.GRAVE_ACCENT + ) { + this._err(ERR.unexpectedCharacterInUnquotedAttributeValue); + this.currentAttr.value += toChar(cp); + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this.currentAttr.value += toChar(cp); + } + } + + // After attribute value (quoted) state + //------------------------------------------------------------------ + [AFTER_ATTRIBUTE_VALUE_QUOTED_STATE](cp) { + if (isWhitespace(cp)) { + this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE); + } else if (cp === $.SOLIDUS) { + this._leaveAttrValue(SELF_CLOSING_START_TAG_STATE); + } else if (cp === $.GREATER_THAN_SIGN) { + this._leaveAttrValue(DATA_STATE); + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this._err(ERR.missingWhitespaceBetweenAttributes); + this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); + } + } + + // Self-closing start tag state + //------------------------------------------------------------------ + [SELF_CLOSING_START_TAG_STATE](cp) { + if (cp === $.GREATER_THAN_SIGN) { + this.currentToken.selfClosing = true; + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInTag); + this._emitEOFToken(); + } else { + this._err(ERR.unexpectedSolidusInTag); + this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); + } + } + + // Bogus comment state + //------------------------------------------------------------------ + [BOGUS_COMMENT_STATE](cp) { + if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._emitCurrentToken(); + this._emitEOFToken(); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.data += unicode.REPLACEMENT_CHARACTER; + } else { + this.currentToken.data += toChar(cp); + } + } + + // Markup declaration open state + //------------------------------------------------------------------ + [MARKUP_DECLARATION_OPEN_STATE](cp) { + if (this._consumeSequenceIfMatch($$.DASH_DASH_STRING, cp, true)) { + this._createCommentToken(); + this.state = COMMENT_START_STATE; + } else if (this._consumeSequenceIfMatch($$.DOCTYPE_STRING, cp, false)) { + this.state = DOCTYPE_STATE; + } else if (this._consumeSequenceIfMatch($$.CDATA_START_STRING, cp, true)) { + if (this.allowCDATA) { + this.state = CDATA_SECTION_STATE; + } else { + this._err(ERR.cdataInHtmlContent); + this._createCommentToken(); + this.currentToken.data = '[CDATA['; + this.state = BOGUS_COMMENT_STATE; + } + } + + //NOTE: sequence lookup can be abrupted by hibernation. In that case lookup + //results are no longer valid and we will need to start over. + else if (!this._ensureHibernation()) { + this._err(ERR.incorrectlyOpenedComment); + this._createCommentToken(); + this._reconsumeInState(BOGUS_COMMENT_STATE); + } + } + + // Comment start state + //------------------------------------------------------------------ + [COMMENT_START_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_START_DASH_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptClosingOfEmptyComment); + this.state = DATA_STATE; + this._emitCurrentToken(); + } else { + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment start dash state + //------------------------------------------------------------------ + [COMMENT_START_DASH_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_END_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptClosingOfEmptyComment); + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInComment); + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.data += '-'; + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment state + //------------------------------------------------------------------ + [COMMENT_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_END_DASH_STATE; + } else if (cp === $.LESS_THAN_SIGN) { + this.currentToken.data += '<'; + this.state = COMMENT_LESS_THAN_SIGN_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.data += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.EOF) { + this._err(ERR.eofInComment); + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.data += toChar(cp); + } + } + + // Comment less-than sign state + //------------------------------------------------------------------ + [COMMENT_LESS_THAN_SIGN_STATE](cp) { + if (cp === $.EXCLAMATION_MARK) { + this.currentToken.data += '!'; + this.state = COMMENT_LESS_THAN_SIGN_BANG_STATE; + } else if (cp === $.LESS_THAN_SIGN) { + this.currentToken.data += '!'; + } else { + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment less-than sign bang state + //------------------------------------------------------------------ + [COMMENT_LESS_THAN_SIGN_BANG_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE; + } else { + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment less-than sign bang dash state + //------------------------------------------------------------------ + [COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE; + } else { + this._reconsumeInState(COMMENT_END_DASH_STATE); + } + } + + // Comment less-than sign bang dash dash state + //------------------------------------------------------------------ + [COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE](cp) { + if (cp !== $.GREATER_THAN_SIGN && cp !== $.EOF) { + this._err(ERR.nestedComment); + } + + this._reconsumeInState(COMMENT_END_STATE); + } + + // Comment end dash state + //------------------------------------------------------------------ + [COMMENT_END_DASH_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.state = COMMENT_END_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInComment); + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.data += '-'; + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment end state + //------------------------------------------------------------------ + [COMMENT_END_STATE](cp) { + if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EXCLAMATION_MARK) { + this.state = COMMENT_END_BANG_STATE; + } else if (cp === $.HYPHEN_MINUS) { + this.currentToken.data += '-'; + } else if (cp === $.EOF) { + this._err(ERR.eofInComment); + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.data += '--'; + this._reconsumeInState(COMMENT_STATE); + } + } + + // Comment end bang state + //------------------------------------------------------------------ + [COMMENT_END_BANG_STATE](cp) { + if (cp === $.HYPHEN_MINUS) { + this.currentToken.data += '--!'; + this.state = COMMENT_END_DASH_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.incorrectlyClosedComment); + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInComment); + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.data += '--!'; + this._reconsumeInState(COMMENT_STATE); + } + } + + // DOCTYPE state + //------------------------------------------------------------------ + [DOCTYPE_STATE](cp) { + if (isWhitespace(cp)) { + this.state = BEFORE_DOCTYPE_NAME_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this._createDoctypeToken(null); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingWhitespaceBeforeDoctypeName); + this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE); + } + } + + // Before DOCTYPE name state + //------------------------------------------------------------------ + [BEFORE_DOCTYPE_NAME_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (isAsciiUpper(cp)) { + this._createDoctypeToken(toAsciiLowerChar(cp)); + this.state = DOCTYPE_NAME_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this._createDoctypeToken(unicode.REPLACEMENT_CHARACTER); + this.state = DOCTYPE_NAME_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingDoctypeName); + this._createDoctypeToken(null); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this._createDoctypeToken(null); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._createDoctypeToken(toChar(cp)); + this.state = DOCTYPE_NAME_STATE; + } + } + + // DOCTYPE name state + //------------------------------------------------------------------ + [DOCTYPE_NAME_STATE](cp) { + if (isWhitespace(cp)) { + this.state = AFTER_DOCTYPE_NAME_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (isAsciiUpper(cp)) { + this.currentToken.name += toAsciiLowerChar(cp); + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.name += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.name += toChar(cp); + } + } + + // After DOCTYPE name state + //------------------------------------------------------------------ + [AFTER_DOCTYPE_NAME_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else if (this._consumeSequenceIfMatch($$.PUBLIC_STRING, cp, false)) { + this.state = AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE; + } else if (this._consumeSequenceIfMatch($$.SYSTEM_STRING, cp, false)) { + this.state = AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE; + } + //NOTE: sequence lookup can be abrupted by hibernation. In that case lookup + //results are no longer valid and we will need to start over. + else if (!this._ensureHibernation()) { + this._err(ERR.invalidCharacterSequenceAfterDoctypeName); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // After DOCTYPE public keyword state + //------------------------------------------------------------------ + [AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE](cp) { + if (isWhitespace(cp)) { + this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE; + } else if (cp === $.QUOTATION_MARK) { + this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword); + this.currentToken.publicId = ''; + this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword); + this.currentToken.publicId = ''; + this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // Before DOCTYPE public identifier state + //------------------------------------------------------------------ + [BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.QUOTATION_MARK) { + this.currentToken.publicId = ''; + this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this.currentToken.publicId = ''; + this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // DOCTYPE public identifier (double-quoted) state + //------------------------------------------------------------------ + [DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) { + if (cp === $.QUOTATION_MARK) { + this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.publicId += toChar(cp); + } + } + + // DOCTYPE public identifier (single-quoted) state + //------------------------------------------------------------------ + [DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE](cp) { + if (cp === $.APOSTROPHE) { + this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.publicId += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptDoctypePublicIdentifier); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.publicId += toChar(cp); + } + } + + // After DOCTYPE public identifier state + //------------------------------------------------------------------ + [AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE](cp) { + if (isWhitespace(cp)) { + this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.QUOTATION_MARK) { + this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers); + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers); + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // Between DOCTYPE public and system identifiers state + //------------------------------------------------------------------ + [BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.QUOTATION_MARK) { + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // After DOCTYPE system keyword state + //------------------------------------------------------------------ + [AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE](cp) { + if (isWhitespace(cp)) { + this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + } else if (cp === $.QUOTATION_MARK) { + this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword); + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword); + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // Before DOCTYPE system identifier state + //------------------------------------------------------------------ + [BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.QUOTATION_MARK) { + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; + } else if (cp === $.APOSTROPHE) { + this.currentToken.systemId = ''; + this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.missingDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this.state = DATA_STATE; + this._emitCurrentToken(); + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // DOCTYPE system identifier (double-quoted) state + //------------------------------------------------------------------ + [DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE](cp) { + if (cp === $.QUOTATION_MARK) { + this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.systemId += toChar(cp); + } + } + + // DOCTYPE system identifier (single-quoted) state + //------------------------------------------------------------------ + [DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp) { + if (cp === $.APOSTROPHE) { + this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + this.currentToken.systemId += unicode.REPLACEMENT_CHARACTER; + } else if (cp === $.GREATER_THAN_SIGN) { + this._err(ERR.abruptDoctypeSystemIdentifier); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this.currentToken.systemId += toChar(cp); + } + } + + // After DOCTYPE system identifier state + //------------------------------------------------------------------ + [AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE](cp) { + if (isWhitespace(cp)) { + return; + } + + if (cp === $.GREATER_THAN_SIGN) { + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInDoctype); + this.currentToken.forceQuirks = true; + this._emitCurrentToken(); + this._emitEOFToken(); + } else { + this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier); + this._reconsumeInState(BOGUS_DOCTYPE_STATE); + } + } + + // Bogus DOCTYPE state + //------------------------------------------------------------------ + [BOGUS_DOCTYPE_STATE](cp) { + if (cp === $.GREATER_THAN_SIGN) { + this._emitCurrentToken(); + this.state = DATA_STATE; + } else if (cp === $.NULL) { + this._err(ERR.unexpectedNullCharacter); + } else if (cp === $.EOF) { + this._emitCurrentToken(); + this._emitEOFToken(); + } + } + + // CDATA section state + //------------------------------------------------------------------ + [CDATA_SECTION_STATE](cp) { + if (cp === $.RIGHT_SQUARE_BRACKET) { + this.state = CDATA_SECTION_BRACKET_STATE; + } else if (cp === $.EOF) { + this._err(ERR.eofInCdata); + this._emitEOFToken(); + } else { + this._emitCodePoint(cp); + } + } + + // CDATA section bracket state + //------------------------------------------------------------------ + [CDATA_SECTION_BRACKET_STATE](cp) { + if (cp === $.RIGHT_SQUARE_BRACKET) { + this.state = CDATA_SECTION_END_STATE; + } else { + this._emitChars(']'); + this._reconsumeInState(CDATA_SECTION_STATE); + } + } + + // CDATA section end state + //------------------------------------------------------------------ + [CDATA_SECTION_END_STATE](cp) { + if (cp === $.GREATER_THAN_SIGN) { + this.state = DATA_STATE; + } else if (cp === $.RIGHT_SQUARE_BRACKET) { + this._emitChars(']'); + } else { + this._emitChars(']]'); + this._reconsumeInState(CDATA_SECTION_STATE); + } + } + + // Character reference state + //------------------------------------------------------------------ + [CHARACTER_REFERENCE_STATE](cp) { + this.tempBuff = [$.AMPERSAND]; + + if (cp === $.NUMBER_SIGN) { + this.tempBuff.push(cp); + this.state = NUMERIC_CHARACTER_REFERENCE_STATE; + } else if (isAsciiAlphaNumeric(cp)) { + this._reconsumeInState(NAMED_CHARACTER_REFERENCE_STATE); + } else { + this._flushCodePointsConsumedAsCharacterReference(); + this._reconsumeInState(this.returnState); + } + } + + // Named character reference state + //------------------------------------------------------------------ + [NAMED_CHARACTER_REFERENCE_STATE](cp) { + const matchResult = this._matchNamedCharacterReference(cp); + + //NOTE: matching can be abrupted by hibernation. In that case match + //results are no longer valid and we will need to start over. + if (this._ensureHibernation()) { + this.tempBuff = [$.AMPERSAND]; + } else if (matchResult) { + const withSemicolon = this.tempBuff[this.tempBuff.length - 1] === $.SEMICOLON; + + if (!this._isCharacterReferenceAttributeQuirk(withSemicolon)) { + if (!withSemicolon) { + this._errOnNextCodePoint(ERR.missingSemicolonAfterCharacterReference); + } + + this.tempBuff = matchResult; + } + + this._flushCodePointsConsumedAsCharacterReference(); + this.state = this.returnState; + } else { + this._flushCodePointsConsumedAsCharacterReference(); + this.state = AMBIGUOUS_AMPERSAND_STATE; + } + } + + // Ambiguos ampersand state + //------------------------------------------------------------------ + [AMBIGUOUS_AMPERSAND_STATE](cp) { + if (isAsciiAlphaNumeric(cp)) { + if (this._isCharacterReferenceInAttribute()) { + this.currentAttr.value += toChar(cp); + } else { + this._emitCodePoint(cp); + } + } else { + if (cp === $.SEMICOLON) { + this._err(ERR.unknownNamedCharacterReference); + } + + this._reconsumeInState(this.returnState); + } + } + + // Numeric character reference state + //------------------------------------------------------------------ + [NUMERIC_CHARACTER_REFERENCE_STATE](cp) { + this.charRefCode = 0; + + if (cp === $.LATIN_SMALL_X || cp === $.LATIN_CAPITAL_X) { + this.tempBuff.push(cp); + this.state = HEXADEMICAL_CHARACTER_REFERENCE_START_STATE; + } else { + this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_START_STATE); + } + } + + // Hexademical character reference start state + //------------------------------------------------------------------ + [HEXADEMICAL_CHARACTER_REFERENCE_START_STATE](cp) { + if (isAsciiHexDigit(cp)) { + this._reconsumeInState(HEXADEMICAL_CHARACTER_REFERENCE_STATE); + } else { + this._err(ERR.absenceOfDigitsInNumericCharacterReference); + this._flushCodePointsConsumedAsCharacterReference(); + this._reconsumeInState(this.returnState); + } + } + + // Decimal character reference start state + //------------------------------------------------------------------ + [DECIMAL_CHARACTER_REFERENCE_START_STATE](cp) { + if (isAsciiDigit(cp)) { + this._reconsumeInState(DECIMAL_CHARACTER_REFERENCE_STATE); + } else { + this._err(ERR.absenceOfDigitsInNumericCharacterReference); + this._flushCodePointsConsumedAsCharacterReference(); + this._reconsumeInState(this.returnState); + } + } + + // Hexademical character reference state + //------------------------------------------------------------------ + [HEXADEMICAL_CHARACTER_REFERENCE_STATE](cp) { + if (isAsciiUpperHexDigit(cp)) { + this.charRefCode = this.charRefCode * 16 + cp - 0x37; + } else if (isAsciiLowerHexDigit(cp)) { + this.charRefCode = this.charRefCode * 16 + cp - 0x57; + } else if (isAsciiDigit(cp)) { + this.charRefCode = this.charRefCode * 16 + cp - 0x30; + } else if (cp === $.SEMICOLON) { + this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE; + } else { + this._err(ERR.missingSemicolonAfterCharacterReference); + this._reconsumeInState(NUMERIC_CHARACTER_REFERENCE_END_STATE); + } + } + + // Decimal character reference state + //------------------------------------------------------------------ + [DECIMAL_CHARACTER_REFERENCE_STATE](cp) { + if (isAsciiDigit(cp)) { + this.charRefCode = this.charRefCode * 10 + cp - 0x30; + } else if (cp === $.SEMICOLON) { + this.state = NUMERIC_CHARACTER_REFERENCE_END_STATE; + } else { + this._err(ERR.missingSemicolonAfterCharacterReference); + this._reconsumeInState(NUMERIC_CHARACTER_REFERENCE_END_STATE); + } + } + + // Numeric character reference end state + //------------------------------------------------------------------ + [NUMERIC_CHARACTER_REFERENCE_END_STATE]() { + if (this.charRefCode === $.NULL) { + this._err(ERR.nullCharacterReference); + this.charRefCode = $.REPLACEMENT_CHARACTER; + } else if (this.charRefCode > 0x10ffff) { + this._err(ERR.characterReferenceOutsideUnicodeRange); + this.charRefCode = $.REPLACEMENT_CHARACTER; + } else if (unicode.isSurrogate(this.charRefCode)) { + this._err(ERR.surrogateCharacterReference); + this.charRefCode = $.REPLACEMENT_CHARACTER; + } else if (unicode.isUndefinedCodePoint(this.charRefCode)) { + this._err(ERR.noncharacterCharacterReference); + } else if (unicode.isControlCodePoint(this.charRefCode) || this.charRefCode === $.CARRIAGE_RETURN) { + this._err(ERR.controlCharacterReference); + + const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS[this.charRefCode]; + + if (replacement) { + this.charRefCode = replacement; + } + } + + this.tempBuff = [this.charRefCode]; + + this._flushCodePointsConsumedAsCharacterReference(); + this._reconsumeInState(this.returnState); + } +} + +//Token types +Tokenizer.CHARACTER_TOKEN = 'CHARACTER_TOKEN'; +Tokenizer.NULL_CHARACTER_TOKEN = 'NULL_CHARACTER_TOKEN'; +Tokenizer.WHITESPACE_CHARACTER_TOKEN = 'WHITESPACE_CHARACTER_TOKEN'; +Tokenizer.START_TAG_TOKEN = 'START_TAG_TOKEN'; +Tokenizer.END_TAG_TOKEN = 'END_TAG_TOKEN'; +Tokenizer.COMMENT_TOKEN = 'COMMENT_TOKEN'; +Tokenizer.DOCTYPE_TOKEN = 'DOCTYPE_TOKEN'; +Tokenizer.EOF_TOKEN = 'EOF_TOKEN'; +Tokenizer.HIBERNATION_TOKEN = 'HIBERNATION_TOKEN'; + +//Tokenizer initial states for different modes +Tokenizer.MODE = { + DATA: DATA_STATE, + RCDATA: RCDATA_STATE, + RAWTEXT: RAWTEXT_STATE, + SCRIPT_DATA: SCRIPT_DATA_STATE, + PLAINTEXT: PLAINTEXT_STATE +}; + +//Static +Tokenizer.getTokenAttr = function(token, attrName) { + for (let i = token.attrs.length - 1; i >= 0; i--) { + if (token.attrs[i].name === attrName) { + return token.attrs[i].value; + } + } + + return null; +}; + +module.exports = Tokenizer; + + +/***/ }), +/* 6 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const unicode = __webpack_require__(7); +const ERR = __webpack_require__(8); + +//Aliases +const $ = unicode.CODE_POINTS; + +//Const +const DEFAULT_BUFFER_WATERLINE = 1 << 16; + +//Preprocessor +//NOTE: HTML input preprocessing +//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) +class Preprocessor { + constructor() { + this.html = null; + + this.pos = -1; + this.lastGapPos = -1; + this.lastCharPos = -1; + + this.gapStack = []; + + this.skipNextNewLine = false; + + this.lastChunkWritten = false; + this.endOfChunkHit = false; + this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; + } + + _err() { + // NOTE: err reporting is noop by default. Enabled by mixin. + } + + _addGap() { + this.gapStack.push(this.lastGapPos); + this.lastGapPos = this.pos; + } + + _processSurrogate(cp) { + //NOTE: try to peek a surrogate pair + if (this.pos !== this.lastCharPos) { + const nextCp = this.html.charCodeAt(this.pos + 1); + + if (unicode.isSurrogatePair(nextCp)) { + //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. + this.pos++; + + //NOTE: add gap that should be avoided during retreat + this._addGap(); + + return unicode.getSurrogatePairCodePoint(cp, nextCp); + } + } + + //NOTE: we are at the end of a chunk, therefore we can't infer surrogate pair yet. + else if (!this.lastChunkWritten) { + this.endOfChunkHit = true; + return $.EOF; + } + + //NOTE: isolated surrogate + this._err(ERR.surrogateInInputStream); + + return cp; + } + + dropParsedChunk() { + if (this.pos > this.bufferWaterline) { + this.lastCharPos -= this.pos; + this.html = this.html.substring(this.pos); + this.pos = 0; + this.lastGapPos = -1; + this.gapStack = []; + } + } + + write(chunk, isLastChunk) { + if (this.html) { + this.html += chunk; + } else { + this.html = chunk; + } + + this.lastCharPos = this.html.length - 1; + this.endOfChunkHit = false; + this.lastChunkWritten = isLastChunk; + } + + insertHtmlAtCurrentPos(chunk) { + this.html = this.html.substring(0, this.pos + 1) + chunk + this.html.substring(this.pos + 1, this.html.length); + + this.lastCharPos = this.html.length - 1; + this.endOfChunkHit = false; + } + + advance() { + this.pos++; + + if (this.pos > this.lastCharPos) { + this.endOfChunkHit = !this.lastChunkWritten; + return $.EOF; + } + + let cp = this.html.charCodeAt(this.pos); + + //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character + //must be ignored. + if (this.skipNextNewLine && cp === $.LINE_FEED) { + this.skipNextNewLine = false; + this._addGap(); + return this.advance(); + } + + //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters + if (cp === $.CARRIAGE_RETURN) { + this.skipNextNewLine = true; + return $.LINE_FEED; + } + + this.skipNextNewLine = false; + + if (unicode.isSurrogate(cp)) { + cp = this._processSurrogate(cp); + } + + //OPTIMIZATION: first check if code point is in the common allowed + //range (ASCII alphanumeric, whitespaces, big chunk of BMP) + //before going into detailed performance cost validation. + const isCommonValidRange = + (cp > 0x1f && cp < 0x7f) || cp === $.LINE_FEED || cp === $.CARRIAGE_RETURN || (cp > 0x9f && cp < 0xfdd0); + + if (!isCommonValidRange) { + this._checkForProblematicCharacters(cp); + } + + return cp; + } + + _checkForProblematicCharacters(cp) { + if (unicode.isControlCodePoint(cp)) { + this._err(ERR.controlCharacterInInputStream); + } else if (unicode.isUndefinedCodePoint(cp)) { + this._err(ERR.noncharacterInInputStream); + } + } + + retreat() { + if (this.pos === this.lastGapPos) { + this.lastGapPos = this.gapStack.pop(); + this.pos--; + } + + this.pos--; + } +} + +module.exports = Preprocessor; + + +/***/ }), +/* 7 */ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +const UNDEFINED_CODE_POINTS = [ + 0xfffe, + 0xffff, + 0x1fffe, + 0x1ffff, + 0x2fffe, + 0x2ffff, + 0x3fffe, + 0x3ffff, + 0x4fffe, + 0x4ffff, + 0x5fffe, + 0x5ffff, + 0x6fffe, + 0x6ffff, + 0x7fffe, + 0x7ffff, + 0x8fffe, + 0x8ffff, + 0x9fffe, + 0x9ffff, + 0xafffe, + 0xaffff, + 0xbfffe, + 0xbffff, + 0xcfffe, + 0xcffff, + 0xdfffe, + 0xdffff, + 0xefffe, + 0xeffff, + 0xffffe, + 0xfffff, + 0x10fffe, + 0x10ffff +]; + +exports.REPLACEMENT_CHARACTER = '\uFFFD'; + +exports.CODE_POINTS = { + EOF: -1, + NULL: 0x00, + TABULATION: 0x09, + CARRIAGE_RETURN: 0x0d, + LINE_FEED: 0x0a, + FORM_FEED: 0x0c, + SPACE: 0x20, + EXCLAMATION_MARK: 0x21, + QUOTATION_MARK: 0x22, + NUMBER_SIGN: 0x23, + AMPERSAND: 0x26, + APOSTROPHE: 0x27, + HYPHEN_MINUS: 0x2d, + SOLIDUS: 0x2f, + DIGIT_0: 0x30, + DIGIT_9: 0x39, + SEMICOLON: 0x3b, + LESS_THAN_SIGN: 0x3c, + EQUALS_SIGN: 0x3d, + GREATER_THAN_SIGN: 0x3e, + QUESTION_MARK: 0x3f, + LATIN_CAPITAL_A: 0x41, + LATIN_CAPITAL_F: 0x46, + LATIN_CAPITAL_X: 0x58, + LATIN_CAPITAL_Z: 0x5a, + RIGHT_SQUARE_BRACKET: 0x5d, + GRAVE_ACCENT: 0x60, + LATIN_SMALL_A: 0x61, + LATIN_SMALL_F: 0x66, + LATIN_SMALL_X: 0x78, + LATIN_SMALL_Z: 0x7a, + REPLACEMENT_CHARACTER: 0xfffd +}; + +exports.CODE_POINT_SEQUENCES = { + DASH_DASH_STRING: [0x2d, 0x2d], //-- + DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE + CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[ + SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script + PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC + SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM +}; + +//Surrogates +exports.isSurrogate = function(cp) { + return cp >= 0xd800 && cp <= 0xdfff; +}; + +exports.isSurrogatePair = function(cp) { + return cp >= 0xdc00 && cp <= 0xdfff; +}; + +exports.getSurrogatePairCodePoint = function(cp1, cp2) { + return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2; +}; + +//NOTE: excluding NULL and ASCII whitespace +exports.isControlCodePoint = function(cp) { + return ( + (cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) || + (cp >= 0x7f && cp <= 0x9f) + ); +}; + +exports.isUndefinedCodePoint = function(cp) { + return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1; +}; + + +/***/ }), +/* 8 */ +/***/ ((module) => { + +"use strict"; + + +module.exports = { + controlCharacterInInputStream: 'control-character-in-input-stream', + noncharacterInInputStream: 'noncharacter-in-input-stream', + surrogateInInputStream: 'surrogate-in-input-stream', + nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus', + endTagWithAttributes: 'end-tag-with-attributes', + endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus', + unexpectedSolidusInTag: 'unexpected-solidus-in-tag', + unexpectedNullCharacter: 'unexpected-null-character', + unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name', + invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name', + unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name', + missingEndTagName: 'missing-end-tag-name', + unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name', + unknownNamedCharacterReference: 'unknown-named-character-reference', + missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference', + unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier', + unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value', + eofBeforeTagName: 'eof-before-tag-name', + eofInTag: 'eof-in-tag', + missingAttributeValue: 'missing-attribute-value', + missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes', + missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword', + missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: + 'missing-whitespace-between-doctype-public-and-system-identifiers', + missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword', + missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier', + missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier', + missingDoctypePublicIdentifier: 'missing-doctype-public-identifier', + missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier', + abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier', + abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier', + cdataInHtmlContent: 'cdata-in-html-content', + incorrectlyOpenedComment: 'incorrectly-opened-comment', + eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text', + eofInDoctype: 'eof-in-doctype', + nestedComment: 'nested-comment', + abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment', + eofInComment: 'eof-in-comment', + incorrectlyClosedComment: 'incorrectly-closed-comment', + eofInCdata: 'eof-in-cdata', + absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference', + nullCharacterReference: 'null-character-reference', + surrogateCharacterReference: 'surrogate-character-reference', + characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range', + controlCharacterReference: 'control-character-reference', + noncharacterCharacterReference: 'noncharacter-character-reference', + missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name', + missingDoctypeName: 'missing-doctype-name', + invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name', + duplicateAttribute: 'duplicate-attribute', + nonConformingDoctype: 'non-conforming-doctype', + missingDoctype: 'missing-doctype', + misplacedDoctype: 'misplaced-doctype', + endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element', + closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements', + disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head', + openElementsLeftAfterEof: 'open-elements-left-after-eof', + abandonedHeadElementChild: 'abandoned-head-element-child', + misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element', + nestedNoscriptInHead: 'nested-noscript-in-head', + eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text' +}; + + +/***/ }), +/* 9 */ +/***/ ((module) => { + +"use strict"; + + +//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption +//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate-named-entity-data/README.md) +module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); + +/***/ }), +/* 10 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const HTML = __webpack_require__(11); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; + +//Element utils + +//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. +//It's faster than using dictionary. +function isImpliedEndTagRequired(tn) { + switch (tn.length) { + case 1: + return tn === $.P; + + case 2: + return tn === $.RB || tn === $.RP || tn === $.RT || tn === $.DD || tn === $.DT || tn === $.LI; + + case 3: + return tn === $.RTC; + + case 6: + return tn === $.OPTION; + + case 8: + return tn === $.OPTGROUP; + } + + return false; +} + +function isImpliedEndTagRequiredThoroughly(tn) { + switch (tn.length) { + case 1: + return tn === $.P; + + case 2: + return ( + tn === $.RB || + tn === $.RP || + tn === $.RT || + tn === $.DD || + tn === $.DT || + tn === $.LI || + tn === $.TD || + tn === $.TH || + tn === $.TR + ); + + case 3: + return tn === $.RTC; + + case 5: + return tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD; + + case 6: + return tn === $.OPTION; + + case 7: + return tn === $.CAPTION; + + case 8: + return tn === $.OPTGROUP || tn === $.COLGROUP; + } + + return false; +} + +function isScopingElement(tn, ns) { + switch (tn.length) { + case 2: + if (tn === $.TD || tn === $.TH) { + return ns === NS.HTML; + } else if (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS) { + return ns === NS.MATHML; + } + + break; + + case 4: + if (tn === $.HTML) { + return ns === NS.HTML; + } else if (tn === $.DESC) { + return ns === NS.SVG; + } + + break; + + case 5: + if (tn === $.TABLE) { + return ns === NS.HTML; + } else if (tn === $.MTEXT) { + return ns === NS.MATHML; + } else if (tn === $.TITLE) { + return ns === NS.SVG; + } + + break; + + case 6: + return (tn === $.APPLET || tn === $.OBJECT) && ns === NS.HTML; + + case 7: + return (tn === $.CAPTION || tn === $.MARQUEE) && ns === NS.HTML; + + case 8: + return tn === $.TEMPLATE && ns === NS.HTML; + + case 13: + return tn === $.FOREIGN_OBJECT && ns === NS.SVG; + + case 14: + return tn === $.ANNOTATION_XML && ns === NS.MATHML; + } + + return false; +} + +//Stack of open elements +class OpenElementStack { + constructor(document, treeAdapter) { + this.stackTop = -1; + this.items = []; + this.current = document; + this.currentTagName = null; + this.currentTmplContent = null; + this.tmplCount = 0; + this.treeAdapter = treeAdapter; + } + + //Index of element + _indexOf(element) { + let idx = -1; + + for (let i = this.stackTop; i >= 0; i--) { + if (this.items[i] === element) { + idx = i; + break; + } + } + return idx; + } + + //Update current element + _isInTemplate() { + return this.currentTagName === $.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML; + } + + _updateCurrentElement() { + this.current = this.items[this.stackTop]; + this.currentTagName = this.current && this.treeAdapter.getTagName(this.current); + + this.currentTmplContent = this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : null; + } + + //Mutations + push(element) { + this.items[++this.stackTop] = element; + this._updateCurrentElement(); + + if (this._isInTemplate()) { + this.tmplCount++; + } + } + + pop() { + this.stackTop--; + + if (this.tmplCount > 0 && this._isInTemplate()) { + this.tmplCount--; + } + + this._updateCurrentElement(); + } + + replace(oldElement, newElement) { + const idx = this._indexOf(oldElement); + + this.items[idx] = newElement; + + if (idx === this.stackTop) { + this._updateCurrentElement(); + } + } + + insertAfter(referenceElement, newElement) { + const insertionIdx = this._indexOf(referenceElement) + 1; + + this.items.splice(insertionIdx, 0, newElement); + + if (insertionIdx === ++this.stackTop) { + this._updateCurrentElement(); + } + } + + popUntilTagNamePopped(tagName) { + while (this.stackTop > -1) { + const tn = this.currentTagName; + const ns = this.treeAdapter.getNamespaceURI(this.current); + + this.pop(); + + if (tn === tagName && ns === NS.HTML) { + break; + } + } + } + + popUntilElementPopped(element) { + while (this.stackTop > -1) { + const poppedElement = this.current; + + this.pop(); + + if (poppedElement === element) { + break; + } + } + } + + popUntilNumberedHeaderPopped() { + while (this.stackTop > -1) { + const tn = this.currentTagName; + const ns = this.treeAdapter.getNamespaceURI(this.current); + + this.pop(); + + if ( + tn === $.H1 || + tn === $.H2 || + tn === $.H3 || + tn === $.H4 || + tn === $.H5 || + (tn === $.H6 && ns === NS.HTML) + ) { + break; + } + } + } + + popUntilTableCellPopped() { + while (this.stackTop > -1) { + const tn = this.currentTagName; + const ns = this.treeAdapter.getNamespaceURI(this.current); + + this.pop(); + + if (tn === $.TD || (tn === $.TH && ns === NS.HTML)) { + break; + } + } + } + + popAllUpToHtmlElement() { + //NOTE: here we assume that root element is always first in the open element stack, so + //we perform this fast stack clean up. + this.stackTop = 0; + this._updateCurrentElement(); + } + + clearBackToTableContext() { + while ( + (this.currentTagName !== $.TABLE && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) || + this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML + ) { + this.pop(); + } + } + + clearBackToTableBodyContext() { + while ( + (this.currentTagName !== $.TBODY && + this.currentTagName !== $.TFOOT && + this.currentTagName !== $.THEAD && + this.currentTagName !== $.TEMPLATE && + this.currentTagName !== $.HTML) || + this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML + ) { + this.pop(); + } + } + + clearBackToTableRowContext() { + while ( + (this.currentTagName !== $.TR && this.currentTagName !== $.TEMPLATE && this.currentTagName !== $.HTML) || + this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML + ) { + this.pop(); + } + } + + remove(element) { + for (let i = this.stackTop; i >= 0; i--) { + if (this.items[i] === element) { + this.items.splice(i, 1); + this.stackTop--; + this._updateCurrentElement(); + break; + } + } + } + + //Search + tryPeekProperlyNestedBodyElement() { + //Properly nested element (should be second element in stack). + const element = this.items[1]; + + return element && this.treeAdapter.getTagName(element) === $.BODY ? element : null; + } + + contains(element) { + return this._indexOf(element) > -1; + } + + getCommonAncestor(element) { + let elementIdx = this._indexOf(element); + + return --elementIdx >= 0 ? this.items[elementIdx] : null; + } + + isRootHtmlElementCurrent() { + return this.stackTop === 0 && this.currentTagName === $.HTML; + } + + //Element in scope + hasInScope(tagName) { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (tn === tagName && ns === NS.HTML) { + return true; + } + + if (isScopingElement(tn, ns)) { + return false; + } + } + + return true; + } + + hasNumberedHeaderInScope() { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if ( + (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) && + ns === NS.HTML + ) { + return true; + } + + if (isScopingElement(tn, ns)) { + return false; + } + } + + return true; + } + + hasInListItemScope(tagName) { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (tn === tagName && ns === NS.HTML) { + return true; + } + + if (((tn === $.UL || tn === $.OL) && ns === NS.HTML) || isScopingElement(tn, ns)) { + return false; + } + } + + return true; + } + + hasInButtonScope(tagName) { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (tn === tagName && ns === NS.HTML) { + return true; + } + + if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) { + return false; + } + } + + return true; + } + + hasInTableScope(tagName) { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (ns !== NS.HTML) { + continue; + } + + if (tn === tagName) { + return true; + } + + if (tn === $.TABLE || tn === $.TEMPLATE || tn === $.HTML) { + return false; + } + } + + return true; + } + + hasTableBodyContextInTableScope() { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (ns !== NS.HTML) { + continue; + } + + if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) { + return true; + } + + if (tn === $.TABLE || tn === $.HTML) { + return false; + } + } + + return true; + } + + hasInSelectScope(tagName) { + for (let i = this.stackTop; i >= 0; i--) { + const tn = this.treeAdapter.getTagName(this.items[i]); + const ns = this.treeAdapter.getNamespaceURI(this.items[i]); + + if (ns !== NS.HTML) { + continue; + } + + if (tn === tagName) { + return true; + } + + if (tn !== $.OPTION && tn !== $.OPTGROUP) { + return false; + } + } + + return true; + } + + //Implied end tags + generateImpliedEndTags() { + while (isImpliedEndTagRequired(this.currentTagName)) { + this.pop(); + } + } + + generateImpliedEndTagsThoroughly() { + while (isImpliedEndTagRequiredThoroughly(this.currentTagName)) { + this.pop(); + } + } + + generateImpliedEndTagsWithExclusion(exclusionTagName) { + while (isImpliedEndTagRequired(this.currentTagName) && this.currentTagName !== exclusionTagName) { + this.pop(); + } + } +} + +module.exports = OpenElementStack; + + +/***/ }), +/* 11 */ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +const NS = (exports.NAMESPACES = { + HTML: 'http://www.w3.org/1999/xhtml', + MATHML: 'http://www.w3.org/1998/Math/MathML', + SVG: 'http://www.w3.org/2000/svg', + XLINK: 'http://www.w3.org/1999/xlink', + XML: 'http://www.w3.org/XML/1998/namespace', + XMLNS: 'http://www.w3.org/2000/xmlns/' +}); + +exports.ATTRS = { + TYPE: 'type', + ACTION: 'action', + ENCODING: 'encoding', + PROMPT: 'prompt', + NAME: 'name', + COLOR: 'color', + FACE: 'face', + SIZE: 'size' +}; + +exports.DOCUMENT_MODE = { + NO_QUIRKS: 'no-quirks', + QUIRKS: 'quirks', + LIMITED_QUIRKS: 'limited-quirks' +}; + +const $ = (exports.TAG_NAMES = { + A: 'a', + ADDRESS: 'address', + ANNOTATION_XML: 'annotation-xml', + APPLET: 'applet', + AREA: 'area', + ARTICLE: 'article', + ASIDE: 'aside', + + B: 'b', + BASE: 'base', + BASEFONT: 'basefont', + BGSOUND: 'bgsound', + BIG: 'big', + BLOCKQUOTE: 'blockquote', + BODY: 'body', + BR: 'br', + BUTTON: 'button', + + CAPTION: 'caption', + CENTER: 'center', + CODE: 'code', + COL: 'col', + COLGROUP: 'colgroup', + + DD: 'dd', + DESC: 'desc', + DETAILS: 'details', + DIALOG: 'dialog', + DIR: 'dir', + DIV: 'div', + DL: 'dl', + DT: 'dt', + + EM: 'em', + EMBED: 'embed', + + FIELDSET: 'fieldset', + FIGCAPTION: 'figcaption', + FIGURE: 'figure', + FONT: 'font', + FOOTER: 'footer', + FOREIGN_OBJECT: 'foreignObject', + FORM: 'form', + FRAME: 'frame', + FRAMESET: 'frameset', + + H1: 'h1', + H2: 'h2', + H3: 'h3', + H4: 'h4', + H5: 'h5', + H6: 'h6', + HEAD: 'head', + HEADER: 'header', + HGROUP: 'hgroup', + HR: 'hr', + HTML: 'html', + + I: 'i', + IMG: 'img', + IMAGE: 'image', + INPUT: 'input', + IFRAME: 'iframe', + + KEYGEN: 'keygen', + + LABEL: 'label', + LI: 'li', + LINK: 'link', + LISTING: 'listing', + + MAIN: 'main', + MALIGNMARK: 'malignmark', + MARQUEE: 'marquee', + MATH: 'math', + MENU: 'menu', + META: 'meta', + MGLYPH: 'mglyph', + MI: 'mi', + MO: 'mo', + MN: 'mn', + MS: 'ms', + MTEXT: 'mtext', + + NAV: 'nav', + NOBR: 'nobr', + NOFRAMES: 'noframes', + NOEMBED: 'noembed', + NOSCRIPT: 'noscript', + + OBJECT: 'object', + OL: 'ol', + OPTGROUP: 'optgroup', + OPTION: 'option', + + P: 'p', + PARAM: 'param', + PLAINTEXT: 'plaintext', + PRE: 'pre', + + RB: 'rb', + RP: 'rp', + RT: 'rt', + RTC: 'rtc', + RUBY: 'ruby', + + S: 's', + SCRIPT: 'script', + SECTION: 'section', + SELECT: 'select', + SOURCE: 'source', + SMALL: 'small', + SPAN: 'span', + STRIKE: 'strike', + STRONG: 'strong', + STYLE: 'style', + SUB: 'sub', + SUMMARY: 'summary', + SUP: 'sup', + + TABLE: 'table', + TBODY: 'tbody', + TEMPLATE: 'template', + TEXTAREA: 'textarea', + TFOOT: 'tfoot', + TD: 'td', + TH: 'th', + THEAD: 'thead', + TITLE: 'title', + TR: 'tr', + TRACK: 'track', + TT: 'tt', + + U: 'u', + UL: 'ul', + + SVG: 'svg', + + VAR: 'var', + + WBR: 'wbr', + + XMP: 'xmp' +}); + +exports.SPECIAL_ELEMENTS = { + [NS.HTML]: { + [$.ADDRESS]: true, + [$.APPLET]: true, + [$.AREA]: true, + [$.ARTICLE]: true, + [$.ASIDE]: true, + [$.BASE]: true, + [$.BASEFONT]: true, + [$.BGSOUND]: true, + [$.BLOCKQUOTE]: true, + [$.BODY]: true, + [$.BR]: true, + [$.BUTTON]: true, + [$.CAPTION]: true, + [$.CENTER]: true, + [$.COL]: true, + [$.COLGROUP]: true, + [$.DD]: true, + [$.DETAILS]: true, + [$.DIR]: true, + [$.DIV]: true, + [$.DL]: true, + [$.DT]: true, + [$.EMBED]: true, + [$.FIELDSET]: true, + [$.FIGCAPTION]: true, + [$.FIGURE]: true, + [$.FOOTER]: true, + [$.FORM]: true, + [$.FRAME]: true, + [$.FRAMESET]: true, + [$.H1]: true, + [$.H2]: true, + [$.H3]: true, + [$.H4]: true, + [$.H5]: true, + [$.H6]: true, + [$.HEAD]: true, + [$.HEADER]: true, + [$.HGROUP]: true, + [$.HR]: true, + [$.HTML]: true, + [$.IFRAME]: true, + [$.IMG]: true, + [$.INPUT]: true, + [$.LI]: true, + [$.LINK]: true, + [$.LISTING]: true, + [$.MAIN]: true, + [$.MARQUEE]: true, + [$.MENU]: true, + [$.META]: true, + [$.NAV]: true, + [$.NOEMBED]: true, + [$.NOFRAMES]: true, + [$.NOSCRIPT]: true, + [$.OBJECT]: true, + [$.OL]: true, + [$.P]: true, + [$.PARAM]: true, + [$.PLAINTEXT]: true, + [$.PRE]: true, + [$.SCRIPT]: true, + [$.SECTION]: true, + [$.SELECT]: true, + [$.SOURCE]: true, + [$.STYLE]: true, + [$.SUMMARY]: true, + [$.TABLE]: true, + [$.TBODY]: true, + [$.TD]: true, + [$.TEMPLATE]: true, + [$.TEXTAREA]: true, + [$.TFOOT]: true, + [$.TH]: true, + [$.THEAD]: true, + [$.TITLE]: true, + [$.TR]: true, + [$.TRACK]: true, + [$.UL]: true, + [$.WBR]: true, + [$.XMP]: true + }, + [NS.MATHML]: { + [$.MI]: true, + [$.MO]: true, + [$.MN]: true, + [$.MS]: true, + [$.MTEXT]: true, + [$.ANNOTATION_XML]: true + }, + [NS.SVG]: { + [$.TITLE]: true, + [$.FOREIGN_OBJECT]: true, + [$.DESC]: true + } +}; + + +/***/ }), +/* 12 */ +/***/ ((module) => { + +"use strict"; + + +//Const +const NOAH_ARK_CAPACITY = 3; + +//List of formatting elements +class FormattingElementList { + constructor(treeAdapter) { + this.length = 0; + this.entries = []; + this.treeAdapter = treeAdapter; + this.bookmark = null; + } + + //Noah Ark's condition + //OPTIMIZATION: at first we try to find possible candidates for exclusion using + //lightweight heuristics without thorough attributes check. + _getNoahArkConditionCandidates(newElement) { + const candidates = []; + + if (this.length >= NOAH_ARK_CAPACITY) { + const neAttrsLength = this.treeAdapter.getAttrList(newElement).length; + const neTagName = this.treeAdapter.getTagName(newElement); + const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); + + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + break; + } + + const element = entry.element; + const elementAttrs = this.treeAdapter.getAttrList(element); + + const isCandidate = + this.treeAdapter.getTagName(element) === neTagName && + this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && + elementAttrs.length === neAttrsLength; + + if (isCandidate) { + candidates.push({ idx: i, attrs: elementAttrs }); + } + } + } + + return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; + } + + _ensureNoahArkCondition(newElement) { + const candidates = this._getNoahArkConditionCandidates(newElement); + let cLength = candidates.length; + + if (cLength) { + const neAttrs = this.treeAdapter.getAttrList(newElement); + const neAttrsLength = neAttrs.length; + const neAttrsMap = Object.create(null); + + //NOTE: build attrs map for the new element so we can perform fast lookups + for (let i = 0; i < neAttrsLength; i++) { + const neAttr = neAttrs[i]; + + neAttrsMap[neAttr.name] = neAttr.value; + } + + for (let i = 0; i < neAttrsLength; i++) { + for (let j = 0; j < cLength; j++) { + const cAttr = candidates[j].attrs[i]; + + if (neAttrsMap[cAttr.name] !== cAttr.value) { + candidates.splice(j, 1); + cLength--; + } + + if (candidates.length < NOAH_ARK_CAPACITY) { + return; + } + } + } + + //NOTE: remove bottommost candidates until Noah's Ark condition will not be met + for (let i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { + this.entries.splice(candidates[i].idx, 1); + this.length--; + } + } + } + + //Mutations + insertMarker() { + this.entries.push({ type: FormattingElementList.MARKER_ENTRY }); + this.length++; + } + + pushElement(element, token) { + this._ensureNoahArkCondition(element); + + this.entries.push({ + type: FormattingElementList.ELEMENT_ENTRY, + element: element, + token: token + }); + + this.length++; + } + + insertElementAfterBookmark(element, token) { + let bookmarkIdx = this.length - 1; + + for (; bookmarkIdx >= 0; bookmarkIdx--) { + if (this.entries[bookmarkIdx] === this.bookmark) { + break; + } + } + + this.entries.splice(bookmarkIdx + 1, 0, { + type: FormattingElementList.ELEMENT_ENTRY, + element: element, + token: token + }); + + this.length++; + } + + removeEntry(entry) { + for (let i = this.length - 1; i >= 0; i--) { + if (this.entries[i] === entry) { + this.entries.splice(i, 1); + this.length--; + break; + } + } + } + + clearToLastMarker() { + while (this.length) { + const entry = this.entries.pop(); + + this.length--; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + break; + } + } + } + + //Search + getElementEntryInScopeWithTagName(tagName) { + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + return null; + } + + if (this.treeAdapter.getTagName(entry.element) === tagName) { + return entry; + } + } + + return null; + } + + getElementEntry(element) { + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) { + return entry; + } + } + + return null; + } +} + +//Entry types +FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; +FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; + +module.exports = FormattingElementList; + + +/***/ }), +/* 13 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(14); +const Tokenizer = __webpack_require__(5); +const LocationInfoTokenizerMixin = __webpack_require__(15); +const LocationInfoOpenElementStackMixin = __webpack_require__(17); +const HTML = __webpack_require__(11); + +//Aliases +const $ = HTML.TAG_NAMES; + +class LocationInfoParserMixin extends Mixin { + constructor(parser) { + super(parser); + + this.parser = parser; + this.treeAdapter = this.parser.treeAdapter; + this.posTracker = null; + this.lastStartTagToken = null; + this.lastFosterParentingLocation = null; + this.currentToken = null; + } + + _setStartLocation(element) { + let loc = null; + + if (this.lastStartTagToken) { + loc = Object.assign({}, this.lastStartTagToken.location); + loc.startTag = this.lastStartTagToken.location; + } + + this.treeAdapter.setNodeSourceCodeLocation(element, loc); + } + + _setEndLocation(element, closingToken) { + const loc = this.treeAdapter.getNodeSourceCodeLocation(element); + + if (loc) { + if (closingToken.location) { + const ctLoc = closingToken.location; + const tn = this.treeAdapter.getTagName(element); + + // NOTE: For cases like
- First 'p' closes without a closing + // tag and for cases like
- 'p' closes without a closing tag. + const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName; + const endLoc = {}; + if (isClosingEndTag) { + endLoc.endTag = Object.assign({}, ctLoc); + endLoc.endLine = ctLoc.endLine; + endLoc.endCol = ctLoc.endCol; + endLoc.endOffset = ctLoc.endOffset; + } else { + endLoc.endLine = ctLoc.startLine; + endLoc.endCol = ctLoc.startCol; + endLoc.endOffset = ctLoc.startOffset; + } + + this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc); + } + } + } + + _getOverriddenMethods(mxn, orig) { + return { + _bootstrap(document, fragmentContext) { + orig._bootstrap.call(this, document, fragmentContext); + + mxn.lastStartTagToken = null; + mxn.lastFosterParentingLocation = null; + mxn.currentToken = null; + + const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); + + mxn.posTracker = tokenizerMixin.posTracker; + + Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, { + onItemPop: function(element) { + mxn._setEndLocation(element, mxn.currentToken); + } + }); + }, + + _runParsingLoop(scriptHandler) { + orig._runParsingLoop.call(this, scriptHandler); + + // NOTE: generate location info for elements + // that remains on open element stack + for (let i = this.openElements.stackTop; i >= 0; i--) { + mxn._setEndLocation(this.openElements.items[i], mxn.currentToken); + } + }, + + //Token processing + _processTokenInForeignContent(token) { + mxn.currentToken = token; + orig._processTokenInForeignContent.call(this, token); + }, + + _processToken(token) { + mxn.currentToken = token; + orig._processToken.call(this, token); + + //NOTE: and are never popped from the stack, so we need to updated + //their end location explicitly. + const requireExplicitUpdate = + token.type === Tokenizer.END_TAG_TOKEN && + (token.tagName === $.HTML || (token.tagName === $.BODY && this.openElements.hasInScope($.BODY))); + + if (requireExplicitUpdate) { + for (let i = this.openElements.stackTop; i >= 0; i--) { + const element = this.openElements.items[i]; + + if (this.treeAdapter.getTagName(element) === token.tagName) { + mxn._setEndLocation(element, token); + break; + } + } + } + }, + + //Doctype + _setDocumentType(token) { + orig._setDocumentType.call(this, token); + + const documentChildren = this.treeAdapter.getChildNodes(this.document); + const cnLength = documentChildren.length; + + for (let i = 0; i < cnLength; i++) { + const node = documentChildren[i]; + + if (this.treeAdapter.isDocumentTypeNode(node)) { + this.treeAdapter.setNodeSourceCodeLocation(node, token.location); + break; + } + } + }, + + //Elements + _attachElementToTree(element) { + //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. + //So we will use token location stored in this methods for the element. + mxn._setStartLocation(element); + mxn.lastStartTagToken = null; + orig._attachElementToTree.call(this, element); + }, + + _appendElement(token, namespaceURI) { + mxn.lastStartTagToken = token; + orig._appendElement.call(this, token, namespaceURI); + }, + + _insertElement(token, namespaceURI) { + mxn.lastStartTagToken = token; + orig._insertElement.call(this, token, namespaceURI); + }, + + _insertTemplate(token) { + mxn.lastStartTagToken = token; + orig._insertTemplate.call(this, token); + + const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); + + this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null); + }, + + _insertFakeRootElement() { + orig._insertFakeRootElement.call(this); + this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null); + }, + + //Comments + _appendCommentNode(token, parent) { + orig._appendCommentNode.call(this, token, parent); + + const children = this.treeAdapter.getChildNodes(parent); + const commentNode = children[children.length - 1]; + + this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location); + }, + + //Text + _findFosterParentingLocation() { + //NOTE: store last foster parenting location, so we will be able to find inserted text + //in case of foster parenting + mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this); + + return mxn.lastFosterParentingLocation; + }, + + _insertCharacters(token) { + orig._insertCharacters.call(this, token); + + const hasFosterParent = this._shouldFosterParentOnInsertion(); + + const parent = + (hasFosterParent && mxn.lastFosterParentingLocation.parent) || + this.openElements.currentTmplContent || + this.openElements.current; + + const siblings = this.treeAdapter.getChildNodes(parent); + + const textNodeIdx = + hasFosterParent && mxn.lastFosterParentingLocation.beforeElement + ? siblings.indexOf(mxn.lastFosterParentingLocation.beforeElement) - 1 + : siblings.length - 1; + + const textNode = siblings[textNodeIdx]; + + //NOTE: if we have location assigned by another token, then just update end position + const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode); + + if (tnLoc) { + const { endLine, endCol, endOffset } = token.location; + this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset }); + } else { + this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location); + } + } + }; + } +} + +module.exports = LocationInfoParserMixin; + + +/***/ }), +/* 14 */ +/***/ ((module) => { + +"use strict"; + + +class Mixin { + constructor(host) { + const originalMethods = {}; + const overriddenMethods = this._getOverriddenMethods(this, originalMethods); + + for (const key of Object.keys(overriddenMethods)) { + if (typeof overriddenMethods[key] === 'function') { + originalMethods[key] = host[key]; + host[key] = overriddenMethods[key]; + } + } + } + + _getOverriddenMethods() { + throw new Error('Not implemented'); + } +} + +Mixin.install = function(host, Ctor, opts) { + if (!host.__mixins) { + host.__mixins = []; + } + + for (let i = 0; i < host.__mixins.length; i++) { + if (host.__mixins[i].constructor === Ctor) { + return host.__mixins[i]; + } + } + + const mixin = new Ctor(host, opts); + + host.__mixins.push(mixin); + + return mixin; +}; + +module.exports = Mixin; + + +/***/ }), +/* 15 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(14); +const Tokenizer = __webpack_require__(5); +const PositionTrackingPreprocessorMixin = __webpack_require__(16); + +class LocationInfoTokenizerMixin extends Mixin { + constructor(tokenizer) { + super(tokenizer); + + this.tokenizer = tokenizer; + this.posTracker = Mixin.install(tokenizer.preprocessor, PositionTrackingPreprocessorMixin); + this.currentAttrLocation = null; + this.ctLoc = null; + } + + _getCurrentLocation() { + return { + startLine: this.posTracker.line, + startCol: this.posTracker.col, + startOffset: this.posTracker.offset, + endLine: -1, + endCol: -1, + endOffset: -1 + }; + } + + _attachCurrentAttrLocationInfo() { + this.currentAttrLocation.endLine = this.posTracker.line; + this.currentAttrLocation.endCol = this.posTracker.col; + this.currentAttrLocation.endOffset = this.posTracker.offset; + + const currentToken = this.tokenizer.currentToken; + const currentAttr = this.tokenizer.currentAttr; + + if (!currentToken.location.attrs) { + currentToken.location.attrs = Object.create(null); + } + + currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation; + } + + _getOverriddenMethods(mxn, orig) { + const methods = { + _createStartTagToken() { + orig._createStartTagToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createEndTagToken() { + orig._createEndTagToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createCommentToken() { + orig._createCommentToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createDoctypeToken(initialName) { + orig._createDoctypeToken.call(this, initialName); + this.currentToken.location = mxn.ctLoc; + }, + + _createCharacterToken(type, ch) { + orig._createCharacterToken.call(this, type, ch); + this.currentCharacterToken.location = mxn.ctLoc; + }, + + _createEOFToken() { + orig._createEOFToken.call(this); + this.currentToken.location = mxn._getCurrentLocation(); + }, + + _createAttr(attrNameFirstCh) { + orig._createAttr.call(this, attrNameFirstCh); + mxn.currentAttrLocation = mxn._getCurrentLocation(); + }, + + _leaveAttrName(toState) { + orig._leaveAttrName.call(this, toState); + mxn._attachCurrentAttrLocationInfo(); + }, + + _leaveAttrValue(toState) { + orig._leaveAttrValue.call(this, toState); + mxn._attachCurrentAttrLocationInfo(); + }, + + _emitCurrentToken() { + const ctLoc = this.currentToken.location; + + //NOTE: if we have pending character token make it's end location equal to the + //current token's start location. + if (this.currentCharacterToken) { + this.currentCharacterToken.location.endLine = ctLoc.startLine; + this.currentCharacterToken.location.endCol = ctLoc.startCol; + this.currentCharacterToken.location.endOffset = ctLoc.startOffset; + } + + if (this.currentToken.type === Tokenizer.EOF_TOKEN) { + ctLoc.endLine = ctLoc.startLine; + ctLoc.endCol = ctLoc.startCol; + ctLoc.endOffset = ctLoc.startOffset; + } else { + ctLoc.endLine = mxn.posTracker.line; + ctLoc.endCol = mxn.posTracker.col + 1; + ctLoc.endOffset = mxn.posTracker.offset + 1; + } + + orig._emitCurrentToken.call(this); + }, + + _emitCurrentCharacterToken() { + const ctLoc = this.currentCharacterToken && this.currentCharacterToken.location; + + //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), + //then set it's location at the current preprocessor position. + //We don't need to increment preprocessor position, since character token + //emission is always forced by the start of the next character token here. + //So, we already have advanced position. + if (ctLoc && ctLoc.endOffset === -1) { + ctLoc.endLine = mxn.posTracker.line; + ctLoc.endCol = mxn.posTracker.col; + ctLoc.endOffset = mxn.posTracker.offset; + } + + orig._emitCurrentCharacterToken.call(this); + } + }; + + //NOTE: patch initial states for each mode to obtain token start position + Object.keys(Tokenizer.MODE).forEach(modeName => { + const state = Tokenizer.MODE[modeName]; + + methods[state] = function(cp) { + mxn.ctLoc = mxn._getCurrentLocation(); + orig[state].call(this, cp); + }; + }); + + return methods; + } +} + +module.exports = LocationInfoTokenizerMixin; + + +/***/ }), +/* 16 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(14); + +class PositionTrackingPreprocessorMixin extends Mixin { + constructor(preprocessor) { + super(preprocessor); + + this.preprocessor = preprocessor; + this.isEol = false; + this.lineStartPos = 0; + this.droppedBufferSize = 0; + + this.offset = 0; + this.col = 0; + this.line = 1; + } + + _getOverriddenMethods(mxn, orig) { + return { + advance() { + const pos = this.pos + 1; + const ch = this.html[pos]; + + //NOTE: LF should be in the last column of the line + if (mxn.isEol) { + mxn.isEol = false; + mxn.line++; + mxn.lineStartPos = pos; + } + + if (ch === '\n' || (ch === '\r' && this.html[pos + 1] !== '\n')) { + mxn.isEol = true; + } + + mxn.col = pos - mxn.lineStartPos + 1; + mxn.offset = mxn.droppedBufferSize + pos; + + return orig.advance.call(this); + }, + + retreat() { + orig.retreat.call(this); + + mxn.isEol = false; + mxn.col = this.pos - mxn.lineStartPos + 1; + }, + + dropParsedChunk() { + const prevPos = this.pos; + + orig.dropParsedChunk.call(this); + + const reduction = prevPos - this.pos; + + mxn.lineStartPos -= reduction; + mxn.droppedBufferSize += reduction; + mxn.offset = mxn.droppedBufferSize + this.pos; + } + }; + } +} + +module.exports = PositionTrackingPreprocessorMixin; + + +/***/ }), +/* 17 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(14); + +class LocationInfoOpenElementStackMixin extends Mixin { + constructor(stack, opts) { + super(stack); + + this.onItemPop = opts.onItemPop; + } + + _getOverriddenMethods(mxn, orig) { + return { + pop() { + mxn.onItemPop(this.current); + orig.pop.call(this); + }, + + popAllUpToHtmlElement() { + for (let i = this.stackTop; i > 0; i--) { + mxn.onItemPop(this.items[i]); + } + + orig.popAllUpToHtmlElement.call(this); + }, + + remove(element) { + mxn.onItemPop(this.current); + orig.remove.call(this, element); + } + }; + } +} + +module.exports = LocationInfoOpenElementStackMixin; + + +/***/ }), +/* 18 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(19); +const ErrorReportingTokenizerMixin = __webpack_require__(20); +const LocationInfoTokenizerMixin = __webpack_require__(15); +const Mixin = __webpack_require__(14); + +class ErrorReportingParserMixin extends ErrorReportingMixinBase { + constructor(parser, opts) { + super(parser, opts); + + this.opts = opts; + this.ctLoc = null; + this.locBeforeToken = false; + } + + _setErrorLocation(err) { + if (this.ctLoc) { + err.startLine = this.ctLoc.startLine; + err.startCol = this.ctLoc.startCol; + err.startOffset = this.ctLoc.startOffset; + + err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine; + err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol; + err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset; + } + } + + _getOverriddenMethods(mxn, orig) { + return { + _bootstrap(document, fragmentContext) { + orig._bootstrap.call(this, document, fragmentContext); + + Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts); + Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); + }, + + _processInputToken(token) { + mxn.ctLoc = token.location; + + orig._processInputToken.call(this, token); + }, + + _err(code, options) { + mxn.locBeforeToken = options && options.beforeToken; + mxn._reportError(code); + } + }; + } +} + +module.exports = ErrorReportingParserMixin; + + +/***/ }), +/* 19 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(14); + +class ErrorReportingMixinBase extends Mixin { + constructor(host, opts) { + super(host); + + this.posTracker = null; + this.onParseError = opts.onParseError; + } + + _setErrorLocation(err) { + err.startLine = err.endLine = this.posTracker.line; + err.startCol = err.endCol = this.posTracker.col; + err.startOffset = err.endOffset = this.posTracker.offset; + } + + _reportError(code) { + const err = { + code: code, + startLine: -1, + startCol: -1, + startOffset: -1, + endLine: -1, + endCol: -1, + endOffset: -1 + }; + + this._setErrorLocation(err); + this.onParseError(err); + } + + _getOverriddenMethods(mxn) { + return { + _err(code) { + mxn._reportError(code); + } + }; + } +} + +module.exports = ErrorReportingMixinBase; + + +/***/ }), +/* 20 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(19); +const ErrorReportingPreprocessorMixin = __webpack_require__(21); +const Mixin = __webpack_require__(14); + +class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase { + constructor(tokenizer, opts) { + super(tokenizer, opts); + + const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts); + + this.posTracker = preprocessorMixin.posTracker; + } +} + +module.exports = ErrorReportingTokenizerMixin; + + +/***/ }), +/* 21 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(19); +const PositionTrackingPreprocessorMixin = __webpack_require__(16); +const Mixin = __webpack_require__(14); + +class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase { + constructor(preprocessor, opts) { + super(preprocessor, opts); + + this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin); + this.lastErrOffset = -1; + } + + _reportError(code) { + //NOTE: avoid reporting error twice on advance/retreat + if (this.lastErrOffset !== this.posTracker.offset) { + this.lastErrOffset = this.posTracker.offset; + super._reportError(code); + } + } +} + +module.exports = ErrorReportingPreprocessorMixin; + + +/***/ }), +/* 22 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const { DOCUMENT_MODE } = __webpack_require__(11); + +//Node construction +exports.createDocument = function() { + return { + nodeName: '#document', + mode: DOCUMENT_MODE.NO_QUIRKS, + childNodes: [] + }; +}; + +exports.createDocumentFragment = function() { + return { + nodeName: '#document-fragment', + childNodes: [] + }; +}; + +exports.createElement = function(tagName, namespaceURI, attrs) { + return { + nodeName: tagName, + tagName: tagName, + attrs: attrs, + namespaceURI: namespaceURI, + childNodes: [], + parentNode: null + }; +}; + +exports.createCommentNode = function(data) { + return { + nodeName: '#comment', + data: data, + parentNode: null + }; +}; + +const createTextNode = function(value) { + return { + nodeName: '#text', + value: value, + parentNode: null + }; +}; + +//Tree mutation +const appendChild = (exports.appendChild = function(parentNode, newNode) { + parentNode.childNodes.push(newNode); + newNode.parentNode = parentNode; +}); + +const insertBefore = (exports.insertBefore = function(parentNode, newNode, referenceNode) { + const insertionIdx = parentNode.childNodes.indexOf(referenceNode); + + parentNode.childNodes.splice(insertionIdx, 0, newNode); + newNode.parentNode = parentNode; +}); + +exports.setTemplateContent = function(templateElement, contentElement) { + templateElement.content = contentElement; +}; + +exports.getTemplateContent = function(templateElement) { + return templateElement.content; +}; + +exports.setDocumentType = function(document, name, publicId, systemId) { + let doctypeNode = null; + + for (let i = 0; i < document.childNodes.length; i++) { + if (document.childNodes[i].nodeName === '#documentType') { + doctypeNode = document.childNodes[i]; + break; + } + } + + if (doctypeNode) { + doctypeNode.name = name; + doctypeNode.publicId = publicId; + doctypeNode.systemId = systemId; + } else { + appendChild(document, { + nodeName: '#documentType', + name: name, + publicId: publicId, + systemId: systemId + }); + } +}; + +exports.setDocumentMode = function(document, mode) { + document.mode = mode; +}; + +exports.getDocumentMode = function(document) { + return document.mode; +}; + +exports.detachNode = function(node) { + if (node.parentNode) { + const idx = node.parentNode.childNodes.indexOf(node); + + node.parentNode.childNodes.splice(idx, 1); + node.parentNode = null; + } +}; + +exports.insertText = function(parentNode, text) { + if (parentNode.childNodes.length) { + const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1]; + + if (prevNode.nodeName === '#text') { + prevNode.value += text; + return; + } + } + + appendChild(parentNode, createTextNode(text)); +}; + +exports.insertTextBefore = function(parentNode, text, referenceNode) { + const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1]; + + if (prevNode && prevNode.nodeName === '#text') { + prevNode.value += text; + } else { + insertBefore(parentNode, createTextNode(text), referenceNode); + } +}; + +exports.adoptAttributes = function(recipient, attrs) { + const recipientAttrsMap = []; + + for (let i = 0; i < recipient.attrs.length; i++) { + recipientAttrsMap.push(recipient.attrs[i].name); + } + + for (let j = 0; j < attrs.length; j++) { + if (recipientAttrsMap.indexOf(attrs[j].name) === -1) { + recipient.attrs.push(attrs[j]); + } + } +}; + +//Tree traversing +exports.getFirstChild = function(node) { + return node.childNodes[0]; +}; + +exports.getChildNodes = function(node) { + return node.childNodes; +}; + +exports.getParentNode = function(node) { + return node.parentNode; +}; + +exports.getAttrList = function(element) { + return element.attrs; +}; + +//Node data +exports.getTagName = function(element) { + return element.tagName; +}; + +exports.getNamespaceURI = function(element) { + return element.namespaceURI; +}; + +exports.getTextNodeContent = function(textNode) { + return textNode.value; +}; + +exports.getCommentNodeContent = function(commentNode) { + return commentNode.data; +}; + +exports.getDocumentTypeNodeName = function(doctypeNode) { + return doctypeNode.name; +}; + +exports.getDocumentTypeNodePublicId = function(doctypeNode) { + return doctypeNode.publicId; +}; + +exports.getDocumentTypeNodeSystemId = function(doctypeNode) { + return doctypeNode.systemId; +}; + +//Node types +exports.isTextNode = function(node) { + return node.nodeName === '#text'; +}; + +exports.isCommentNode = function(node) { + return node.nodeName === '#comment'; +}; + +exports.isDocumentTypeNode = function(node) { + return node.nodeName === '#documentType'; +}; + +exports.isElementNode = function(node) { + return !!node.tagName; +}; + +// Source code location +exports.setNodeSourceCodeLocation = function(node, location) { + node.sourceCodeLocation = location; +}; + +exports.getNodeSourceCodeLocation = function(node) { + return node.sourceCodeLocation; +}; + +exports.updateNodeSourceCodeLocation = function(node, endLocation) { + node.sourceCodeLocation = Object.assign(node.sourceCodeLocation, endLocation); +}; + + +/***/ }), +/* 23 */ +/***/ ((module) => { + +"use strict"; + + +module.exports = function mergeOptions(defaults, options) { + options = options || Object.create(null); + + return [defaults, options].reduce((merged, optObj) => { + Object.keys(optObj).forEach(key => { + merged[key] = optObj[key]; + }); + + return merged; + }, Object.create(null)); +}; + + +/***/ }), +/* 24 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const { DOCUMENT_MODE } = __webpack_require__(11); + +//Const +const VALID_DOCTYPE_NAME = 'html'; +const VALID_SYSTEM_ID = 'about:legacy-compat'; +const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'; + +const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [ + '+//silmaril//dtd html pro v0r11 19970101//', + '-//as//dtd html 3.0 aswedit + extensions//', + '-//advasoft ltd//dtd html 3.0 aswedit + extensions//', + '-//ietf//dtd html 2.0 level 1//', + '-//ietf//dtd html 2.0 level 2//', + '-//ietf//dtd html 2.0 strict level 1//', + '-//ietf//dtd html 2.0 strict level 2//', + '-//ietf//dtd html 2.0 strict//', + '-//ietf//dtd html 2.0//', + '-//ietf//dtd html 2.1e//', + '-//ietf//dtd html 3.0//', + '-//ietf//dtd html 3.2 final//', + '-//ietf//dtd html 3.2//', + '-//ietf//dtd html 3//', + '-//ietf//dtd html level 0//', + '-//ietf//dtd html level 1//', + '-//ietf//dtd html level 2//', + '-//ietf//dtd html level 3//', + '-//ietf//dtd html strict level 0//', + '-//ietf//dtd html strict level 1//', + '-//ietf//dtd html strict level 2//', + '-//ietf//dtd html strict level 3//', + '-//ietf//dtd html strict//', + '-//ietf//dtd html//', + '-//metrius//dtd metrius presentational//', + '-//microsoft//dtd internet explorer 2.0 html strict//', + '-//microsoft//dtd internet explorer 2.0 html//', + '-//microsoft//dtd internet explorer 2.0 tables//', + '-//microsoft//dtd internet explorer 3.0 html strict//', + '-//microsoft//dtd internet explorer 3.0 html//', + '-//microsoft//dtd internet explorer 3.0 tables//', + '-//netscape comm. corp.//dtd html//', + '-//netscape comm. corp.//dtd strict html//', + "-//o'reilly and associates//dtd html 2.0//", + "-//o'reilly and associates//dtd html extended 1.0//", + "-//o'reilly and associates//dtd html extended relaxed 1.0//", + '-//sq//dtd html 2.0 hotmetal + extensions//', + '-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//', + '-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//', + '-//spyglass//dtd html 2.0 extended//', + '-//sun microsystems corp.//dtd hotjava html//', + '-//sun microsystems corp.//dtd hotjava strict html//', + '-//w3c//dtd html 3 1995-03-24//', + '-//w3c//dtd html 3.2 draft//', + '-//w3c//dtd html 3.2 final//', + '-//w3c//dtd html 3.2//', + '-//w3c//dtd html 3.2s draft//', + '-//w3c//dtd html 4.0 frameset//', + '-//w3c//dtd html 4.0 transitional//', + '-//w3c//dtd html experimental 19960712//', + '-//w3c//dtd html experimental 970421//', + '-//w3c//dtd w3 html//', + '-//w3o//dtd w3 html 3.0//', + '-//webtechs//dtd mozilla html 2.0//', + '-//webtechs//dtd mozilla html//' +]; + +const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([ + '-//w3c//dtd html 4.01 frameset//', + '-//w3c//dtd html 4.01 transitional//' +]); + +const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html']; +const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//']; + +const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([ + '-//w3c//dtd html 4.01 frameset//', + '-//w3c//dtd html 4.01 transitional//' +]); + +//Utils +function enquoteDoctypeId(id) { + const quote = id.indexOf('"') !== -1 ? "'" : '"'; + + return quote + id + quote; +} + +function hasPrefix(publicId, prefixes) { + for (let i = 0; i < prefixes.length; i++) { + if (publicId.indexOf(prefixes[i]) === 0) { + return true; + } + } + + return false; +} + +//API +exports.isConforming = function(token) { + return ( + token.name === VALID_DOCTYPE_NAME && + token.publicId === null && + (token.systemId === null || token.systemId === VALID_SYSTEM_ID) + ); +}; + +exports.getDocumentMode = function(token) { + if (token.name !== VALID_DOCTYPE_NAME) { + return DOCUMENT_MODE.QUIRKS; + } + + const systemId = token.systemId; + + if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) { + return DOCUMENT_MODE.QUIRKS; + } + + let publicId = token.publicId; + + if (publicId !== null) { + publicId = publicId.toLowerCase(); + + if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) { + return DOCUMENT_MODE.QUIRKS; + } + + let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES; + + if (hasPrefix(publicId, prefixes)) { + return DOCUMENT_MODE.QUIRKS; + } + + prefixes = + systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES; + + if (hasPrefix(publicId, prefixes)) { + return DOCUMENT_MODE.LIMITED_QUIRKS; + } + } + + return DOCUMENT_MODE.NO_QUIRKS; +}; + +exports.serializeContent = function(name, publicId, systemId) { + let str = '!DOCTYPE '; + + if (name) { + str += name; + } + + if (publicId) { + str += ' PUBLIC ' + enquoteDoctypeId(publicId); + } else if (systemId) { + str += ' SYSTEM'; + } + + if (systemId !== null) { + str += ' ' + enquoteDoctypeId(systemId); + } + + return str; +}; + + +/***/ }), +/* 25 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const Tokenizer = __webpack_require__(5); +const HTML = __webpack_require__(11); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; +const ATTRS = HTML.ATTRS; + +//MIME types +const MIME_TYPES = { + TEXT_HTML: 'text/html', + APPLICATION_XML: 'application/xhtml+xml' +}; + +//Attributes +const DEFINITION_URL_ATTR = 'definitionurl'; +const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL'; +const SVG_ATTRS_ADJUSTMENT_MAP = { + attributename: 'attributeName', + attributetype: 'attributeType', + basefrequency: 'baseFrequency', + baseprofile: 'baseProfile', + calcmode: 'calcMode', + clippathunits: 'clipPathUnits', + diffuseconstant: 'diffuseConstant', + edgemode: 'edgeMode', + filterunits: 'filterUnits', + glyphref: 'glyphRef', + gradienttransform: 'gradientTransform', + gradientunits: 'gradientUnits', + kernelmatrix: 'kernelMatrix', + kernelunitlength: 'kernelUnitLength', + keypoints: 'keyPoints', + keysplines: 'keySplines', + keytimes: 'keyTimes', + lengthadjust: 'lengthAdjust', + limitingconeangle: 'limitingConeAngle', + markerheight: 'markerHeight', + markerunits: 'markerUnits', + markerwidth: 'markerWidth', + maskcontentunits: 'maskContentUnits', + maskunits: 'maskUnits', + numoctaves: 'numOctaves', + pathlength: 'pathLength', + patterncontentunits: 'patternContentUnits', + patterntransform: 'patternTransform', + patternunits: 'patternUnits', + pointsatx: 'pointsAtX', + pointsaty: 'pointsAtY', + pointsatz: 'pointsAtZ', + preservealpha: 'preserveAlpha', + preserveaspectratio: 'preserveAspectRatio', + primitiveunits: 'primitiveUnits', + refx: 'refX', + refy: 'refY', + repeatcount: 'repeatCount', + repeatdur: 'repeatDur', + requiredextensions: 'requiredExtensions', + requiredfeatures: 'requiredFeatures', + specularconstant: 'specularConstant', + specularexponent: 'specularExponent', + spreadmethod: 'spreadMethod', + startoffset: 'startOffset', + stddeviation: 'stdDeviation', + stitchtiles: 'stitchTiles', + surfacescale: 'surfaceScale', + systemlanguage: 'systemLanguage', + tablevalues: 'tableValues', + targetx: 'targetX', + targety: 'targetY', + textlength: 'textLength', + viewbox: 'viewBox', + viewtarget: 'viewTarget', + xchannelselector: 'xChannelSelector', + ychannelselector: 'yChannelSelector', + zoomandpan: 'zoomAndPan' +}; + +const XML_ATTRS_ADJUSTMENT_MAP = { + 'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK }, + 'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK }, + 'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK }, + 'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK }, + 'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK }, + 'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK }, + 'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK }, + 'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML }, + 'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML }, + 'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML }, + xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS }, + 'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS } +}; + +//SVG tag names adjustment map +const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = { + altglyph: 'altGlyph', + altglyphdef: 'altGlyphDef', + altglyphitem: 'altGlyphItem', + animatecolor: 'animateColor', + animatemotion: 'animateMotion', + animatetransform: 'animateTransform', + clippath: 'clipPath', + feblend: 'feBlend', + fecolormatrix: 'feColorMatrix', + fecomponenttransfer: 'feComponentTransfer', + fecomposite: 'feComposite', + feconvolvematrix: 'feConvolveMatrix', + fediffuselighting: 'feDiffuseLighting', + fedisplacementmap: 'feDisplacementMap', + fedistantlight: 'feDistantLight', + feflood: 'feFlood', + fefunca: 'feFuncA', + fefuncb: 'feFuncB', + fefuncg: 'feFuncG', + fefuncr: 'feFuncR', + fegaussianblur: 'feGaussianBlur', + feimage: 'feImage', + femerge: 'feMerge', + femergenode: 'feMergeNode', + femorphology: 'feMorphology', + feoffset: 'feOffset', + fepointlight: 'fePointLight', + fespecularlighting: 'feSpecularLighting', + fespotlight: 'feSpotLight', + fetile: 'feTile', + feturbulence: 'feTurbulence', + foreignobject: 'foreignObject', + glyphref: 'glyphRef', + lineargradient: 'linearGradient', + radialgradient: 'radialGradient', + textpath: 'textPath' +}); + +//Tags that causes exit from foreign content +const EXITS_FOREIGN_CONTENT = { + [$.B]: true, + [$.BIG]: true, + [$.BLOCKQUOTE]: true, + [$.BODY]: true, + [$.BR]: true, + [$.CENTER]: true, + [$.CODE]: true, + [$.DD]: true, + [$.DIV]: true, + [$.DL]: true, + [$.DT]: true, + [$.EM]: true, + [$.EMBED]: true, + [$.H1]: true, + [$.H2]: true, + [$.H3]: true, + [$.H4]: true, + [$.H5]: true, + [$.H6]: true, + [$.HEAD]: true, + [$.HR]: true, + [$.I]: true, + [$.IMG]: true, + [$.LI]: true, + [$.LISTING]: true, + [$.MENU]: true, + [$.META]: true, + [$.NOBR]: true, + [$.OL]: true, + [$.P]: true, + [$.PRE]: true, + [$.RUBY]: true, + [$.S]: true, + [$.SMALL]: true, + [$.SPAN]: true, + [$.STRONG]: true, + [$.STRIKE]: true, + [$.SUB]: true, + [$.SUP]: true, + [$.TABLE]: true, + [$.TT]: true, + [$.U]: true, + [$.UL]: true, + [$.VAR]: true +}; + +//Check exit from foreign content +exports.causesExit = function(startTagToken) { + const tn = startTagToken.tagName; + const isFontWithAttrs = + tn === $.FONT && + (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || + Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || + Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null); + + return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn]; +}; + +//Token adjustments +exports.adjustTokenMathMLAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + if (token.attrs[i].name === DEFINITION_URL_ATTR) { + token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR; + break; + } + } +}; + +exports.adjustTokenSVGAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; + + if (adjustedAttrName) { + token.attrs[i].name = adjustedAttrName; + } + } +}; + +exports.adjustTokenXMLAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; + + if (adjustedAttrEntry) { + token.attrs[i].prefix = adjustedAttrEntry.prefix; + token.attrs[i].name = adjustedAttrEntry.name; + token.attrs[i].namespace = adjustedAttrEntry.namespace; + } + } +}; + +exports.adjustTokenSVGTagName = function(token) { + const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName]; + + if (adjustedTagName) { + token.tagName = adjustedTagName; + } +}; + +//Integration points +function isMathMLTextIntegrationPoint(tn, ns) { + return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT); +} + +function isHtmlIntegrationPoint(tn, ns, attrs) { + if (ns === NS.MATHML && tn === $.ANNOTATION_XML) { + for (let i = 0; i < attrs.length; i++) { + if (attrs[i].name === ATTRS.ENCODING) { + const value = attrs[i].value.toLowerCase(); + + return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML; + } + } + } + + return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE); +} + +exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) { + if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) { + return true; + } + + if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) { + return true; + } + + return false; +}; + + +/***/ }), +/* 26 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const defaultTreeAdapter = __webpack_require__(22); +const mergeOptions = __webpack_require__(23); +const doctype = __webpack_require__(24); +const HTML = __webpack_require__(11); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; + +//Default serializer options +const DEFAULT_OPTIONS = { + treeAdapter: defaultTreeAdapter +}; + +//Escaping regexes +const AMP_REGEX = /&/g; +const NBSP_REGEX = /\u00a0/g; +const DOUBLE_QUOTE_REGEX = /"/g; +const LT_REGEX = //g; + +//Serializer +class Serializer { + constructor(node, options) { + this.options = mergeOptions(DEFAULT_OPTIONS, options); + this.treeAdapter = this.options.treeAdapter; + + this.html = ''; + this.startNode = node; + } + + //API + serialize() { + this._serializeChildNodes(this.startNode); + + return this.html; + } + + //Internals + _serializeChildNodes(parentNode) { + const childNodes = this.treeAdapter.getChildNodes(parentNode); + + if (childNodes) { + for (let i = 0, cnLength = childNodes.length; i < cnLength; i++) { + const currentNode = childNodes[i]; + + if (this.treeAdapter.isElementNode(currentNode)) { + this._serializeElement(currentNode); + } else if (this.treeAdapter.isTextNode(currentNode)) { + this._serializeTextNode(currentNode); + } else if (this.treeAdapter.isCommentNode(currentNode)) { + this._serializeCommentNode(currentNode); + } else if (this.treeAdapter.isDocumentTypeNode(currentNode)) { + this._serializeDocumentTypeNode(currentNode); + } + } + } + } + + _serializeElement(node) { + const tn = this.treeAdapter.getTagName(node); + const ns = this.treeAdapter.getNamespaceURI(node); + + this.html += '<' + tn; + this._serializeAttributes(node); + this.html += '>'; + + if ( + tn !== $.AREA && + tn !== $.BASE && + tn !== $.BASEFONT && + tn !== $.BGSOUND && + tn !== $.BR && + tn !== $.COL && + tn !== $.EMBED && + tn !== $.FRAME && + tn !== $.HR && + tn !== $.IMG && + tn !== $.INPUT && + tn !== $.KEYGEN && + tn !== $.LINK && + tn !== $.META && + tn !== $.PARAM && + tn !== $.SOURCE && + tn !== $.TRACK && + tn !== $.WBR + ) { + const childNodesHolder = + tn === $.TEMPLATE && ns === NS.HTML ? this.treeAdapter.getTemplateContent(node) : node; + + this._serializeChildNodes(childNodesHolder); + this.html += '' + tn + '>'; + } + } + + _serializeAttributes(node) { + const attrs = this.treeAdapter.getAttrList(node); + + for (let i = 0, attrsLength = attrs.length; i < attrsLength; i++) { + const attr = attrs[i]; + const value = Serializer.escapeString(attr.value, true); + + this.html += ' '; + + if (!attr.namespace) { + this.html += attr.name; + } else if (attr.namespace === NS.XML) { + this.html += 'xml:' + attr.name; + } else if (attr.namespace === NS.XMLNS) { + if (attr.name !== 'xmlns') { + this.html += 'xmlns:'; + } + + this.html += attr.name; + } else if (attr.namespace === NS.XLINK) { + this.html += 'xlink:' + attr.name; + } else { + this.html += attr.prefix + ':' + attr.name; + } + + this.html += '="' + value + '"'; + } + } + + _serializeTextNode(node) { + const content = this.treeAdapter.getTextNodeContent(node); + const parent = this.treeAdapter.getParentNode(node); + let parentTn = void 0; + + if (parent && this.treeAdapter.isElementNode(parent)) { + parentTn = this.treeAdapter.getTagName(parent); + } + + if ( + parentTn === $.STYLE || + parentTn === $.SCRIPT || + parentTn === $.XMP || + parentTn === $.IFRAME || + parentTn === $.NOEMBED || + parentTn === $.NOFRAMES || + parentTn === $.PLAINTEXT || + parentTn === $.NOSCRIPT + ) { + this.html += content; + } else { + this.html += Serializer.escapeString(content, false); + } + } + + _serializeCommentNode(node) { + this.html += ''; + } + + _serializeDocumentTypeNode(node) { + const name = this.treeAdapter.getDocumentTypeNodeName(node); + + this.html += '<' + doctype.serializeContent(name, null, null) + '>'; + } +} + +// NOTE: used in tests and by rewriting stream +Serializer.escapeString = function(str, attrMode) { + str = str.replace(AMP_REGEX, '&').replace(NBSP_REGEX, ' '); + + if (attrMode) { + str = str.replace(DOUBLE_QUOTE_REGEX, '"'); + } else { + str = str.replace(LT_REGEX, '<').replace(GT_REGEX, '>'); + } + + return str; +}; + +module.exports = Serializer; + + +/***/ }), +/* 27 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var css_tree__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); +/* harmony import */ var _parsel_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(138); + + + + +class CSS extends _events_js__WEBPACK_IMPORTED_MODULE_1__["default"] { + constructor(ctx) { + super(); + this.ctx = ctx; + this.meta = ctx.meta; + this.parsel = _parsel_js__WEBPACK_IMPORTED_MODULE_2__["default"]; + this.parse = css_tree__WEBPACK_IMPORTED_MODULE_0__.parse; + this.walk = css_tree__WEBPACK_IMPORTED_MODULE_0__.walk; + this.generate = css_tree__WEBPACK_IMPORTED_MODULE_0__.generate; + }; + rewrite(str, options) { + return this.recast(str, options, 'rewrite'); + }; + source(str, options) { + return this.recast(str, options, 'source'); + }; + recast(str, options, type) { + if (!str) return str; + str = new String(str).toString(); + try { + const ast = this.parse(str, { ...options, parseCustomProperty: true }); + this.walk(ast, node => { + this.emit(node.type, node, options, type); + }); + return this.generate(ast); + } catch(e) { + console.log(e) + return str; + }; + }; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CSS); + +/***/ }), +/* 28 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "version": () => (/* reexport safe */ _version_js__WEBPACK_IMPORTED_MODULE_1__.version), +/* harmony export */ "createSyntax": () => (/* reexport safe */ _syntax_create_js__WEBPACK_IMPORTED_MODULE_2__["default"]), +/* harmony export */ "List": () => (/* reexport safe */ _utils_List_js__WEBPACK_IMPORTED_MODULE_3__.List), +/* harmony export */ "Lexer": () => (/* reexport safe */ _lexer_Lexer_js__WEBPACK_IMPORTED_MODULE_4__.Lexer), +/* harmony export */ "tokenTypes": () => (/* reexport safe */ _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_5__.tokenTypes), +/* harmony export */ "tokenNames": () => (/* reexport safe */ _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_5__.tokenNames), +/* harmony export */ "TokenStream": () => (/* reexport safe */ _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_5__.TokenStream), +/* harmony export */ "definitionSyntax": () => (/* reexport module object */ _definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_6__), +/* harmony export */ "clone": () => (/* reexport safe */ _utils_clone_js__WEBPACK_IMPORTED_MODULE_7__.clone), +/* harmony export */ "isCustomProperty": () => (/* reexport safe */ _utils_names_js__WEBPACK_IMPORTED_MODULE_8__.isCustomProperty), +/* harmony export */ "keyword": () => (/* reexport safe */ _utils_names_js__WEBPACK_IMPORTED_MODULE_8__.keyword), +/* harmony export */ "property": () => (/* reexport safe */ _utils_names_js__WEBPACK_IMPORTED_MODULE_8__.property), +/* harmony export */ "vendorPrefix": () => (/* reexport safe */ _utils_names_js__WEBPACK_IMPORTED_MODULE_8__.vendorPrefix), +/* harmony export */ "ident": () => (/* reexport module object */ _utils_ident_js__WEBPACK_IMPORTED_MODULE_9__), +/* harmony export */ "string": () => (/* reexport module object */ _utils_string_js__WEBPACK_IMPORTED_MODULE_10__), +/* harmony export */ "url": () => (/* reexport module object */ _utils_url_js__WEBPACK_IMPORTED_MODULE_11__), +/* harmony export */ "tokenize": () => (/* binding */ tokenize), +/* harmony export */ "parse": () => (/* binding */ parse), +/* harmony export */ "generate": () => (/* binding */ generate), +/* harmony export */ "lexer": () => (/* binding */ lexer), +/* harmony export */ "createLexer": () => (/* binding */ createLexer), +/* harmony export */ "walk": () => (/* binding */ walk), +/* harmony export */ "find": () => (/* binding */ find), +/* harmony export */ "findLast": () => (/* binding */ findLast), +/* harmony export */ "findAll": () => (/* binding */ findAll), +/* harmony export */ "toPlainObject": () => (/* binding */ toPlainObject), +/* harmony export */ "fromPlainObject": () => (/* binding */ fromPlainObject), +/* harmony export */ "fork": () => (/* binding */ fork) +/* harmony export */ }); +/* harmony import */ var _syntax_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29); +/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(135); +/* harmony import */ var _syntax_create_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30); +/* harmony import */ var _utils_List_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(40); +/* harmony import */ var _lexer_Lexer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(55); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(31); +/* harmony import */ var _definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62); +/* harmony import */ var _utils_clone_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(136); +/* harmony import */ var _utils_names_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58); +/* harmony import */ var _utils_ident_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(137); +/* harmony import */ var _utils_string_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(111); +/* harmony import */ var _utils_url_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(116); + + + + + + + + + + + + + +const { + tokenize, + parse, + generate, + lexer, + createLexer, + + walk, + find, + findLast, + findAll, + + toPlainObject, + fromPlainObject, + + fork +} = _syntax_index_js__WEBPACK_IMPORTED_MODULE_0__["default"]; + + +/***/ }), +/* 29 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _create_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(30); +/* harmony import */ var _config_lexer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(74); +/* harmony import */ var _config_parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(119); +/* harmony import */ var _config_walker_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(134); + + + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_create_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ + ..._config_lexer_js__WEBPACK_IMPORTED_MODULE_1__["default"], + ..._config_parser_js__WEBPACK_IMPORTED_MODULE_2__["default"], + ..._config_walker_js__WEBPACK_IMPORTED_MODULE_3__["default"] +})); + + +/***/ }), +/* 30 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); +/* harmony import */ var _parser_create_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39); +/* harmony import */ var _generator_create_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(44); +/* harmony import */ var _convertor_create_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53); +/* harmony import */ var _walker_create_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54); +/* harmony import */ var _lexer_Lexer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55); +/* harmony import */ var _config_mix_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(73); + + + + + + + + +function createSyntax(config) { + const parse = (0,_parser_create_js__WEBPACK_IMPORTED_MODULE_1__.createParser)(config); + const walk = (0,_walker_create_js__WEBPACK_IMPORTED_MODULE_4__.createWalker)(config); + const generate = (0,_generator_create_js__WEBPACK_IMPORTED_MODULE_2__.createGenerator)(config); + const { fromPlainObject, toPlainObject } = (0,_convertor_create_js__WEBPACK_IMPORTED_MODULE_3__.createConvertor)(walk); + + const syntax = { + lexer: null, + createLexer: config => new _lexer_Lexer_js__WEBPACK_IMPORTED_MODULE_5__.Lexer(config, syntax, syntax.lexer.structure), + + tokenize: _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.tokenize, + parse, + generate, + + walk, + find: walk.find, + findLast: walk.findLast, + findAll: walk.findAll, + + fromPlainObject, + toPlainObject, + + fork(extension) { + const base = (0,_config_mix_js__WEBPACK_IMPORTED_MODULE_6__["default"])({}, config); // copy of config + + return createSyntax( + typeof extension === 'function' + ? extension(base, Object.assign) + : (0,_config_mix_js__WEBPACK_IMPORTED_MODULE_6__["default"])(base, extension) + ); + } + }; + + syntax.lexer = new _lexer_Lexer_js__WEBPACK_IMPORTED_MODULE_5__.Lexer({ + generic: true, + types: config.types, + atrules: config.atrules, + properties: config.properties, + node: config.node + }, syntax); + + return syntax; +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config => createSyntax((0,_config_mix_js__WEBPACK_IMPORTED_MODULE_6__["default"])({}, config))); + + +/***/ }), +/* 31 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "tokenize": () => (/* binding */ tokenize), +/* harmony export */ "AtKeyword": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword), +/* harmony export */ "BadString": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.BadString), +/* harmony export */ "BadUrl": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl), +/* harmony export */ "CDC": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.CDC), +/* harmony export */ "CDO": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.CDO), +/* harmony export */ "Colon": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Colon), +/* harmony export */ "Comma": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Comma), +/* harmony export */ "Comment": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Comment), +/* harmony export */ "Delim": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim), +/* harmony export */ "Dimension": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Dimension), +/* harmony export */ "EOF": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.EOF), +/* harmony export */ "Function": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Function), +/* harmony export */ "Hash": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Hash), +/* harmony export */ "Ident": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Ident), +/* harmony export */ "LeftCurlyBracket": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftCurlyBracket), +/* harmony export */ "LeftParenthesis": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftParenthesis), +/* harmony export */ "LeftSquareBracket": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftSquareBracket), +/* harmony export */ "Number": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Number), +/* harmony export */ "Percentage": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Percentage), +/* harmony export */ "RightCurlyBracket": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.RightCurlyBracket), +/* harmony export */ "RightParenthesis": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis), +/* harmony export */ "RightSquareBracket": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.RightSquareBracket), +/* harmony export */ "Semicolon": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Semicolon), +/* harmony export */ "String": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.String), +/* harmony export */ "Url": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.Url), +/* harmony export */ "WhiteSpace": () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_0__.WhiteSpace), +/* harmony export */ "tokenTypes": () => (/* reexport module object */ _types_js__WEBPACK_IMPORTED_MODULE_0__), +/* harmony export */ "tokenNames": () => (/* reexport safe */ _names_js__WEBPACK_IMPORTED_MODULE_3__["default"]), +/* harmony export */ "DigitCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.DigitCategory), +/* harmony export */ "EofCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.EofCategory), +/* harmony export */ "NameStartCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.NameStartCategory), +/* harmony export */ "NonPrintableCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.NonPrintableCategory), +/* harmony export */ "WhiteSpaceCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.WhiteSpaceCategory), +/* harmony export */ "charCodeCategory": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.charCodeCategory), +/* harmony export */ "isBOM": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isBOM), +/* harmony export */ "isDigit": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isDigit), +/* harmony export */ "isHexDigit": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isHexDigit), +/* harmony export */ "isIdentifierStart": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isIdentifierStart), +/* harmony export */ "isLetter": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isLetter), +/* harmony export */ "isLowercaseLetter": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isLowercaseLetter), +/* harmony export */ "isName": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isName), +/* harmony export */ "isNameStart": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNameStart), +/* harmony export */ "isNewline": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNewline), +/* harmony export */ "isNonAscii": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNonAscii), +/* harmony export */ "isNonPrintable": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNonPrintable), +/* harmony export */ "isNumberStart": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNumberStart), +/* harmony export */ "isUppercaseLetter": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isUppercaseLetter), +/* harmony export */ "isValidEscape": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isValidEscape), +/* harmony export */ "isWhiteSpace": () => (/* reexport safe */ _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isWhiteSpace), +/* harmony export */ "cmpChar": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.cmpChar), +/* harmony export */ "cmpStr": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.cmpStr), +/* harmony export */ "consumeBadUrlRemnants": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeBadUrlRemnants), +/* harmony export */ "consumeEscaped": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeEscaped), +/* harmony export */ "consumeName": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeName), +/* harmony export */ "consumeNumber": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeNumber), +/* harmony export */ "decodeEscaped": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.decodeEscaped), +/* harmony export */ "findDecimalNumberEnd": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.findDecimalNumberEnd), +/* harmony export */ "findWhiteSpaceEnd": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceEnd), +/* harmony export */ "findWhiteSpaceStart": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceStart), +/* harmony export */ "getNewlineLength": () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_2__.getNewlineLength), +/* harmony export */ "OffsetToLocation": () => (/* reexport safe */ _OffsetToLocation_js__WEBPACK_IMPORTED_MODULE_4__.OffsetToLocation), +/* harmony export */ "TokenStream": () => (/* reexport safe */ _TokenStream_js__WEBPACK_IMPORTED_MODULE_5__.TokenStream) +/* harmony export */ }); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); +/* harmony import */ var _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34); +/* harmony import */ var _names_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35); +/* harmony import */ var _OffsetToLocation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36); +/* harmony import */ var _TokenStream_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38); + + + + +function tokenize(source, onToken) { + function getCharCode(offset) { + return offset < sourceLength ? source.charCodeAt(offset) : 0; + } + + // § 4.3.3. Consume a numeric token + function consumeNumericToken() { + // Consume a number and let number be the result. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeNumber)(source, offset); + + // If the next 3 input code points would start an identifier, then: + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isIdentifierStart)(getCharCode(offset), getCharCode(offset + 1), getCharCode(offset + 2))) { + // Create a
with the same value and type flag as number, and a unit set initially to the empty string. + // Consume a name. Set the ’s unit to the returned value. + // Return the . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Dimension; + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeName)(source, offset); + return; + } + + // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it. + if (getCharCode(offset) === 0x0025) { + // Create a with the same value as number, and return it. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Percentage; + offset++; + return; + } + + // Otherwise, create a with the same value and type flag as number, and return it. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Number; + } + + // § 4.3.4. Consume an ident-like token + function consumeIdentLikeToken() { + const nameStartOffset = offset; + + // Consume a name, and let string be the result. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeName)(source, offset); + + // If string’s value is an ASCII case-insensitive match for "url", + // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it. + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.cmpStr)(source, nameStartOffset, offset, 'url') && getCharCode(offset) === 0x0028) { + // While the next two input code points are whitespace, consume the next input code point. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceEnd)(source, offset + 1); + + // If the next one or two input code points are U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), + // or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('), + // then create a with its value set to string and return it. + if (getCharCode(offset) === 0x0022 || + getCharCode(offset) === 0x0027) { + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Function; + offset = nameStartOffset + 4; + return; + } + + // Otherwise, consume a url token, and return it. + consumeUrlToken(); + return; + } + + // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it. + // Create a with its value set to string and return it. + if (getCharCode(offset) === 0x0028) { + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Function; + offset++; + return; + } + + // Otherwise, create an with its value set to string and return it. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Ident; + } + + // § 4.3.5. Consume a string token + function consumeStringToken(endingCodePoint) { + // This algorithm may be called with an ending code point, which denotes the code point + // that ends the string. If an ending code point is not specified, + // the current input code point is used. + if (!endingCodePoint) { + endingCodePoint = getCharCode(offset++); + } + + // Initially create a with its value set to the empty string. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.String; + + // Repeatedly consume the next input code point from the stream: + for (; offset < source.length; offset++) { + const code = source.charCodeAt(offset); + + switch ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.charCodeCategory)(code)) { + // ending code point + case endingCodePoint: + // Return the . + offset++; + return; + + // EOF + // case EofCategory: + // This is a parse error. Return the . + // return; + + // newline + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.WhiteSpaceCategory: + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNewline)(code)) { + // This is a parse error. Reconsume the current input code point, + // create a , and return it. + offset += (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getNewlineLength)(source, offset, code); + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.BadString; + return; + } + break; + + // U+005C REVERSE SOLIDUS (\) + case 0x005C: + // If the next input code point is EOF, do nothing. + if (offset === source.length - 1) { + break; + } + + const nextCode = getCharCode(offset + 1); + + // Otherwise, if the next input code point is a newline, consume it. + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNewline)(nextCode)) { + offset += (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getNewlineLength)(source, offset + 1, nextCode); + } else if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isValidEscape)(code, nextCode)) { + // Otherwise, (the stream starts with a valid escape) consume + // an escaped code point and append the returned code point to + // the ’s value. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeEscaped)(source, offset) - 1; + } + break; + + // anything else + // Append the current input code point to the ’s value. + } + } + } + + // § 4.3.6. Consume a url token + // Note: This algorithm assumes that the initial "url(" has already been consumed. + // This algorithm also assumes that it’s being called to consume an "unquoted" value, like url(foo). + // A quoted value, like url("foo"), is parsed as a . Consume an ident-like token + // automatically handles this distinction; this algorithm shouldn’t be called directly otherwise. + function consumeUrlToken() { + // Initially create a with its value set to the empty string. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Url; + + // Consume as much whitespace as possible. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceEnd)(source, offset); + + // Repeatedly consume the next input code point from the stream: + for (; offset < source.length; offset++) { + const code = source.charCodeAt(offset); + + switch ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.charCodeCategory)(code)) { + // U+0029 RIGHT PARENTHESIS ()) + case 0x0029: + // Return the . + offset++; + return; + + // EOF + // case EofCategory: + // This is a parse error. Return the . + // return; + + // whitespace + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.WhiteSpaceCategory: + // Consume as much whitespace as possible. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceEnd)(source, offset); + + // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF, + // consume it and return the + // (if EOF was encountered, this is a parse error); + if (getCharCode(offset) === 0x0029 || offset >= source.length) { + if (offset < source.length) { + offset++; + } + return; + } + + // otherwise, consume the remnants of a bad url, create a , + // and return it. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeBadUrlRemnants)(source, offset); + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl; + return; + + // U+0022 QUOTATION MARK (") + // U+0027 APOSTROPHE (') + // U+0028 LEFT PARENTHESIS (() + // non-printable code point + case 0x0022: + case 0x0027: + case 0x0028: + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.NonPrintableCategory: + // This is a parse error. Consume the remnants of a bad url, + // create a , and return it. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeBadUrlRemnants)(source, offset); + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl; + return; + + // U+005C REVERSE SOLIDUS (\) + case 0x005C: + // If the stream starts with a valid escape, consume an escaped code point and + // append the returned code point to the ’s value. + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isValidEscape)(code, getCharCode(offset + 1))) { + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeEscaped)(source, offset) - 1; + break; + } + + // Otherwise, this is a parse error. Consume the remnants of a bad url, + // create a , and return it. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeBadUrlRemnants)(source, offset); + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl; + return; + + // anything else + // Append the current input code point to the ’s value. + } + } + } + + // ensure source is a string + source = String(source || ''); + + const sourceLength = source.length; + let start = (0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isBOM)(getCharCode(0)); + let offset = start; + let type; + + // https://drafts.csswg.org/css-syntax-3/#consume-token + // § 4.3.1. Consume a token + while (offset < sourceLength) { + const code = source.charCodeAt(offset); + + switch ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.charCodeCategory)(code)) { + // whitespace + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.WhiteSpaceCategory: + // Consume as much whitespace as possible. Return a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.WhiteSpace; + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceEnd)(source, offset + 1); + break; + + // U+0022 QUOTATION MARK (") + case 0x0022: + // Consume a string token and return it. + consumeStringToken(); + break; + + // U+0023 NUMBER SIGN (#) + case 0x0023: + // If the next input code point is a name code point or the next two input code points are a valid escape, then: + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isName)(getCharCode(offset + 1)) || (0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isValidEscape)(getCharCode(offset + 1), getCharCode(offset + 2))) { + // Create a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Hash; + + // If the next 3 input code points would start an identifier, set the ’s type flag to "id". + // if (isIdentifierStart(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) { + // // TODO: set id flag + // } + + // Consume a name, and set the ’s value to the returned string. + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeName)(source, offset + 1); + + // Return the . + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + + break; + + // U+0027 APOSTROPHE (') + case 0x0027: + // Consume a string token and return it. + consumeStringToken(); + break; + + // U+0028 LEFT PARENTHESIS (() + case 0x0028: + // Return a <(-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftParenthesis; + offset++; + break; + + // U+0029 RIGHT PARENTHESIS ()) + case 0x0029: + // Return a <)-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis; + offset++; + break; + + // U+002B PLUS SIGN (+) + case 0x002B: + // If the input stream starts with a number, ... + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNumberStart)(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + // ... reconsume the current input code point, consume a numeric token, and return it. + consumeNumericToken(); + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + break; + + // U+002C COMMA (,) + case 0x002C: + // Return a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Comma; + offset++; + break; + + // U+002D HYPHEN-MINUS (-) + case 0x002D: + // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it. + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNumberStart)(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + consumeNumericToken(); + } else { + // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a . + if (getCharCode(offset + 1) === 0x002D && + getCharCode(offset + 2) === 0x003E) { + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.CDC; + offset = offset + 3; + } else { + // Otherwise, if the input stream starts with an identifier, ... + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isIdentifierStart)(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + // ... reconsume the current input code point, consume an ident-like token, and return it. + consumeIdentLikeToken(); + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + } + } + break; + + // U+002E FULL STOP (.) + case 0x002E: + // If the input stream starts with a number, ... + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isNumberStart)(code, getCharCode(offset + 1), getCharCode(offset + 2))) { + // ... reconsume the current input code point, consume a numeric token, and return it. + consumeNumericToken(); + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + + break; + + // U+002F SOLIDUS (/) + case 0x002F: + // If the next two input code point are U+002F SOLIDUS (/) followed by a U+002A ASTERISK (*), + if (getCharCode(offset + 1) === 0x002A) { + // ... consume them and all following code points up to and including the first U+002A ASTERISK (*) + // followed by a U+002F SOLIDUS (/), or up to an EOF code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Comment; + offset = source.indexOf('*/', offset + 2); + offset = offset === -1 ? source.length : offset + 2; + } else { + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + break; + + // U+003A COLON (:) + case 0x003A: + // Return a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Colon; + offset++; + break; + + // U+003B SEMICOLON (;) + case 0x003B: + // Return a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Semicolon; + offset++; + break; + + // U+003C LESS-THAN SIGN (<) + case 0x003C: + // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), ... + if (getCharCode(offset + 1) === 0x0021 && + getCharCode(offset + 2) === 0x002D && + getCharCode(offset + 3) === 0x002D) { + // ... consume them and return a . + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.CDO; + offset = offset + 4; + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + + break; + + // U+0040 COMMERCIAL AT (@) + case 0x0040: + // If the next 3 input code points would start an identifier, ... + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isIdentifierStart)(getCharCode(offset + 1), getCharCode(offset + 2), getCharCode(offset + 3))) { + // ... consume a name, create an with its value set to the returned value, and return it. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword; + offset = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.consumeName)(source, offset + 1); + } else { + // Otherwise, return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + + break; + + // U+005B LEFT SQUARE BRACKET ([) + case 0x005B: + // Return a <[-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftSquareBracket; + offset++; + break; + + // U+005C REVERSE SOLIDUS (\) + case 0x005C: + // If the input stream starts with a valid escape, ... + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isValidEscape)(code, getCharCode(offset + 1))) { + // ... reconsume the current input code point, consume an ident-like token, and return it. + consumeIdentLikeToken(); + } else { + // Otherwise, this is a parse error. Return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + break; + + // U+005D RIGHT SQUARE BRACKET (]) + case 0x005D: + // Return a <]-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.RightSquareBracket; + offset++; + break; + + // U+007B LEFT CURLY BRACKET ({) + case 0x007B: + // Return a <{-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.LeftCurlyBracket; + offset++; + break; + + // U+007D RIGHT CURLY BRACKET (}) + case 0x007D: + // Return a <}-token>. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.RightCurlyBracket; + offset++; + break; + + // digit + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.DigitCategory: + // Reconsume the current input code point, consume a numeric token, and return it. + consumeNumericToken(); + break; + + // name-start code point + case _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.NameStartCategory: + // Reconsume the current input code point, consume an ident-like token, and return it. + consumeIdentLikeToken(); + break; + + // EOF + // case EofCategory: + // Return an . + // break; + + // anything else + default: + // Return a with its value set to the current input code point. + type = _types_js__WEBPACK_IMPORTED_MODULE_0__.Delim; + offset++; + } + + // put token to stream + onToken(type, start, start = offset); + } +} + + + + + + + + + + +/***/ }), +/* 32 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "EOF": () => (/* binding */ EOF), +/* harmony export */ "Ident": () => (/* binding */ Ident), +/* harmony export */ "Function": () => (/* binding */ Function), +/* harmony export */ "AtKeyword": () => (/* binding */ AtKeyword), +/* harmony export */ "Hash": () => (/* binding */ Hash), +/* harmony export */ "String": () => (/* binding */ String), +/* harmony export */ "BadString": () => (/* binding */ BadString), +/* harmony export */ "Url": () => (/* binding */ Url), +/* harmony export */ "BadUrl": () => (/* binding */ BadUrl), +/* harmony export */ "Delim": () => (/* binding */ Delim), +/* harmony export */ "Number": () => (/* binding */ Number), +/* harmony export */ "Percentage": () => (/* binding */ Percentage), +/* harmony export */ "Dimension": () => (/* binding */ Dimension), +/* harmony export */ "WhiteSpace": () => (/* binding */ WhiteSpace), +/* harmony export */ "CDO": () => (/* binding */ CDO), +/* harmony export */ "CDC": () => (/* binding */ CDC), +/* harmony export */ "Colon": () => (/* binding */ Colon), +/* harmony export */ "Semicolon": () => (/* binding */ Semicolon), +/* harmony export */ "Comma": () => (/* binding */ Comma), +/* harmony export */ "LeftSquareBracket": () => (/* binding */ LeftSquareBracket), +/* harmony export */ "RightSquareBracket": () => (/* binding */ RightSquareBracket), +/* harmony export */ "LeftParenthesis": () => (/* binding */ LeftParenthesis), +/* harmony export */ "RightParenthesis": () => (/* binding */ RightParenthesis), +/* harmony export */ "LeftCurlyBracket": () => (/* binding */ LeftCurlyBracket), +/* harmony export */ "RightCurlyBracket": () => (/* binding */ RightCurlyBracket), +/* harmony export */ "Comment": () => (/* binding */ Comment) +/* harmony export */ }); +// CSS Syntax Module Level 3 +// https://www.w3.org/TR/css-syntax-3/ +const EOF = 0; // +const Ident = 1; // +const Function = 2; // +const AtKeyword = 3; // +const Hash = 4; // +const String = 5; // +const BadString = 6; // +const Url = 7; // +const BadUrl = 8; // +const Delim = 9; // +const Number = 10; // +const Percentage = 11; // +const Dimension = 12; // +const WhiteSpace = 13; // +const CDO = 14; // +const CDC = 15; // +const Colon = 16; // : +const Semicolon = 17; // ; +const Comma = 18; // , +const LeftSquareBracket = 19; // <[-token> +const RightSquareBracket = 20; // <]-token> +const LeftParenthesis = 21; // <(-token> +const RightParenthesis = 22; // <)-token> +const LeftCurlyBracket = 23; // <{-token> +const RightCurlyBracket = 24; // <}-token> +const Comment = 25; + + +/***/ }), +/* 33 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isDigit": () => (/* binding */ isDigit), +/* harmony export */ "isHexDigit": () => (/* binding */ isHexDigit), +/* harmony export */ "isUppercaseLetter": () => (/* binding */ isUppercaseLetter), +/* harmony export */ "isLowercaseLetter": () => (/* binding */ isLowercaseLetter), +/* harmony export */ "isLetter": () => (/* binding */ isLetter), +/* harmony export */ "isNonAscii": () => (/* binding */ isNonAscii), +/* harmony export */ "isNameStart": () => (/* binding */ isNameStart), +/* harmony export */ "isName": () => (/* binding */ isName), +/* harmony export */ "isNonPrintable": () => (/* binding */ isNonPrintable), +/* harmony export */ "isNewline": () => (/* binding */ isNewline), +/* harmony export */ "isWhiteSpace": () => (/* binding */ isWhiteSpace), +/* harmony export */ "isValidEscape": () => (/* binding */ isValidEscape), +/* harmony export */ "isIdentifierStart": () => (/* binding */ isIdentifierStart), +/* harmony export */ "isNumberStart": () => (/* binding */ isNumberStart), +/* harmony export */ "isBOM": () => (/* binding */ isBOM), +/* harmony export */ "EofCategory": () => (/* binding */ EofCategory), +/* harmony export */ "WhiteSpaceCategory": () => (/* binding */ WhiteSpaceCategory), +/* harmony export */ "DigitCategory": () => (/* binding */ DigitCategory), +/* harmony export */ "NameStartCategory": () => (/* binding */ NameStartCategory), +/* harmony export */ "NonPrintableCategory": () => (/* binding */ NonPrintableCategory), +/* harmony export */ "charCodeCategory": () => (/* binding */ charCodeCategory) +/* harmony export */ }); +const EOF = 0; + +// https://drafts.csswg.org/css-syntax-3/ +// § 4.2. Definitions + +// digit +// A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9). +function isDigit(code) { + return code >= 0x0030 && code <= 0x0039; +} + +// hex digit +// A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F), +// or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f). +function isHexDigit(code) { + return ( + isDigit(code) || // 0 .. 9 + (code >= 0x0041 && code <= 0x0046) || // A .. F + (code >= 0x0061 && code <= 0x0066) // a .. f + ); +} + +// uppercase letter +// A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z). +function isUppercaseLetter(code) { + return code >= 0x0041 && code <= 0x005A; +} + +// lowercase letter +// A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z). +function isLowercaseLetter(code) { + return code >= 0x0061 && code <= 0x007A; +} + +// letter +// An uppercase letter or a lowercase letter. +function isLetter(code) { + return isUppercaseLetter(code) || isLowercaseLetter(code); +} + +// non-ASCII code point +// A code point with a value equal to or greater than U+0080 . +function isNonAscii(code) { + return code >= 0x0080; +} + +// name-start code point +// A letter, a non-ASCII code point, or U+005F LOW LINE (_). +function isNameStart(code) { + return isLetter(code) || isNonAscii(code) || code === 0x005F; +} + +// name code point +// A name-start code point, a digit, or U+002D HYPHEN-MINUS (-). +function isName(code) { + return isNameStart(code) || isDigit(code) || code === 0x002D; +} + +// non-printable code point +// A code point between U+0000 NULL and U+0008 BACKSPACE, or U+000B LINE TABULATION, +// or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE, or U+007F DELETE. +function isNonPrintable(code) { + return ( + (code >= 0x0000 && code <= 0x0008) || + (code === 0x000B) || + (code >= 0x000E && code <= 0x001F) || + (code === 0x007F) + ); +} + +// newline +// U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition, +// as they are converted to U+000A LINE FEED during preprocessing. +// TODO: we doesn't do a preprocessing, so check a code point for U+000D CARRIAGE RETURN and U+000C FORM FEED +function isNewline(code) { + return code === 0x000A || code === 0x000D || code === 0x000C; +} + +// whitespace +// A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE. +function isWhiteSpace(code) { + return isNewline(code) || code === 0x0020 || code === 0x0009; +} + +// § 4.3.8. Check if two code points are a valid escape +function isValidEscape(first, second) { + // If the first code point is not U+005C REVERSE SOLIDUS (\), return false. + if (first !== 0x005C) { + return false; + } + + // Otherwise, if the second code point is a newline or EOF, return false. + if (isNewline(second) || second === EOF) { + return false; + } + + // Otherwise, return true. + return true; +} + +// § 4.3.9. Check if three code points would start an identifier +function isIdentifierStart(first, second, third) { + // Look at the first code point: + + // U+002D HYPHEN-MINUS + if (first === 0x002D) { + // If the second code point is a name-start code point or a U+002D HYPHEN-MINUS, + // or the second and third code points are a valid escape, return true. Otherwise, return false. + return ( + isNameStart(second) || + second === 0x002D || + isValidEscape(second, third) + ); + } + + // name-start code point + if (isNameStart(first)) { + // Return true. + return true; + } + + // U+005C REVERSE SOLIDUS (\) + if (first === 0x005C) { + // If the first and second code points are a valid escape, return true. Otherwise, return false. + return isValidEscape(first, second); + } + + // anything else + // Return false. + return false; +} + +// § 4.3.10. Check if three code points would start a number +function isNumberStart(first, second, third) { + // Look at the first code point: + + // U+002B PLUS SIGN (+) + // U+002D HYPHEN-MINUS (-) + if (first === 0x002B || first === 0x002D) { + // If the second code point is a digit, return true. + if (isDigit(second)) { + return 2; + } + + // Otherwise, if the second code point is a U+002E FULL STOP (.) + // and the third code point is a digit, return true. + // Otherwise, return false. + return second === 0x002E && isDigit(third) ? 3 : 0; + } + + // U+002E FULL STOP (.) + if (first === 0x002E) { + // If the second code point is a digit, return true. Otherwise, return false. + return isDigit(second) ? 2 : 0; + } + + // digit + if (isDigit(first)) { + // Return true. + return 1; + } + + // anything else + // Return false. + return 0; +} + +// +// Misc +// + +// detect BOM (https://en.wikipedia.org/wiki/Byte_order_mark) +function isBOM(code) { + // UTF-16BE + if (code === 0xFEFF) { + return 1; + } + + // UTF-16LE + if (code === 0xFFFE) { + return 1; + } + + return 0; +} + +// Fast code category +// Only ASCII code points has a special meaning, that's why we define a maps for 0..127 codes only +const CATEGORY = new Array(0x80); +const EofCategory = 0x80; +const WhiteSpaceCategory = 0x82; +const DigitCategory = 0x83; +const NameStartCategory = 0x84; +const NonPrintableCategory = 0x85; + +for (let i = 0; i < CATEGORY.length; i++) { + CATEGORY[i] = + isWhiteSpace(i) && WhiteSpaceCategory || + isDigit(i) && DigitCategory || + isNameStart(i) && NameStartCategory || + isNonPrintable(i) && NonPrintableCategory || + i || EofCategory; +} + +function charCodeCategory(code) { + return code < 0x80 ? CATEGORY[code] : NameStartCategory; +} + + +/***/ }), +/* 34 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getNewlineLength": () => (/* binding */ getNewlineLength), +/* harmony export */ "cmpChar": () => (/* binding */ cmpChar), +/* harmony export */ "cmpStr": () => (/* binding */ cmpStr), +/* harmony export */ "findWhiteSpaceStart": () => (/* binding */ findWhiteSpaceStart), +/* harmony export */ "findWhiteSpaceEnd": () => (/* binding */ findWhiteSpaceEnd), +/* harmony export */ "findDecimalNumberEnd": () => (/* binding */ findDecimalNumberEnd), +/* harmony export */ "consumeEscaped": () => (/* binding */ consumeEscaped), +/* harmony export */ "consumeName": () => (/* binding */ consumeName), +/* harmony export */ "consumeNumber": () => (/* binding */ consumeNumber), +/* harmony export */ "consumeBadUrlRemnants": () => (/* binding */ consumeBadUrlRemnants), +/* harmony export */ "decodeEscaped": () => (/* binding */ decodeEscaped) +/* harmony export */ }); +/* harmony import */ var _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33); + + +function getCharCode(source, offset) { + return offset < source.length ? source.charCodeAt(offset) : 0; +} + +function getNewlineLength(source, offset, code) { + if (code === 13 /* \r */ && getCharCode(source, offset + 1) === 10 /* \n */) { + return 2; + } + + return 1; +} + +function cmpChar(testStr, offset, referenceCode) { + let code = testStr.charCodeAt(offset); + + // code.toLowerCase() for A..Z + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isUppercaseLetter)(code)) { + code = code | 32; + } + + return code === referenceCode; +} + +function cmpStr(testStr, start, end, referenceStr) { + if (end - start !== referenceStr.length) { + return false; + } + + if (start < 0 || end > testStr.length) { + return false; + } + + for (let i = start; i < end; i++) { + const referenceCode = referenceStr.charCodeAt(i - start); + let testCode = testStr.charCodeAt(i); + + // testCode.toLowerCase() for A..Z + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isUppercaseLetter)(testCode)) { + testCode = testCode | 32; + } + + if (testCode !== referenceCode) { + return false; + } + } + + return true; +} + +function findWhiteSpaceStart(source, offset) { + for (; offset >= 0; offset--) { + if (!(0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isWhiteSpace)(source.charCodeAt(offset))) { + break; + } + } + + return offset + 1; +} + +function findWhiteSpaceEnd(source, offset) { + for (; offset < source.length; offset++) { + if (!(0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isWhiteSpace)(source.charCodeAt(offset))) { + break; + } + } + + return offset; +} + +function findDecimalNumberEnd(source, offset) { + for (; offset < source.length; offset++) { + if (!(0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isDigit)(source.charCodeAt(offset))) { + break; + } + } + + return offset; +} + +// § 4.3.7. Consume an escaped code point +function consumeEscaped(source, offset) { + // It assumes that the U+005C REVERSE SOLIDUS (\) has already been consumed and + // that the next input code point has already been verified to be part of a valid escape. + offset += 2; + + // hex digit + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isHexDigit)(getCharCode(source, offset - 1))) { + // Consume as many hex digits as possible, but no more than 5. + // Note that this means 1-6 hex digits have been consumed in total. + for (const maxOffset = Math.min(source.length, offset + 5); offset < maxOffset; offset++) { + if (!(0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isHexDigit)(getCharCode(source, offset))) { + break; + } + } + + // If the next input code point is whitespace, consume it as well. + const code = getCharCode(source, offset); + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isWhiteSpace)(code)) { + offset += getNewlineLength(source, offset, code); + } + } + + return offset; +} + +// §4.3.11. Consume a name +// Note: This algorithm does not do the verification of the first few code points that are necessary +// to ensure the returned code points would constitute an . If that is the intended use, +// ensure that the stream starts with an identifier before calling this algorithm. +function consumeName(source, offset) { + // Let result initially be an empty string. + // Repeatedly consume the next input code point from the stream: + for (; offset < source.length; offset++) { + const code = source.charCodeAt(offset); + + // name code point + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isName)(code)) { + // Append the code point to result. + continue; + } + + // the stream starts with a valid escape + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isValidEscape)(code, getCharCode(source, offset + 1))) { + // Consume an escaped code point. Append the returned code point to result. + offset = consumeEscaped(source, offset) - 1; + continue; + } + + // anything else + // Reconsume the current input code point. Return result. + break; + } + + return offset; +} + +// §4.3.12. Consume a number +function consumeNumber(source, offset) { + let code = source.charCodeAt(offset); + + // 2. If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), + // consume it and append it to repr. + if (code === 0x002B || code === 0x002D) { + code = source.charCodeAt(offset += 1); + } + + // 3. While the next input code point is a digit, consume it and append it to repr. + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isDigit)(code)) { + offset = findDecimalNumberEnd(source, offset + 1); + code = source.charCodeAt(offset); + } + + // 4. If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then: + if (code === 0x002E && (0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isDigit)(source.charCodeAt(offset + 1))) { + // 4.1 Consume them. + // 4.2 Append them to repr. + offset += 2; + + // 4.3 Set type to "number". + // TODO + + // 4.4 While the next input code point is a digit, consume it and append it to repr. + + offset = findDecimalNumberEnd(source, offset); + } + + // 5. If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E) + // or U+0065 LATIN SMALL LETTER E (e), ... , followed by a digit, then: + if (cmpChar(source, offset, 101 /* e */)) { + let sign = 0; + code = source.charCodeAt(offset + 1); + + // ... optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+) ... + if (code === 0x002D || code === 0x002B) { + sign = 1; + code = source.charCodeAt(offset + 2); + } + + // ... followed by a digit + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isDigit)(code)) { + // 5.1 Consume them. + // 5.2 Append them to repr. + + // 5.3 Set type to "number". + // TODO + + // 5.4 While the next input code point is a digit, consume it and append it to repr. + offset = findDecimalNumberEnd(source, offset + 1 + sign + 1); + } + } + + return offset; +} + +// § 4.3.14. Consume the remnants of a bad url +// ... its sole use is to consume enough of the input stream to reach a recovery point +// where normal tokenizing can resume. +function consumeBadUrlRemnants(source, offset) { + // Repeatedly consume the next input code point from the stream: + for (; offset < source.length; offset++) { + const code = source.charCodeAt(offset); + + // U+0029 RIGHT PARENTHESIS ()) + // EOF + if (code === 0x0029) { + // Return. + offset++; + break; + } + + if ((0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isValidEscape)(code, getCharCode(source, offset + 1))) { + // Consume an escaped code point. + // Note: This allows an escaped right parenthesis ("\)") to be encountered + // without ending the . This is otherwise identical to + // the "anything else" clause. + offset = consumeEscaped(source, offset); + } + } + + return offset; +} + +// § 4.3.7. Consume an escaped code point +// Note: This algorithm assumes that escaped is valid without leading U+005C REVERSE SOLIDUS (\) +function decodeEscaped(escaped) { + // Single char escaped that's not a hex digit + if (escaped.length === 1 && !(0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_0__.isHexDigit)(escaped.charCodeAt(0))) { + return escaped[0]; + } + + // Interpret the hex digits as a hexadecimal number. + let code = parseInt(escaped, 16); + + if ( + (code === 0) || // If this number is zero, + (code >= 0xD800 && code <= 0xDFFF) || // or is for a surrogate, + (code > 0x10FFFF) // or is greater than the maximum allowed code point + ) { + // ... return U+FFFD REPLACEMENT CHARACTER + code = 0xFFFD; + } + + // Otherwise, return the code point with that value. + return String.fromCodePoint(code); +} + + +/***/ }), +/* 35 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([ + 'EOF-token', + 'ident-token', + 'function-token', + 'at-keyword-token', + 'hash-token', + 'string-token', + 'bad-string-token', + 'url-token', + 'bad-url-token', + 'delim-token', + 'number-token', + 'percentage-token', + 'dimension-token', + 'whitespace-token', + 'CDO-token', + 'CDC-token', + 'colon-token', + 'semicolon-token', + 'comma-token', + '[-token', + ']-token', + '(-token', + ')-token', + '{-token', + '}-token' +]); + + +/***/ }), +/* 36 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "OffsetToLocation": () => (/* binding */ OffsetToLocation) +/* harmony export */ }); +/* harmony import */ var _adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(37); +/* harmony import */ var _char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33); + + + +const N = 10; +const F = 12; +const R = 13; + +function computeLinesAndColumns(host) { + const source = host.source; + const sourceLength = source.length; + const startOffset = source.length > 0 ? (0,_char_code_definitions_js__WEBPACK_IMPORTED_MODULE_1__.isBOM)(source.charCodeAt(0)) : 0; + const lines = (0,_adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__.adoptBuffer)(host.lines, sourceLength); + const columns = (0,_adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__.adoptBuffer)(host.columns, sourceLength); + let line = host.startLine; + let column = host.startColumn; + + for (let i = startOffset; i < sourceLength; i++) { + const code = source.charCodeAt(i); + + lines[i] = line; + columns[i] = column++; + + if (code === N || code === R || code === F) { + if (code === R && i + 1 < sourceLength && source.charCodeAt(i + 1) === N) { + i++; + lines[i] = line; + columns[i] = column; + } + + line++; + column = 1; + } + } + + lines[sourceLength] = line; + columns[sourceLength] = column; + + host.lines = lines; + host.columns = columns; + host.computed = true; +} + +class OffsetToLocation { + constructor() { + this.lines = null; + this.columns = null; + this.computed = false; + } + setSource(source, startOffset = 0, startLine = 1, startColumn = 1) { + this.source = source; + this.startOffset = startOffset; + this.startLine = startLine; + this.startColumn = startColumn; + this.computed = false; + } + getLocation(offset, filename) { + if (!this.computed) { + computeLinesAndColumns(this); + } + + return { + source: filename, + offset: this.startOffset + offset, + line: this.lines[offset], + column: this.columns[offset] + }; + } + getLocationRange(start, end, filename) { + if (!this.computed) { + computeLinesAndColumns(this); + } + + return { + source: filename, + start: { + offset: this.startOffset + start, + line: this.lines[start], + column: this.columns[start] + }, + end: { + offset: this.startOffset + end, + line: this.lines[end], + column: this.columns[end] + } + }; + } +}; + + +/***/ }), +/* 37 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "adoptBuffer": () => (/* binding */ adoptBuffer) +/* harmony export */ }); +const MIN_SIZE = 16 * 1024; + +function adoptBuffer(buffer = null, size) { + if (buffer === null || buffer.length < size) { + return new Uint32Array(Math.max(size + 1024, MIN_SIZE)); + } + + return buffer; +}; + + +/***/ }), +/* 38 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "TokenStream": () => (/* binding */ TokenStream) +/* harmony export */ }); +/* harmony import */ var _adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(37); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34); +/* harmony import */ var _names_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(32); + + + + + +const OFFSET_MASK = 0x00FFFFFF; +const TYPE_SHIFT = 24; +const balancePair = new Map([ + [_types_js__WEBPACK_IMPORTED_MODULE_3__.Function, _types_js__WEBPACK_IMPORTED_MODULE_3__.RightParenthesis], + [_types_js__WEBPACK_IMPORTED_MODULE_3__.LeftParenthesis, _types_js__WEBPACK_IMPORTED_MODULE_3__.RightParenthesis], + [_types_js__WEBPACK_IMPORTED_MODULE_3__.LeftSquareBracket, _types_js__WEBPACK_IMPORTED_MODULE_3__.RightSquareBracket], + [_types_js__WEBPACK_IMPORTED_MODULE_3__.LeftCurlyBracket, _types_js__WEBPACK_IMPORTED_MODULE_3__.RightCurlyBracket] +]); + +class TokenStream { + constructor(source, tokenize) { + this.setSource(source, tokenize); + } + reset() { + this.eof = false; + this.tokenIndex = -1; + this.tokenType = 0; + this.tokenStart = this.firstCharOffset; + this.tokenEnd = this.firstCharOffset; + } + setSource(source = '', tokenize = () => {}) { + source = String(source || ''); + + const sourceLength = source.length; + const offsetAndType = (0,_adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__.adoptBuffer)(this.offsetAndType, source.length + 1); // +1 because of eof-token + const balance = (0,_adopt_buffer_js__WEBPACK_IMPORTED_MODULE_0__.adoptBuffer)(this.balance, source.length + 1); + let tokenCount = 0; + let balanceCloseType = 0; + let balanceStart = 0; + let firstCharOffset = -1; + + // capture buffers + this.offsetAndType = null; + this.balance = null; + + tokenize(source, (type, start, end) => { + switch (type) { + default: + balance[tokenCount] = sourceLength; + break; + + case balanceCloseType: { + let balancePrev = balanceStart & OFFSET_MASK; + balanceStart = balance[balancePrev]; + balanceCloseType = balanceStart >> TYPE_SHIFT; + balance[tokenCount] = balancePrev; + balance[balancePrev++] = tokenCount; + for (; balancePrev < tokenCount; balancePrev++) { + if (balance[balancePrev] === sourceLength) { + balance[balancePrev] = tokenCount; + } + } + break; + } + + case _types_js__WEBPACK_IMPORTED_MODULE_3__.LeftParenthesis: + case _types_js__WEBPACK_IMPORTED_MODULE_3__.Function: + case _types_js__WEBPACK_IMPORTED_MODULE_3__.LeftSquareBracket: + case _types_js__WEBPACK_IMPORTED_MODULE_3__.LeftCurlyBracket: + balance[tokenCount] = balanceStart; + balanceCloseType = balancePair.get(type); + balanceStart = (balanceCloseType << TYPE_SHIFT) | tokenCount; + break; + } + + offsetAndType[tokenCount++] = (type << TYPE_SHIFT) | end; + if (firstCharOffset === -1) { + firstCharOffset = start; + } + }); + + // finalize buffers + offsetAndType[tokenCount] = (_types_js__WEBPACK_IMPORTED_MODULE_3__.EOF << TYPE_SHIFT) | sourceLength; // + balance[tokenCount] = sourceLength; + balance[sourceLength] = sourceLength; // prevents false positive balance match with any token + while (balanceStart !== 0) { + const balancePrev = balanceStart & OFFSET_MASK; + balanceStart = balance[balancePrev]; + balance[balancePrev] = sourceLength; + } + + this.source = source; + this.firstCharOffset = firstCharOffset === -1 ? 0 : firstCharOffset; + this.tokenCount = tokenCount; + this.offsetAndType = offsetAndType; + this.balance = balance; + + this.reset(); + this.next(); + } + + lookupType(offset) { + offset += this.tokenIndex; + + if (offset < this.tokenCount) { + return this.offsetAndType[offset] >> TYPE_SHIFT; + } + + return _types_js__WEBPACK_IMPORTED_MODULE_3__.EOF; + } + lookupOffset(offset) { + offset += this.tokenIndex; + + if (offset < this.tokenCount) { + return this.offsetAndType[offset - 1] & OFFSET_MASK; + } + + return this.source.length; + } + lookupValue(offset, referenceStr) { + offset += this.tokenIndex; + + if (offset < this.tokenCount) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.cmpStr)( + this.source, + this.offsetAndType[offset - 1] & OFFSET_MASK, + this.offsetAndType[offset] & OFFSET_MASK, + referenceStr + ); + } + + return false; + } + getTokenStart(tokenIndex) { + if (tokenIndex === this.tokenIndex) { + return this.tokenStart; + } + + if (tokenIndex > 0) { + return tokenIndex < this.tokenCount + ? this.offsetAndType[tokenIndex - 1] & OFFSET_MASK + : this.offsetAndType[this.tokenCount] & OFFSET_MASK; + } + + return this.firstCharOffset; + } + substrToCursor(start) { + return this.source.substring(start, this.tokenStart); + } + + isBalanceEdge(pos) { + return this.balance[this.tokenIndex] < pos; + } + isDelim(code, offset) { + if (offset) { + return ( + this.lookupType(offset) === _types_js__WEBPACK_IMPORTED_MODULE_3__.Delim && + this.source.charCodeAt(this.lookupOffset(offset)) === code + ); + } + + return ( + this.tokenType === _types_js__WEBPACK_IMPORTED_MODULE_3__.Delim && + this.source.charCodeAt(this.tokenStart) === code + ); + } + + skip(tokenCount) { + let next = this.tokenIndex + tokenCount; + + if (next < this.tokenCount) { + this.tokenIndex = next; + this.tokenStart = this.offsetAndType[next - 1] & OFFSET_MASK; + next = this.offsetAndType[next]; + this.tokenType = next >> TYPE_SHIFT; + this.tokenEnd = next & OFFSET_MASK; + } else { + this.tokenIndex = this.tokenCount; + this.next(); + } + } + next() { + let next = this.tokenIndex + 1; + + if (next < this.tokenCount) { + this.tokenIndex = next; + this.tokenStart = this.tokenEnd; + next = this.offsetAndType[next]; + this.tokenType = next >> TYPE_SHIFT; + this.tokenEnd = next & OFFSET_MASK; + } else { + this.eof = true; + this.tokenIndex = this.tokenCount; + this.tokenType = _types_js__WEBPACK_IMPORTED_MODULE_3__.EOF; + this.tokenStart = this.tokenEnd = this.source.length; + } + } + skipSC() { + while (this.tokenType === _types_js__WEBPACK_IMPORTED_MODULE_3__.WhiteSpace || this.tokenType === _types_js__WEBPACK_IMPORTED_MODULE_3__.Comment) { + this.next(); + } + } + skipUntilBalanced(startToken, stopConsume) { + let cursor = startToken; + let balanceEnd; + let offset; + + loop: + for (; cursor < this.tokenCount; cursor++) { + balanceEnd = this.balance[cursor]; + + // stop scanning on balance edge that points to offset before start token + if (balanceEnd < startToken) { + break loop; + } + + offset = cursor > 0 ? this.offsetAndType[cursor - 1] & OFFSET_MASK : this.firstCharOffset; + + // check stop condition + switch (stopConsume(this.source.charCodeAt(offset))) { + case 1: // just stop + break loop; + + case 2: // stop & included + cursor++; + break loop; + + default: + // fast forward to the end of balanced block + if (this.balance[balanceEnd] === cursor) { + cursor = balanceEnd; + } + } + } + + this.skip(cursor - this.tokenIndex); + } + + forEachToken(fn) { + for (let i = 0, offset = this.firstCharOffset; i < this.tokenCount; i++) { + const start = offset; + const item = this.offsetAndType[i]; + const end = item & OFFSET_MASK; + const type = item >> TYPE_SHIFT; + + offset = end; + + fn(type, start, end, i); + } + } + dump() { + const tokens = new Array(this.tokenCount); + + this.forEachToken((type, start, end, index) => { + tokens[index] = { + idx: index, + type: _names_js__WEBPACK_IMPORTED_MODULE_2__["default"][type], + chunk: this.source.substring(start, end), + balance: this.balance[index] + }; + }); + + return tokens; + } +}; + + +/***/ }), +/* 39 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createParser": () => (/* binding */ createParser) +/* harmony export */ }); +/* harmony import */ var _utils_List_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); +/* harmony import */ var _SyntaxError_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(31); +/* harmony import */ var _sequence_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43); + + + + + +const NOOP = () => {}; +const EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!) +const NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#) +const SEMICOLON = 0x003B; // U+003B SEMICOLON (;) +const LEFTCURLYBRACKET = 0x007B; // U+007B LEFT CURLY BRACKET ({) +const NULL = 0; + +function createParseContext(name) { + return function() { + return this[name](); + }; +} + +function fetchParseValues(dict) { + const result = Object.create(null); + + for (const name in dict) { + const item = dict[name]; + + if (item.parse) { + result[name] = item.parse; + } + } + + return result; +} + +function processConfig(config) { + const parseConfig = { + context: Object.create(null), + scope: Object.assign(Object.create(null), config.scope), + atrule: fetchParseValues(config.atrule), + pseudo: fetchParseValues(config.pseudo), + node: fetchParseValues(config.node) + }; + + for (const name in config.parseContext) { + switch (typeof config.parseContext[name]) { + case 'function': + parseConfig.context[name] = config.parseContext[name]; + break; + + case 'string': + parseConfig.context[name] = createParseContext(config.parseContext[name]); + break; + } + } + + return { + config: parseConfig, + ...parseConfig, + ...parseConfig.node + }; +} + +function createParser(config) { + let source = ''; + let filename = ' '; + let needPositions = false; + let onParseError = NOOP; + let onParseErrorThrow = false; + + const locationMap = new _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.OffsetToLocation(); + const parser = Object.assign(new _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.TokenStream(), processConfig(config || {}), { + parseAtrulePrelude: true, + parseRulePrelude: true, + parseValue: true, + parseCustomProperty: false, + + readSequence: _sequence_js__WEBPACK_IMPORTED_MODULE_3__.readSequence, + + consumeUntilBalanceEnd: () => 0, + consumeUntilLeftCurlyBracket(code) { + return code === LEFTCURLYBRACKET ? 1 : 0; + }, + consumeUntilLeftCurlyBracketOrSemicolon(code) { + return code === LEFTCURLYBRACKET || code === SEMICOLON ? 1 : 0; + }, + consumeUntilExclamationMarkOrSemicolon(code) { + return code === EXCLAMATIONMARK || code === SEMICOLON ? 1 : 0; + }, + consumeUntilSemicolonIncluded(code) { + return code === SEMICOLON ? 2 : 0; + }, + + createList() { + return new _utils_List_js__WEBPACK_IMPORTED_MODULE_0__.List(); + }, + createSingleNodeList(node) { + return new _utils_List_js__WEBPACK_IMPORTED_MODULE_0__.List().appendData(node); + }, + getFirstListNode(list) { + return list && list.first; + }, + getLastListNode(list) { + return list && list.last; + }, + + parseWithFallback(consumer, fallback) { + const startToken = this.tokenIndex; + + try { + return consumer.call(this); + } catch (e) { + if (onParseErrorThrow) { + throw e; + } + + const fallbackNode = fallback.call(this, startToken); + + onParseErrorThrow = true; + onParseError(e, fallbackNode); + onParseErrorThrow = false; + + return fallbackNode; + } + }, + + lookupNonWSType(offset) { + let type; + + do { + type = this.lookupType(offset++); + if (type !== _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.WhiteSpace) { + return type; + } + } while (type !== NULL); + + return NULL; + }, + + charCodeAt(offset) { + return offset >= 0 && offset < source.length ? source.charCodeAt(offset) : 0; + }, + substring(offsetStart, offsetEnd) { + return source.substring(offsetStart, offsetEnd); + }, + substrToCursor(start) { + return this.source.substring(start, this.tokenStart); + }, + + cmpChar(offset, charCode) { + return (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.cmpChar)(source, offset, charCode); + }, + cmpStr(offsetStart, offsetEnd, str) { + return (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.cmpStr)(source, offsetStart, offsetEnd, str); + }, + + consume(tokenType) { + const start = this.tokenStart; + + this.eat(tokenType); + + return this.substrToCursor(start); + }, + consumeFunctionName() { + const name = source.substring(this.tokenStart, this.tokenEnd - 1); + + this.eat(_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Function); + + return name; + }, + consumeNumber(type) { + const number = source.substring(this.tokenStart, (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.consumeNumber)(source, this.tokenStart)); + + this.eat(type); + + return number; + }, + + eat(tokenType) { + if (this.tokenType !== tokenType) { + const tokenName = _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.tokenNames[tokenType].slice(0, -6).replace(/-/g, ' ').replace(/^./, m => m.toUpperCase()); + let message = `${/[[\](){}]/.test(tokenName) ? `"${tokenName}"` : tokenName} is expected`; + let offset = this.tokenStart; + + // tweak message and offset + switch (tokenType) { + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Ident: + // when identifier is expected but there is a function or url + if (this.tokenType === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Function || this.tokenType === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Url) { + offset = this.tokenEnd - 1; + message = 'Identifier is expected but function found'; + } else { + message = 'Identifier is expected'; + } + break; + + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Hash: + if (this.isDelim(NUMBERSIGN)) { + this.next(); + offset++; + message = 'Name is expected'; + } + break; + + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Percentage: + if (this.tokenType === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Number) { + offset = this.tokenEnd; + message = 'Percent sign is expected'; + } + break; + } + + this.error(message, offset); + } + + this.next(); + }, + eatIdent(name) { + if (this.tokenType !== _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Ident || this.lookupValue(0, name) === false) { + this.error(`Identifier "${name}" is expected`); + } + + this.next(); + }, + eatDelim(code) { + if (!this.isDelim(code)) { + this.error(`Delim "${String.fromCharCode(code)}" is expected`); + } + + this.next(); + }, + + getLocation(start, end) { + if (needPositions) { + return locationMap.getLocationRange( + start, + end, + filename + ); + } + + return null; + }, + getLocationFromList(list) { + if (needPositions) { + const head = this.getFirstListNode(list); + const tail = this.getLastListNode(list); + return locationMap.getLocationRange( + head !== null ? head.loc.start.offset - locationMap.startOffset : this.tokenStart, + tail !== null ? tail.loc.end.offset - locationMap.startOffset : this.tokenStart, + filename + ); + } + + return null; + }, + + error(message, offset) { + const location = typeof offset !== 'undefined' && offset < source.length + ? locationMap.getLocation(offset) + : this.eof + ? locationMap.getLocation((0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.findWhiteSpaceStart)(source, source.length - 1)) + : locationMap.getLocation(this.tokenStart); + + throw new _SyntaxError_js__WEBPACK_IMPORTED_MODULE_1__.SyntaxError( + message || 'Unexpected input', + source, + location.offset, + location.line, + location.column + ); + } + }); + + const parse = function(source_, options) { + source = source_; + options = options || {}; + + parser.setSource(source, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.tokenize); + locationMap.setSource( + source, + options.offset, + options.line, + options.column + ); + + filename = options.filename || ' '; + needPositions = Boolean(options.positions); + onParseError = typeof options.onParseError === 'function' ? options.onParseError : NOOP; + onParseErrorThrow = false; + + parser.parseAtrulePrelude = 'parseAtrulePrelude' in options ? Boolean(options.parseAtrulePrelude) : true; + parser.parseRulePrelude = 'parseRulePrelude' in options ? Boolean(options.parseRulePrelude) : true; + parser.parseValue = 'parseValue' in options ? Boolean(options.parseValue) : true; + parser.parseCustomProperty = 'parseCustomProperty' in options ? Boolean(options.parseCustomProperty) : false; + + const { context = 'default', onComment } = options; + + if (context in parser.context === false) { + throw new Error('Unknown context `' + context + '`'); + } + + if (typeof onComment === 'function') { + parser.forEachToken((type, start, end) => { + if (type === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Comment) { + const loc = parser.getLocation(start, end); + const value = (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.cmpStr)(source, end - 2, end, '*/') + ? source.slice(start + 2, end - 2) + : source.slice(start + 2, end); + + onComment(value, loc); + } + }); + } + + const ast = parser.context[context].call(parser, options); + + if (!parser.eof) { + parser.error(); + } + + return ast; + }; + + return Object.assign(parse, { + SyntaxError: _SyntaxError_js__WEBPACK_IMPORTED_MODULE_1__.SyntaxError, + config: parser.config + }); +}; + + +/***/ }), +/* 40 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "List": () => (/* binding */ List) +/* harmony export */ }); +// +// list +// ┌──────┐ +// ┌──────────────┼─head │ +// │ │ tail─┼──────────────┐ +// │ └──────┘ │ +// ▼ ▼ +// item item item item +// ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ +// null ◀──┼─prev │◀───┼─prev │◀───┼─prev │◀───┼─prev │ +// │ next─┼───▶│ next─┼───▶│ next─┼───▶│ next─┼──▶ null +// ├──────┤ ├──────┤ ├──────┤ ├──────┤ +// │ data │ │ data │ │ data │ │ data │ +// └──────┘ └──────┘ └──────┘ └──────┘ +// + +let releasedCursors = null; + +class List { + static createItem(data) { + return { + prev: null, + next: null, + data + }; + } + + constructor() { + this.head = null; + this.tail = null; + this.cursor = null; + } + createItem(data) { + return List.createItem(data); + } + + // cursor helpers + allocateCursor(prev, next) { + let cursor; + + if (releasedCursors !== null) { + cursor = releasedCursors; + releasedCursors = releasedCursors.cursor; + cursor.prev = prev; + cursor.next = next; + cursor.cursor = this.cursor; + } else { + cursor = { + prev, + next, + cursor: this.cursor + }; + } + + this.cursor = cursor; + + return cursor; + } + releaseCursor() { + const { cursor } = this; + + this.cursor = cursor.cursor; + cursor.prev = null; + cursor.next = null; + cursor.cursor = releasedCursors; + releasedCursors = cursor; + } + updateCursors(prevOld, prevNew, nextOld, nextNew) { + let { cursor } = this; + + while (cursor !== null) { + if (cursor.prev === prevOld) { + cursor.prev = prevNew; + } + + if (cursor.next === nextOld) { + cursor.next = nextNew; + } + + cursor = cursor.cursor; + } + } + *[Symbol.iterator]() { + for (let cursor = this.head; cursor !== null; cursor = cursor.next) { + yield cursor.data; + } + } + + // getters + get size() { + let size = 0; + + for (let cursor = this.head; cursor !== null; cursor = cursor.next) { + size++; + } + + return size; + } + get isEmpty() { + return this.head === null; + } + get first() { + return this.head && this.head.data; + } + get last() { + return this.tail && this.tail.data; + } + + // convertors + fromArray(array) { + let cursor = null; + this.head = null; + + for (let data of array) { + const item = List.createItem(data); + + if (cursor !== null) { + cursor.next = item; + } else { + this.head = item; + } + + item.prev = cursor; + cursor = item; + } + + this.tail = cursor; + return this; + } + toArray() { + return [...this]; + } + toJSON() { + return [...this]; + } + + // array-like methods + forEach(fn, thisArg = this) { + // push cursor + const cursor = this.allocateCursor(null, this.head); + + while (cursor.next !== null) { + const item = cursor.next; + cursor.next = item.next; + fn.call(thisArg, item.data, item, this); + } + + // pop cursor + this.releaseCursor(); + } + forEachRight(fn, thisArg = this) { + // push cursor + const cursor = this.allocateCursor(this.tail, null); + + while (cursor.prev !== null) { + const item = cursor.prev; + cursor.prev = item.prev; + fn.call(thisArg, item.data, item, this); + } + + // pop cursor + this.releaseCursor(); + } + reduce(fn, initialValue, thisArg = this) { + // push cursor + let cursor = this.allocateCursor(null, this.head); + let acc = initialValue; + let item; + + while (cursor.next !== null) { + item = cursor.next; + cursor.next = item.next; + + acc = fn.call(thisArg, acc, item.data, item, this); + } + + // pop cursor + this.releaseCursor(); + + return acc; + } + reduceRight(fn, initialValue, thisArg = this) { + // push cursor + let cursor = this.allocateCursor(this.tail, null); + let acc = initialValue; + let item; + + while (cursor.prev !== null) { + item = cursor.prev; + cursor.prev = item.prev; + + acc = fn.call(thisArg, acc, item.data, item, this); + } + + // pop cursor + this.releaseCursor(); + + return acc; + } + some(fn, thisArg = this) { + for (let cursor = this.head; cursor !== null; cursor = cursor.next) { + if (fn.call(thisArg, cursor.data, cursor, this)) { + return true; + } + } + + return false; + } + map(fn, thisArg = this) { + const result = new List(); + + for (let cursor = this.head; cursor !== null; cursor = cursor.next) { + result.appendData(fn.call(thisArg, cursor.data, cursor, this)); + } + + return result; + } + filter(fn, thisArg = this) { + const result = new List(); + + for (let cursor = this.head; cursor !== null; cursor = cursor.next) { + if (fn.call(thisArg, cursor.data, cursor, this)) { + result.appendData(cursor.data); + } + } + + return result; + } + + nextUntil(start, fn, thisArg = this) { + if (start === null) { + return; + } + + // push cursor + const cursor = this.allocateCursor(null, start); + + while (cursor.next !== null) { + const item = cursor.next; + cursor.next = item.next; + if (fn.call(thisArg, item.data, item, this)) { + break; + } + } + + // pop cursor + this.releaseCursor(); + } + prevUntil(start, fn, thisArg = this) { + if (start === null) { + return; + } + + // push cursor + const cursor = this.allocateCursor(start, null); + + while (cursor.prev !== null) { + const item = cursor.prev; + cursor.prev = item.prev; + if (fn.call(thisArg, item.data, item, this)) { + break; + } + } + + // pop cursor + this.releaseCursor(); + } + + // mutation + clear() { + this.head = null; + this.tail = null; + } + copy() { + const result = new List(); + + for (let data of this) { + result.appendData(data); + } + + return result; + } + prepend(item) { + // head + // ^ + // item + this.updateCursors(null, item, this.head, item); + + // insert to the beginning of the list + if (this.head !== null) { + // new item <- first item + this.head.prev = item; + // new item -> first item + item.next = this.head; + } else { + // if list has no head, then it also has no tail + // in this case tail points to the new item + this.tail = item; + } + + // head always points to new item + this.head = item; + return this; + } + prependData(data) { + return this.prepend(List.createItem(data)); + } + append(item) { + return this.insert(item); + } + appendData(data) { + return this.insert(List.createItem(data)); + } + insert(item, before = null) { + if (before !== null) { + // prev before + // ^ + // item + this.updateCursors(before.prev, item, before, item); + + if (before.prev === null) { + // insert to the beginning of list + if (this.head !== before) { + throw new Error('before doesn\'t belong to list'); + } + // since head points to before therefore list doesn't empty + // no need to check tail + this.head = item; + before.prev = item; + item.next = before; + this.updateCursors(null, item); + } else { + // insert between two items + before.prev.next = item; + item.prev = before.prev; + before.prev = item; + item.next = before; + } + } else { + // tail + // ^ + // item + this.updateCursors(this.tail, item, null, item); + + // insert to the ending of the list + if (this.tail !== null) { + // last item -> new item + this.tail.next = item; + // last item <- new item + item.prev = this.tail; + } else { + // if list has no tail, then it also has no head + // in this case head points to new item + this.head = item; + } + + // tail always points to new item + this.tail = item; + } + + return this; + } + insertData(data, before) { + return this.insert(List.createItem(data), before); + } + remove(item) { + // item + // ^ + // prev next + this.updateCursors(item, item.prev, item, item.next); + + if (item.prev !== null) { + item.prev.next = item.next; + } else { + if (this.head !== item) { + throw new Error('item doesn\'t belong to list'); + } + + this.head = item.next; + } + + if (item.next !== null) { + item.next.prev = item.prev; + } else { + if (this.tail !== item) { + throw new Error('item doesn\'t belong to list'); + } + + this.tail = item.prev; + } + + item.prev = null; + item.next = null; + + return item; + } + push(data) { + this.insert(List.createItem(data)); + } + pop() { + return this.tail !== null ? this.remove(this.tail) : null; + } + unshift(data) { + this.prepend(List.createItem(data)); + } + shift() { + return this.head !== null ? this.remove(this.head) : null; + } + prependList(list) { + return this.insertList(list, this.head); + } + appendList(list) { + return this.insertList(list); + } + insertList(list, before) { + // ignore empty lists + if (list.head === null) { + return this; + } + + if (before !== undefined && before !== null) { + this.updateCursors(before.prev, list.tail, before, list.head); + + // insert in the middle of dist list + if (before.prev !== null) { + // before.prev <-> list.head + before.prev.next = list.head; + list.head.prev = before.prev; + } else { + this.head = list.head; + } + + before.prev = list.tail; + list.tail.next = before; + } else { + this.updateCursors(this.tail, list.tail, null, list.head); + + // insert to end of the list + if (this.tail !== null) { + // if destination list has a tail, then it also has a head, + // but head doesn't change + // dest tail -> source head + this.tail.next = list.head; + // dest tail <- source head + list.head.prev = this.tail; + } else { + // if list has no a tail, then it also has no a head + // in this case points head to new item + this.head = list.head; + } + + // tail always start point to new item + this.tail = list.tail; + } + + list.head = null; + list.tail = null; + return this; + } + replace(oldItem, newItemOrList) { + if ('head' in newItemOrList) { + this.insertList(newItemOrList, oldItem); + } else { + this.insert(newItemOrList, oldItem); + } + + this.remove(oldItem); + } +} + + +/***/ }), +/* 41 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SyntaxError": () => (/* binding */ SyntaxError) +/* harmony export */ }); +/* harmony import */ var _utils_create_custom_error_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(42); + + +const MAX_LINE_LENGTH = 100; +const OFFSET_CORRECTION = 60; +const TAB_REPLACEMENT = ' '; + +function sourceFragment({ source, line, column }, extraLines) { + function processLines(start, end) { + return lines + .slice(start, end) + .map((line, idx) => + String(start + idx + 1).padStart(maxNumLength) + ' |' + line + ).join('\n'); + } + + const lines = source.split(/\r\n?|\n|\f/); + const startLine = Math.max(1, line - extraLines) - 1; + const endLine = Math.min(line + extraLines, lines.length + 1); + const maxNumLength = Math.max(4, String(endLine).length) + 1; + let cutLeft = 0; + + // column correction according to replaced tab before column + column += (TAB_REPLACEMENT.length - 1) * (lines[line - 1].substr(0, column - 1).match(/\t/g) || []).length; + + if (column > MAX_LINE_LENGTH) { + cutLeft = column - OFFSET_CORRECTION + 3; + column = OFFSET_CORRECTION - 2; + } + + for (let i = startLine; i <= endLine; i++) { + if (i >= 0 && i < lines.length) { + lines[i] = lines[i].replace(/\t/g, TAB_REPLACEMENT); + lines[i] = + (cutLeft > 0 && lines[i].length > cutLeft ? '\u2026' : '') + + lines[i].substr(cutLeft, MAX_LINE_LENGTH - 2) + + (lines[i].length > cutLeft + MAX_LINE_LENGTH - 1 ? '\u2026' : ''); + } + } + + return [ + processLines(startLine, line), + new Array(column + maxNumLength + 2).join('-') + '^', + processLines(line, endLine) + ].filter(Boolean).join('\n'); +} + +function SyntaxError(message, source, offset, line, column) { + const error = Object.assign((0,_utils_create_custom_error_js__WEBPACK_IMPORTED_MODULE_0__.createCustomError)('SyntaxError', message), { + source, + offset, + line, + column, + sourceFragment(extraLines) { + return sourceFragment({ source, line, column }, isNaN(extraLines) ? 0 : extraLines); + }, + get formattedMessage() { + return ( + `Parse error: ${message}\n` + + sourceFragment({ source, line, column }, 2) + ); + } + }); + + return error; +} + + +/***/ }), +/* 42 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createCustomError": () => (/* binding */ createCustomError) +/* harmony export */ }); +function createCustomError(name, message) { + // use Object.create(), because some VMs prevent setting line/column otherwise + // (iOS Safari 10 even throws an exception) + const error = Object.create(SyntaxError.prototype); + const errorStack = new Error(); + + return Object.assign(error, { + name, + message, + get stack() { + return (errorStack.stack || '').replace(/^(.+\n){1,3}/, `${name}: ${message}\n`); + } + }); +}; + + +/***/ }), +/* 43 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "readSequence": () => (/* binding */ readSequence) +/* harmony export */ }); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); + + +function readSequence(recognizer) { + const children = this.createList(); + let space = false; + const context = { + recognizer + }; + + while (!this.eof) { + switch (this.tokenType) { + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Comment: + this.next(); + continue; + + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.WhiteSpace: + space = true; + this.next(); + continue; + } + + let child = recognizer.getNode.call(this, context); + + if (child === undefined) { + break; + } + + if (space) { + if (recognizer.onWhiteSpace) { + recognizer.onWhiteSpace.call(this, child, children, context); + } + space = false; + } + + children.push(child); + } + + if (space && recognizer.onWhiteSpace) { + recognizer.onWhiteSpace.call(this, null, children, context); + } + + return children; +}; + + +/***/ }), +/* 44 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createGenerator": () => (/* binding */ createGenerator) +/* harmony export */ }); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); +/* harmony import */ var _sourceMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45); +/* harmony import */ var _token_before_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(52); + + + + +const REVERSESOLIDUS = 0x005c; // U+005C REVERSE SOLIDUS (\) + +function processChildren(node, delimeter) { + if (typeof delimeter === 'function') { + let prev = null; + + node.children.forEach(node => { + if (prev !== null) { + delimeter.call(this, prev); + } + + this.node(node); + prev = node; + }); + + return; + } + + node.children.forEach(this.node, this); +} + +function processChunk(chunk) { + (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.tokenize)(chunk, (type, start, end) => { + this.token(type, chunk.slice(start, end)); + }); +} + +function createGenerator(config) { + const types = new Map(); + + for (let name in config.node) { + types.set(name, config.node[name].generate); + } + + return function(node, options) { + let buffer = ''; + let prevCode = 0; + let handlers = { + node(node) { + if (types.has(node.type)) { + types.get(node.type).call(publicApi, node); + } else { + throw new Error('Unknown node type: ' + node.type); + } + }, + tokenBefore: _token_before_js__WEBPACK_IMPORTED_MODULE_2__.safe, + token(type, value) { + prevCode = this.tokenBefore(prevCode, type, value); + + this.emit(value, type, false); + + if (type === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Delim && value.charCodeAt(0) === REVERSESOLIDUS) { + this.emit('\n', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.WhiteSpace, true); + } + }, + emit(value) { + buffer += value; + }, + result() { + return buffer; + } + }; + + if (options) { + if (typeof options.decorator === 'function') { + handlers = options.decorator(handlers); + } + + if (options.sourceMap) { + handlers = (0,_sourceMap_js__WEBPACK_IMPORTED_MODULE_1__.generateSourceMap)(handlers); + } + + if (options.mode in _token_before_js__WEBPACK_IMPORTED_MODULE_2__) { + handlers.tokenBefore = _token_before_js__WEBPACK_IMPORTED_MODULE_2__[options.mode]; + } + } + + const publicApi = { + node: (node) => handlers.node(node), + children: processChildren, + token: (type, value) => handlers.token(type, value), + tokenize: processChunk + }; + + handlers.node(node); + + return handlers.result(); + }; +}; + + +/***/ }), +/* 45 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "generateSourceMap": () => (/* binding */ generateSourceMap) +/* harmony export */ }); +/* harmony import */ var source_map_js_lib_source_map_generator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(46); + + +const trackNodes = new Set(['Atrule', 'Selector', 'Declaration']); + +function generateSourceMap(handlers) { + const map = new source_map_js_lib_source_map_generator_js__WEBPACK_IMPORTED_MODULE_0__.SourceMapGenerator(); + const generated = { + line: 1, + column: 0 + }; + const original = { + line: 0, // should be zero to add first mapping + column: 0 + }; + const activatedGenerated = { + line: 1, + column: 0 + }; + const activatedMapping = { + generated: activatedGenerated + }; + let line = 1; + let column = 0; + let sourceMappingActive = false; + + const origHandlersNode = handlers.node; + handlers.node = function(node) { + if (node.loc && node.loc.start && trackNodes.has(node.type)) { + const nodeLine = node.loc.start.line; + const nodeColumn = node.loc.start.column - 1; + + if (original.line !== nodeLine || + original.column !== nodeColumn) { + original.line = nodeLine; + original.column = nodeColumn; + + generated.line = line; + generated.column = column; + + if (sourceMappingActive) { + sourceMappingActive = false; + if (generated.line !== activatedGenerated.line || + generated.column !== activatedGenerated.column) { + map.addMapping(activatedMapping); + } + } + + sourceMappingActive = true; + map.addMapping({ + source: node.loc.source, + original, + generated + }); + } + } + + origHandlersNode.call(this, node); + + if (sourceMappingActive && trackNodes.has(node.type)) { + activatedGenerated.line = line; + activatedGenerated.column = column; + } + }; + + const origHandlersEmit = handlers.emit; + handlers.emit = function(value, type, auto) { + for (let i = 0; i < value.length; i++) { + if (value.charCodeAt(i) === 10) { // \n + line++; + column = 0; + } else { + column++; + } + } + + origHandlersEmit(value, type, auto); + }; + + const origHandlersResult = handlers.result; + handlers.result = function() { + if (sourceMappingActive) { + map.addMapping(activatedMapping); + } + + return { + css: origHandlersResult(), + map + }; + }; + + return handlers; +}; + + +/***/ }), +/* 46 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = __webpack_require__(47); +var util = __webpack_require__(49); +var ArraySet = (__webpack_require__(50).ArraySet); +var MappingList = (__webpack_require__(51).MappingList); + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.SourceMapGenerator = SourceMapGenerator; + + +/***/ }), +/* 47 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = __webpack_require__(48); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; + + +/***/ }), +/* 48 */ +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; + + +/***/ }), +/* 49 */ +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +var MAX_CACHED_INPUTS = 32; + +/** + * Takes some function `f(input) -> result` and returns a memoized version of + * `f`. + * + * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The + * memoization is a dumb-simple, linear least-recently-used cache. + */ +function lruMemoize(f) { + var cache = []; + + return function(input) { + for (var i = 0; i < cache.length; i++) { + if (cache[i].input === input) { + var temp = cache[0]; + cache[0] = cache[i]; + cache[i] = temp; + return cache[0].result; + } + } + + var result = f(input); + + cache.unshift({ + input, + result, + }); + + if (cache.length > MAX_CACHED_INPUTS) { + cache.pop(); + } + + return result; + }; +} + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary ' /..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +var normalize = lruMemoize(function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + // Split the path into parts between `/` characters. This is much faster than + // using `.split(/\/+/g)`. + var parts = []; + var start = 0; + var i = 0; + while (true) { + start = i; + i = path.indexOf("/", start); + if (i === -1) { + parts.push(path.slice(start)); + break; + } else { + parts.push(path.slice(start, i)); + while (i < path.length && path[i] === "/") { + i++; + } + } + } + + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +}); +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) { + var cmp + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; + + +/***/ }), +/* 50 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(49); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.ArraySet = ArraySet; + + +/***/ }), +/* 51 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(49); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.MappingList = MappingList; + + +/***/ }), +/* 52 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "spec": () => (/* binding */ spec), +/* harmony export */ "safe": () => (/* binding */ safe) +/* harmony export */ }); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); + + +const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+) +const HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-) + +const code = (type, value) => { + if (type === _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Delim) { + type = value; + } + + if (typeof type === 'string') { + const charCode = type.charCodeAt(0); + return charCode > 0x7F ? 0x8000 : charCode << 8; + } + + return type; +}; + +// https://www.w3.org/TR/css-syntax-3/#serialization +// The only requirement for serialization is that it must "round-trip" with parsing, +// that is, parsing the stylesheet must produce the same data structures as parsing, +// serializing, and parsing again, except for consecutive s, +// which may be collapsed into a single token. + +const specPairs = [ + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, '-'], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.LeftParenthesis], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, '-'], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, '-'], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, '-'], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], + + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + ['#', '-'], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + ['#', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], // https://github.com/w3c/csswg-drafts/pull/6874 + + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + ['-', '-'], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + ['-', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], // https://github.com/w3c/csswg-drafts/pull/6874 + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, '%'], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], // https://github.com/w3c/csswg-drafts/pull/6874 + + ['@', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + ['@', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + ['@', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Url], + ['@', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.BadUrl], + ['@', '-'], + ['@', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC], // https://github.com/w3c/csswg-drafts/pull/6874 + + ['.', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + ['.', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + ['.', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + + ['+', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Number], + ['+', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + ['+', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + + ['/', '*'] +]; +// validate with scripts/generate-safe +const safePairs = specPairs.concat([ + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.LeftParenthesis], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.String], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.AtKeyword, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Colon], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage, '-'], + + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Percentage], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Dimension], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Hash], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.RightParenthesis, '-'] +]); + +function createMap(pairs) { + const isWhiteSpaceRequired = new Set( + pairs.map(([prev, next]) => (code(prev) << 16 | code(next))) + ); + + return function(prevCode, type, value) { + const nextCode = code(type, value); + const nextCharCode = value.charCodeAt(0); + const emitWs = + (nextCharCode === HYPHENMINUS && + type !== _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Ident && + type !== _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Function && + type !== _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.CDC) || + (nextCharCode === PLUSSIGN) + ? isWhiteSpaceRequired.has(prevCode << 16 | nextCharCode << 8) + : isWhiteSpaceRequired.has(prevCode << 16 | nextCode); + + if (emitWs) { + this.emit(' ', _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.WhiteSpace, true); + } + + return nextCode; + }; +} + +const spec = createMap(specPairs); +const safe = createMap(safePairs); + + +/***/ }), +/* 53 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createConvertor": () => (/* binding */ createConvertor) +/* harmony export */ }); +/* harmony import */ var _utils_List_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); + + +function createConvertor(walk) { + return { + fromPlainObject: function(ast) { + walk(ast, { + enter: function(node) { + if (node.children && node.children instanceof _utils_List_js__WEBPACK_IMPORTED_MODULE_0__.List === false) { + node.children = new _utils_List_js__WEBPACK_IMPORTED_MODULE_0__.List().fromArray(node.children); + } + } + }); + + return ast; + }, + toPlainObject: function(ast) { + walk(ast, { + leave: function(node) { + if (node.children && node.children instanceof _utils_List_js__WEBPACK_IMPORTED_MODULE_0__.List) { + node.children = node.children.toArray(); + } + } + }); + + return ast; + } + }; +}; + + +/***/ }), +/* 54 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "createWalker": () => (/* binding */ createWalker) +/* harmony export */ }); +const { hasOwnProperty } = Object.prototype; +const noop = function() {}; + +function ensureFunction(value) { + return typeof value === 'function' ? value : noop; +} + +function invokeForType(fn, type) { + return function(node, item, list) { + if (node.type === type) { + fn.call(this, node, item, list); + } + }; +} + +function getWalkersFromStructure(name, nodeType) { + const structure = nodeType.structure; + const walkers = []; + + for (const key in structure) { + if (hasOwnProperty.call(structure, key) === false) { + continue; + } + + let fieldTypes = structure[key]; + const walker = { + name: key, + type: false, + nullable: false + }; + + if (!Array.isArray(fieldTypes)) { + fieldTypes = [fieldTypes]; + } + + for (const fieldType of fieldTypes) { + if (fieldType === null) { + walker.nullable = true; + } else if (typeof fieldType === 'string') { + walker.type = 'node'; + } else if (Array.isArray(fieldType)) { + walker.type = 'list'; + } + } + + if (walker.type) { + walkers.push(walker); + } + } + + if (walkers.length) { + return { + context: nodeType.walkContext, + fields: walkers + }; + } + + return null; +} + +function getTypesFromConfig(config) { + const types = {}; + + for (const name in config.node) { + if (hasOwnProperty.call(config.node, name)) { + const nodeType = config.node[name]; + + if (!nodeType.structure) { + throw new Error('Missed `structure` field in `' + name + '` node type definition'); + } + + types[name] = getWalkersFromStructure(name, nodeType); + } + } + + return types; +} + +function createTypeIterator(config, reverse) { + const fields = config.fields.slice(); + const contextName = config.context; + const useContext = typeof contextName === 'string'; + + if (reverse) { + fields.reverse(); + } + + return function(node, context, walk, walkReducer) { + let prevContextValue; + + if (useContext) { + prevContextValue = context[contextName]; + context[contextName] = node; + } + + for (const field of fields) { + const ref = node[field.name]; + + if (!field.nullable || ref) { + if (field.type === 'list') { + const breakWalk = reverse + ? ref.reduceRight(walkReducer, false) + : ref.reduce(walkReducer, false); + + if (breakWalk) { + return true; + } + } else if (walk(ref)) { + return true; + } + } + } + + if (useContext) { + context[contextName] = prevContextValue; + } + }; +} + +function createFastTraveralMap({ + StyleSheet, + Atrule, + Rule, + Block, + DeclarationList +}) { + return { + Atrule: { + StyleSheet, + Atrule, + Rule, + Block + }, + Rule: { + StyleSheet, + Atrule, + Rule, + Block + }, + Declaration: { + StyleSheet, + Atrule, + Rule, + Block, + DeclarationList + } + }; +} + +function createWalker(config) { + const types = getTypesFromConfig(config); + const iteratorsNatural = {}; + const iteratorsReverse = {}; + const breakWalk = Symbol('break-walk'); + const skipNode = Symbol('skip-node'); + + for (const name in types) { + if (hasOwnProperty.call(types, name) && types[name] !== null) { + iteratorsNatural[name] = createTypeIterator(types[name], false); + iteratorsReverse[name] = createTypeIterator(types[name], true); + } + } + + const fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural); + const fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse); + + const walk = function(root, options) { + function walkNode(node, item, list) { + const enterRet = enter.call(context, node, item, list); + + if (enterRet === breakWalk) { + return true; + } + + if (enterRet === skipNode) { + return false; + } + + if (iterators.hasOwnProperty(node.type)) { + if (iterators[node.type](node, context, walkNode, walkReducer)) { + return true; + } + } + + if (leave.call(context, node, item, list) === breakWalk) { + return true; + } + + return false; + } + + let enter = noop; + let leave = noop; + let iterators = iteratorsNatural; + let walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list); + const context = { + break: breakWalk, + skip: skipNode, + + root, + stylesheet: null, + atrule: null, + atrulePrelude: null, + rule: null, + selector: null, + block: null, + declaration: null, + function: null + }; + + if (typeof options === 'function') { + enter = options; + } else if (options) { + enter = ensureFunction(options.enter); + leave = ensureFunction(options.leave); + + if (options.reverse) { + iterators = iteratorsReverse; + } + + if (options.visit) { + if (fastTraversalIteratorsNatural.hasOwnProperty(options.visit)) { + iterators = options.reverse + ? fastTraversalIteratorsReverse[options.visit] + : fastTraversalIteratorsNatural[options.visit]; + } else if (!types.hasOwnProperty(options.visit)) { + throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).sort().join(', ') + ')'); + } + + enter = invokeForType(enter, options.visit); + leave = invokeForType(leave, options.visit); + } + } + + if (enter === noop && leave === noop) { + throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function'); + } + + walkNode(root); + }; + + walk.break = breakWalk; + walk.skip = skipNode; + + walk.find = function(ast, fn) { + let found = null; + + walk(ast, function(node, item, list) { + if (fn.call(this, node, item, list)) { + found = node; + return breakWalk; + } + }); + + return found; + }; + + walk.findLast = function(ast, fn) { + let found = null; + + walk(ast, { + reverse: true, + enter: function(node, item, list) { + if (fn.call(this, node, item, list)) { + found = node; + return breakWalk; + } + } + }); + + return found; + }; + + walk.findAll = function(ast, fn) { + const found = []; + + walk(ast, function(node, item, list) { + if (fn.call(this, node, item, list)) { + found.push(node); + } + }); + + return found; + }; + + return walk; +}; + + +/***/ }), +/* 55 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Lexer": () => (/* binding */ Lexer) +/* harmony export */ }); +/* harmony import */ var _error_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56); +/* harmony import */ var _utils_names_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58); +/* harmony import */ var _generic_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59); +/* harmony import */ var _definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62); +/* harmony import */ var _prepare_tokens_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(67); +/* harmony import */ var _match_graph_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(68); +/* harmony import */ var _match_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(69); +/* harmony import */ var _trace_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(70); +/* harmony import */ var _search_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(71); +/* harmony import */ var _structure_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(72); + + + + + + + + + + + +const cssWideKeywords = (0,_match_graph_js__WEBPACK_IMPORTED_MODULE_5__.buildMatchGraph)('inherit | initial | unset'); +const cssWideKeywordsWithExpression = (0,_match_graph_js__WEBPACK_IMPORTED_MODULE_5__.buildMatchGraph)('inherit | initial | unset | <-ms-legacy-expression>'); + +function dumpMapSyntax(map, compact, syntaxAsAst) { + const result = {}; + + for (const name in map) { + if (map[name].syntax) { + result[name] = syntaxAsAst + ? map[name].syntax + : (0,_definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_3__.generate)(map[name].syntax, { compact }); + } + } + + return result; +} + +function dumpAtruleMapSyntax(map, compact, syntaxAsAst) { + const result = {}; + + for (const [name, atrule] of Object.entries(map)) { + result[name] = { + prelude: atrule.prelude && ( + syntaxAsAst + ? atrule.prelude.syntax + : (0,_definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_3__.generate)(atrule.prelude.syntax, { compact }) + ), + descriptors: atrule.descriptors && dumpMapSyntax(atrule.descriptors, compact, syntaxAsAst) + }; + } + + return result; +} + +function valueHasVar(tokens) { + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].value.toLowerCase() === 'var(') { + return true; + } + } + + return false; +} + +function buildMatchResult(matched, error, iterations) { + return { + matched, + iterations, + error, + ..._trace_js__WEBPACK_IMPORTED_MODULE_7__ + }; +} + +function matchSyntax(lexer, syntax, value, useCommon) { + const tokens = (0,_prepare_tokens_js__WEBPACK_IMPORTED_MODULE_4__["default"])(value, lexer.syntax); + let result; + + if (valueHasVar(tokens)) { + return buildMatchResult(null, new Error('Matching for a tree with var() is not supported')); + } + + if (useCommon) { + result = (0,_match_js__WEBPACK_IMPORTED_MODULE_6__.matchAsTree)(tokens, lexer.valueCommonSyntax, lexer); + } + + if (!useCommon || !result.match) { + result = (0,_match_js__WEBPACK_IMPORTED_MODULE_6__.matchAsTree)(tokens, syntax.match, lexer); + if (!result.match) { + return buildMatchResult( + null, + new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxMatchError(result.reason, syntax.syntax, value, result), + result.iterations + ); + } + } + + return buildMatchResult(result.match, null, result.iterations); +} + +class Lexer { + constructor(config, syntax, structure) { + this.valueCommonSyntax = cssWideKeywords; + this.syntax = syntax; + this.generic = false; + this.atrules = Object.create(null); + this.properties = Object.create(null); + this.types = Object.create(null); + this.structure = structure || (0,_structure_js__WEBPACK_IMPORTED_MODULE_9__.getStructureFromConfig)(config); + + if (config) { + if (config.types) { + for (const name in config.types) { + this.addType_(name, config.types[name]); + } + } + + if (config.generic) { + this.generic = true; + for (const name in _generic_js__WEBPACK_IMPORTED_MODULE_2__["default"]) { + this.addType_(name, _generic_js__WEBPACK_IMPORTED_MODULE_2__["default"][name]); + } + } + + if (config.atrules) { + for (const name in config.atrules) { + this.addAtrule_(name, config.atrules[name]); + } + } + + if (config.properties) { + for (const name in config.properties) { + this.addProperty_(name, config.properties[name]); + } + } + } + } + + checkStructure(ast) { + function collectWarning(node, message) { + warns.push({ node, message }); + } + + const structure = this.structure; + const warns = []; + + this.syntax.walk(ast, function(node) { + if (structure.hasOwnProperty(node.type)) { + structure[node.type].check(node, collectWarning); + } else { + collectWarning(node, 'Unknown node type `' + node.type + '`'); + } + }); + + return warns.length ? warns : false; + } + + createDescriptor(syntax, type, name, parent = null) { + const ref = { + type, + name + }; + const descriptor = { + type, + name, + parent, + serializable: typeof syntax === 'string' || (syntax && typeof syntax.type === 'string'), + syntax: null, + match: null + }; + + if (typeof syntax === 'function') { + descriptor.match = (0,_match_graph_js__WEBPACK_IMPORTED_MODULE_5__.buildMatchGraph)(syntax, ref); + } else { + if (typeof syntax === 'string') { + // lazy parsing on first access + Object.defineProperty(descriptor, 'syntax', { + get() { + Object.defineProperty(descriptor, 'syntax', { + value: (0,_definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_3__.parse)(syntax) + }); + + return descriptor.syntax; + } + }); + } else { + descriptor.syntax = syntax; + } + + // lazy graph build on first access + Object.defineProperty(descriptor, 'match', { + get() { + Object.defineProperty(descriptor, 'match', { + value: (0,_match_graph_js__WEBPACK_IMPORTED_MODULE_5__.buildMatchGraph)(descriptor.syntax, ref) + }); + + return descriptor.match; + } + }); + } + + return descriptor; + } + addAtrule_(name, syntax) { + if (!syntax) { + return; + } + + this.atrules[name] = { + type: 'Atrule', + name: name, + prelude: syntax.prelude ? this.createDescriptor(syntax.prelude, 'AtrulePrelude', name) : null, + descriptors: syntax.descriptors + ? Object.keys(syntax.descriptors).reduce( + (map, descName) => { + map[descName] = this.createDescriptor(syntax.descriptors[descName], 'AtruleDescriptor', descName, name); + return map; + }, + Object.create(null) + ) + : null + }; + } + addProperty_(name, syntax) { + if (!syntax) { + return; + } + + this.properties[name] = this.createDescriptor(syntax, 'Property', name); + } + addType_(name, syntax) { + if (!syntax) { + return; + } + + this.types[name] = this.createDescriptor(syntax, 'Type', name); + + if (syntax === _generic_js__WEBPACK_IMPORTED_MODULE_2__["default"]["-ms-legacy-expression"]) { + this.valueCommonSyntax = cssWideKeywordsWithExpression; + } + } + + checkAtruleName(atruleName) { + if (!this.getAtrule(atruleName)) { + return new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxReferenceError('Unknown at-rule', '@' + atruleName); + } + } + checkAtrulePrelude(atruleName, prelude) { + const error = this.checkAtruleName(atruleName); + + if (error) { + return error; + } + + const atrule = this.getAtrule(atruleName); + + if (!atrule.prelude && prelude) { + return new SyntaxError('At-rule `@' + atruleName + '` should not contain a prelude'); + } + + if (atrule.prelude && !prelude) { + return new SyntaxError('At-rule `@' + atruleName + '` should contain a prelude'); + } + } + checkAtruleDescriptorName(atruleName, descriptorName) { + const error = this.checkAtruleName(atruleName); + + if (error) { + return error; + } + + const atrule = this.getAtrule(atruleName); + const descriptor = _utils_names_js__WEBPACK_IMPORTED_MODULE_1__.keyword(descriptorName); + + if (!atrule.descriptors) { + return new SyntaxError('At-rule `@' + atruleName + '` has no known descriptors'); + } + + if (!atrule.descriptors[descriptor.name] && + !atrule.descriptors[descriptor.basename]) { + return new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxReferenceError('Unknown at-rule descriptor', descriptorName); + } + } + checkPropertyName(propertyName) { + if (!this.getProperty(propertyName)) { + return new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxReferenceError('Unknown property', propertyName); + } + } + + matchAtrulePrelude(atruleName, prelude) { + const error = this.checkAtrulePrelude(atruleName, prelude); + + if (error) { + return buildMatchResult(null, error); + } + + if (!prelude) { + return buildMatchResult(null, null); + } + + return matchSyntax(this, this.getAtrule(atruleName).prelude, prelude, false); + } + matchAtruleDescriptor(atruleName, descriptorName, value) { + const error = this.checkAtruleDescriptorName(atruleName, descriptorName); + + if (error) { + return buildMatchResult(null, error); + } + + const atrule = this.getAtrule(atruleName); + const descriptor = _utils_names_js__WEBPACK_IMPORTED_MODULE_1__.keyword(descriptorName); + + return matchSyntax(this, atrule.descriptors[descriptor.name] || atrule.descriptors[descriptor.basename], value, false); + } + matchDeclaration(node) { + if (node.type !== 'Declaration') { + return buildMatchResult(null, new Error('Not a Declaration node')); + } + + return this.matchProperty(node.property, node.value); + } + matchProperty(propertyName, value) { + // don't match syntax for a custom property at the moment + if (_utils_names_js__WEBPACK_IMPORTED_MODULE_1__.property(propertyName).custom) { + return buildMatchResult(null, new Error('Lexer matching doesn\'t applicable for custom properties')); + } + + const error = this.checkPropertyName(propertyName); + + if (error) { + return buildMatchResult(null, error); + } + + return matchSyntax(this, this.getProperty(propertyName), value, true); + } + matchType(typeName, value) { + const typeSyntax = this.getType(typeName); + + if (!typeSyntax) { + return buildMatchResult(null, new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxReferenceError('Unknown type', typeName)); + } + + return matchSyntax(this, typeSyntax, value, false); + } + match(syntax, value) { + if (typeof syntax !== 'string' && (!syntax || !syntax.type)) { + return buildMatchResult(null, new _error_js__WEBPACK_IMPORTED_MODULE_0__.SyntaxReferenceError('Bad syntax')); + } + + if (typeof syntax === 'string' || !syntax.match) { + syntax = this.createDescriptor(syntax, 'Type', 'anonymous'); + } + + return matchSyntax(this, syntax, value, false); + } + + findValueFragments(propertyName, value, type, name) { + return (0,_search_js__WEBPACK_IMPORTED_MODULE_8__.matchFragments)(this, value, this.matchProperty(propertyName, value), type, name); + } + findDeclarationValueFragments(declaration, type, name) { + return (0,_search_js__WEBPACK_IMPORTED_MODULE_8__.matchFragments)(this, declaration.value, this.matchDeclaration(declaration), type, name); + } + findAllFragments(ast, type, name) { + const result = []; + + this.syntax.walk(ast, { + visit: 'Declaration', + enter: (declaration) => { + result.push.apply(result, this.findDeclarationValueFragments(declaration, type, name)); + } + }); + + return result; + } + + getAtrule(atruleName, fallbackBasename = true) { + const atrule = _utils_names_js__WEBPACK_IMPORTED_MODULE_1__.keyword(atruleName); + const atruleEntry = atrule.vendor && fallbackBasename + ? this.atrules[atrule.name] || this.atrules[atrule.basename] + : this.atrules[atrule.name]; + + return atruleEntry || null; + } + getAtrulePrelude(atruleName, fallbackBasename = true) { + const atrule = this.getAtrule(atruleName, fallbackBasename); + + return atrule && atrule.prelude || null; + } + getAtruleDescriptor(atruleName, name) { + return this.atrules.hasOwnProperty(atruleName) && this.atrules.declarators + ? this.atrules[atruleName].declarators[name] || null + : null; + } + getProperty(propertyName, fallbackBasename = true) { + const property = _utils_names_js__WEBPACK_IMPORTED_MODULE_1__.property(propertyName); + const propertyEntry = property.vendor && fallbackBasename + ? this.properties[property.name] || this.properties[property.basename] + : this.properties[property.name]; + + return propertyEntry || null; + } + getType(name) { + return hasOwnProperty.call(this.types, name) ? this.types[name] : null; + } + + validate() { + function validate(syntax, name, broken, descriptor) { + if (broken.has(name)) { + return broken.get(name); + } + + broken.set(name, false); + if (descriptor.syntax !== null) { + (0,_definition_syntax_index_js__WEBPACK_IMPORTED_MODULE_3__.walk)(descriptor.syntax, function(node) { + if (node.type !== 'Type' && node.type !== 'Property') { + return; + } + + const map = node.type === 'Type' ? syntax.types : syntax.properties; + const brokenMap = node.type === 'Type' ? brokenTypes : brokenProperties; + + if (!hasOwnProperty.call(map, node.name) || validate(syntax, node.name, brokenMap, map[node.name])) { + broken.set(name, true); + } + }, this); + } + } + + let brokenTypes = new Map(); + let brokenProperties = new Map(); + + for (const key in this.types) { + validate(this, key, brokenTypes, this.types[key]); + } + + for (const key in this.properties) { + validate(this, key, brokenProperties, this.properties[key]); + } + + brokenTypes = [...brokenTypes.keys()].filter(name => brokenTypes.get(name)); + brokenProperties = [...brokenProperties.keys()].filter(name => brokenProperties.get(name)); + + if (brokenTypes.length || brokenProperties.length) { + return { + types: brokenTypes, + properties: brokenProperties + }; + } + + return null; + } + dump(syntaxAsAst, pretty) { + return { + generic: this.generic, + types: dumpMapSyntax(this.types, !pretty, syntaxAsAst), + properties: dumpMapSyntax(this.properties, !pretty, syntaxAsAst), + atrules: dumpAtruleMapSyntax(this.atrules, !pretty, syntaxAsAst) + }; + } + toString() { + return JSON.stringify(this.dump()); + } +}; + + +/***/ }), +/* 56 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SyntaxReferenceError": () => (/* binding */ SyntaxReferenceError), +/* harmony export */ "SyntaxMatchError": () => (/* binding */ SyntaxMatchError) +/* harmony export */ }); +/* harmony import */ var _utils_create_custom_error_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(42); +/* harmony import */ var _definition_syntax_generate_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57); + + + +const defaultLoc = { offset: 0, line: 1, column: 1 }; + +function locateMismatch(matchResult, node) { + const tokens = matchResult.tokens; + const longestMatch = matchResult.longestMatch; + const mismatchNode = longestMatch < tokens.length ? tokens[longestMatch].node || null : null; + const badNode = mismatchNode !== node ? mismatchNode : null; + let mismatchOffset = 0; + let mismatchLength = 0; + let entries = 0; + let css = ''; + let start; + let end; + + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i].value; + + if (i === longestMatch) { + mismatchLength = token.length; + mismatchOffset = css.length; + } + + if (badNode !== null && tokens[i].node === badNode) { + if (i <= longestMatch) { + entries++; + } else { + entries = 0; + } + } + + css += token; + } + + if (longestMatch === tokens.length || entries > 1) { // last + start = fromLoc(badNode || node, 'end') || buildLoc(defaultLoc, css); + end = buildLoc(start); + } else { + start = fromLoc(badNode, 'start') || + buildLoc(fromLoc(node, 'start') || defaultLoc, css.slice(0, mismatchOffset)); + end = fromLoc(badNode, 'end') || + buildLoc(start, css.substr(mismatchOffset, mismatchLength)); + } + + return { + css, + mismatchOffset, + mismatchLength, + start, + end + }; +} + +function fromLoc(node, point) { + const value = node && node.loc && node.loc[point]; + + if (value) { + return 'line' in value ? buildLoc(value) : value; + } + + return null; +} + +function buildLoc({ offset, line, column }, extra) { + const loc = { + offset, + line, + column + }; + + if (extra) { + const lines = extra.split(/\n|\r\n?|\f/); + + loc.offset += extra.length; + loc.line += lines.length - 1; + loc.column = lines.length === 1 ? loc.column + extra.length : lines.pop().length + 1; + } + + return loc; +} + +const SyntaxReferenceError = function(type, referenceName) { + const error = (0,_utils_create_custom_error_js__WEBPACK_IMPORTED_MODULE_0__.createCustomError)( + 'SyntaxReferenceError', + type + (referenceName ? ' `' + referenceName + '`' : '') + ); + + error.reference = referenceName; + + return error; +}; + +const SyntaxMatchError = function(message, syntax, node, matchResult) { + const error = (0,_utils_create_custom_error_js__WEBPACK_IMPORTED_MODULE_0__.createCustomError)('SyntaxMatchError', message); + const { + css, + mismatchOffset, + mismatchLength, + start, + end + } = locateMismatch(matchResult, node); + + error.rawMessage = message; + error.syntax = syntax ? (0,_definition_syntax_generate_js__WEBPACK_IMPORTED_MODULE_1__.generate)(syntax) : ' '; + error.css = css; + error.mismatchOffset = mismatchOffset; + error.mismatchLength = mismatchLength; + error.message = message + '\n' + + ' syntax: ' + error.syntax + '\n' + + ' value: ' + (css || ' ') + '\n' + + ' --------' + new Array(error.mismatchOffset + 1).join('-') + '^'; + + Object.assign(error, start); + error.loc = { + source: (node && node.loc && node.loc.source) || ' ', + start, + end + }; + + return error; +}; + + +/***/ }), +/* 57 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "generate": () => (/* binding */ generate) +/* harmony export */ }); +function noop(value) { + return value; +} + +function generateMultiplier(multiplier) { + const { min, max, comma } = multiplier; + + if (min === 0 && max === 0) { + return '*'; + } + + if (min === 0 && max === 1) { + return '?'; + } + + if (min === 1 && max === 0) { + return comma ? '#' : '+'; + } + + if (min === 1 && max === 1) { + return ''; + } + + return ( + (comma ? '#' : '') + + (min === max + ? '{' + min + '}' + : '{' + min + ',' + (max !== 0 ? max : '') + '}' + ) + ); +} + +function generateTypeOpts(node) { + switch (node.type) { + case 'Range': + return ( + ' [' + + (node.min === null ? '-∞' : node.min) + + ',' + + (node.max === null ? '∞' : node.max) + + ']' + ); + + default: + throw new Error('Unknown node type `' + node.type + '`'); + } +} + +function generateSequence(node, decorate, forceBraces, compact) { + const combinator = node.combinator === ' ' || compact ? node.combinator : ' ' + node.combinator + ' '; + const result = node.terms + .map(term => internalGenerate(term, decorate, forceBraces, compact)) + .join(combinator); + + if (node.explicit || forceBraces) { + return (compact || result[0] === ',' ? '[' : '[ ') + result + (compact ? ']' : ' ]'); + } + + return result; +} + +function internalGenerate(node, decorate, forceBraces, compact) { + let result; + + switch (node.type) { + case 'Group': + result = + generateSequence(node, decorate, forceBraces, compact) + + (node.disallowEmpty ? '!' : ''); + break; + + case 'Multiplier': + // return since node is a composition + return ( + internalGenerate(node.term, decorate, forceBraces, compact) + + decorate(generateMultiplier(node), node) + ); + + case 'Type': + result = '<' + node.name + (node.opts ? decorate(generateTypeOpts(node.opts), node.opts) : '') + '>'; + break; + + case 'Property': + result = '<\'' + node.name + '\'>'; + break; + + case 'Keyword': + result = node.name; + break; + + case 'AtKeyword': + result = '@' + node.name; + break; + + case 'Function': + result = node.name + '('; + break; + + case 'String': + case 'Token': + result = node.value; + break; + + case 'Comma': + result = ','; + break; + + default: + throw new Error('Unknown node type `' + node.type + '`'); + } + + return decorate(result, node); +} + +function generate(node, options) { + let decorate = noop; + let forceBraces = false; + let compact = false; + + if (typeof options === 'function') { + decorate = options; + } else if (options) { + forceBraces = Boolean(options.forceBraces); + compact = Boolean(options.compact); + if (typeof options.decorate === 'function') { + decorate = options.decorate; + } + } + + return internalGenerate(node, decorate, forceBraces, compact); +}; + + +/***/ }), +/* 58 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "keyword": () => (/* binding */ keyword), +/* harmony export */ "property": () => (/* binding */ property), +/* harmony export */ "vendorPrefix": () => (/* binding */ vendorPrefix), +/* harmony export */ "isCustomProperty": () => (/* binding */ isCustomProperty) +/* harmony export */ }); +const keywords = new Map(); +const properties = new Map(); +const HYPHENMINUS = 45; // '-'.charCodeAt() + +const keyword = getKeywordDescriptor; +const property = getPropertyDescriptor; +const vendorPrefix = getVendorPrefix; +function isCustomProperty(str, offset) { + offset = offset || 0; + + return str.length - offset >= 2 && + str.charCodeAt(offset) === HYPHENMINUS && + str.charCodeAt(offset + 1) === HYPHENMINUS; +} + +function getVendorPrefix(str, offset) { + offset = offset || 0; + + // verdor prefix should be at least 3 chars length + if (str.length - offset >= 3) { + // vendor prefix starts with hyper minus following non-hyper minus + if (str.charCodeAt(offset) === HYPHENMINUS && + str.charCodeAt(offset + 1) !== HYPHENMINUS) { + // vendor prefix should contain a hyper minus at the ending + const secondDashIndex = str.indexOf('-', offset + 2); + + if (secondDashIndex !== -1) { + return str.substring(offset, secondDashIndex + 1); + } + } + } + + return ''; +} + +function getKeywordDescriptor(keyword) { + if (keywords.has(keyword)) { + return keywords.get(keyword); + } + + const name = keyword.toLowerCase(); + let descriptor = keywords.get(name); + + if (descriptor === undefined) { + const custom = isCustomProperty(name, 0); + const vendor = !custom ? getVendorPrefix(name, 0) : ''; + descriptor = Object.freeze({ + basename: name.substr(vendor.length), + name, + prefix: vendor, + vendor, + custom + }); + } + + keywords.set(keyword, descriptor); + + return descriptor; +} + +function getPropertyDescriptor(property) { + if (properties.has(property)) { + return properties.get(property); + } + + let name = property; + let hack = property[0]; + + if (hack === '/') { + hack = property[1] === '/' ? '//' : '/'; + } else if (hack !== '_' && + hack !== '*' && + hack !== '$' && + hack !== '#' && + hack !== '+' && + hack !== '&') { + hack = ''; + } + + const custom = isCustomProperty(name, hack.length); + + // re-use result when possible (the same as for lower case) + if (!custom) { + name = name.toLowerCase(); + if (properties.has(name)) { + const descriptor = properties.get(name); + properties.set(property, descriptor); + return descriptor; + } + } + + const vendor = !custom ? getVendorPrefix(name, hack.length) : ''; + const prefix = name.substr(0, hack.length + vendor.length); + const descriptor = Object.freeze({ + basename: name.substr(prefix.length), + name: name.substr(hack.length), + hack, + vendor, + prefix, + custom + }); + + properties.set(property, descriptor); + + return descriptor; +} + + +/***/ }), +/* 59 */ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _generic_an_plus_b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60); +/* harmony import */ var _generic_urange_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(61); +/* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(31); + + + + +const cssWideKeywords = ['unset', 'initial', 'inherit']; +const calcFunctionNames = ['calc(', '-moz-calc(', '-webkit-calc(']; +const balancePair = new Map([ + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Function, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightParenthesis], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftParenthesis, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightParenthesis], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftSquareBracket, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightSquareBracket], + [_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftCurlyBracket, _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightCurlyBracket] +]); + +// units +const LENGTH = [ // https://www.w3.org/TR/css-values-3/#lengths + 'px', 'mm', 'cm', 'in', 'pt', 'pc', 'q', // absolute length units + 'em', 'ex', 'ch', 'rem', // relative length units + 'vh', 'vw', 'vmin', 'vmax', 'vm' // viewport-percentage lengths +]; +const ANGLE = ['deg', 'grad', 'rad', 'turn']; // https://www.w3.org/TR/css-values-3/#angles +const TIME = ['s', 'ms']; // https://www.w3.org/TR/css-values-3/#time +const FREQUENCY = ['hz', 'khz']; // https://www.w3.org/TR/css-values-3/#frequency +const RESOLUTION = ['dpi', 'dpcm', 'dppx', 'x']; // https://www.w3.org/TR/css-values-3/#resolution +const FLEX = ['fr']; // https://drafts.csswg.org/css-grid/#fr-unit +const DECIBEL = ['db']; // https://www.w3.org/TR/css3-speech/#mixing-props-voice-volume +const SEMITONES = ['st']; // https://www.w3.org/TR/css3-speech/#voice-props-voice-pitch + +// safe char code getter +function charCodeAt(str, index) { + return index < str.length ? str.charCodeAt(index) : 0; +} + +function eqStr(actual, expected) { + return (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.cmpStr)(actual, 0, actual.length, expected); +} + +function eqStrAny(actual, expected) { + for (let i = 0; i < expected.length; i++) { + if (eqStr(actual, expected[i])) { + return true; + } + } + + return false; +} + +// IE postfix hack, i.e. 123\0 or 123px\9 +function isPostfixIeHack(str, offset) { + if (offset !== str.length - 2) { + return false; + } + + return ( + charCodeAt(str, offset) === 0x005C && // U+005C REVERSE SOLIDUS (\) + (0,_tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.isDigit)(charCodeAt(str, offset + 1)) + ); +} + +function outOfRange(opts, value, numEnd) { + if (opts && opts.type === 'Range') { + const num = Number( + numEnd !== undefined && numEnd !== value.length + ? value.substr(0, numEnd) + : value + ); + + if (isNaN(num)) { + return true; + } + + if (opts.min !== null && num < opts.min) { + return true; + } + + if (opts.max !== null && num > opts.max) { + return true; + } + } + + return false; +} + +function consumeFunction(token, getNextToken) { + let balanceCloseType = 0; + let balanceStash = []; + let length = 0; + + // balanced token consuming + scan: + do { + switch (token.type) { + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightCurlyBracket: + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightParenthesis: + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.RightSquareBracket: + if (token.type !== balanceCloseType) { + break scan; + } + + balanceCloseType = balanceStash.pop(); + + if (balanceStash.length === 0) { + length++; + break scan; + } + + break; + + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.Function: + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftParenthesis: + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftSquareBracket: + case _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_2__.LeftCurlyBracket: + balanceStash.push(balanceCloseType); + balanceCloseType = balancePair.get(token.type); + break; + } + + length++; + } while (token = getNextToken(length)); + + return length; +} + +// TODO: implement +// can be used wherever , , ,