diff --git a/demonstrators/geodatawizard-acceptance/LDWizard-base.min.js b/demonstrators/geodatawizard-acceptance/LDWizard-base.min.js index fe888f7d..949ae6ed 100644 --- a/demonstrators/geodatawizard-acceptance/LDWizard-base.min.js +++ b/demonstrators/geodatawizard-acceptance/LDWizard-base.min.js @@ -4,10302 +4,9446 @@ /***/ 7445: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - "use strict"; - - - const { AbortError, codes } = __webpack_require__(57186) - const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(19654) - const eos = __webpack_require__(28425) - const { ERR_INVALID_ARG_TYPE } = codes - - // This method is inlined here for readable-stream - // It also does not allow for signal to not exist on the stream - // https://github.com/nodejs/node/pull/36061#discussion_r533718029 - const validateAbortSignal = (signal, name) => { - if (typeof signal !== 'object' || !('aborted' in signal)) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } - } - module.exports.addAbortSignal = function addAbortSignal(signal, stream) { - validateAbortSignal(signal, 'signal') - if (!isNodeStream(stream) && !isWebStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - return module.exports.addAbortSignalNoValidate(signal, stream) - } - module.exports.addAbortSignalNoValidate = function (signal, stream) { - if (typeof signal !== 'object' || !('aborted' in signal)) { - return stream - } - const onAbort = isNodeStream(stream) - ? () => { - stream.destroy( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - : () => { - stream[kControllerErrorFunction]( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - if (signal.aborted) { - onAbort() - } else { - signal.addEventListener('abort', onAbort) - eos(stream, () => signal.removeEventListener('abort', onAbort)) - } +"use strict"; + + +const { AbortError, codes } = __webpack_require__(57186) +const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(19654) +const eos = __webpack_require__(28425) +const { ERR_INVALID_ARG_TYPE } = codes + +// This method is inlined here for readable-stream +// It also does not allow for signal to not exist on the stream +// https://github.com/nodejs/node/pull/36061#discussion_r533718029 +const validateAbortSignal = (signal, name) => { + if (typeof signal !== 'object' || !('aborted' in signal)) { + throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) + } +} +module.exports.addAbortSignal = function addAbortSignal(signal, stream) { + validateAbortSignal(signal, 'signal') + if (!isNodeStream(stream) && !isWebStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } + return module.exports.addAbortSignalNoValidate(signal, stream) +} +module.exports.addAbortSignalNoValidate = function (signal, stream) { + if (typeof signal !== 'object' || !('aborted' in signal)) { return stream } - - - /***/ }), - - /***/ 29390: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(78969) - const { Buffer } = __webpack_require__(2486) - const { inspect } = __webpack_require__(64083) - module.exports = class BufferList { - constructor() { - this.head = null - this.tail = null - this.length = 0 - } - push(v) { - const entry = { - data: v, - next: null - } - if (this.length > 0) this.tail.next = entry - else this.head = entry - this.tail = entry - ++this.length - } - unshift(v) { - const entry = { - data: v, - next: this.head + const onAbort = isNodeStream(stream) + ? () => { + stream.destroy( + new AbortError(undefined, { + cause: signal.reason + }) + ) } - if (this.length === 0) this.tail = entry - this.head = entry - ++this.length - } - shift() { - if (this.length === 0) return - const ret = this.head.data - if (this.length === 1) this.head = this.tail = null - else this.head = this.head.next - --this.length - return ret - } - clear() { - this.head = this.tail = null - this.length = 0 - } - join(s) { - if (this.length === 0) return '' - let p = this.head - let ret = '' + p.data - while ((p = p.next) !== null) ret += s + p.data - return ret - } - concat(n) { - if (this.length === 0) return Buffer.alloc(0) - const ret = Buffer.allocUnsafe(n >>> 0) - let p = this.head - let i = 0 - while (p) { - TypedArrayPrototypeSet(ret, p.data, i) - i += p.data.length - p = p.next + : () => { + stream[kControllerErrorFunction]( + new AbortError(undefined, { + cause: signal.reason + }) + ) } - return ret + if (signal.aborted) { + onAbort() + } else { + signal.addEventListener('abort', onAbort) + eos(stream, () => signal.removeEventListener('abort', onAbort)) + } + return stream +} + + +/***/ }), + +/***/ 29390: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(78969) +const { Buffer } = __webpack_require__(2486) +const { inspect } = __webpack_require__(64083) +module.exports = class BufferList { + constructor() { + this.head = null + this.tail = null + this.length = 0 + } + push(v) { + const entry = { + data: v, + next: null + } + if (this.length > 0) this.tail.next = entry + else this.head = entry + this.tail = entry + ++this.length + } + unshift(v) { + const entry = { + data: v, + next: this.head + } + if (this.length === 0) this.tail = entry + this.head = entry + ++this.length + } + shift() { + if (this.length === 0) return + const ret = this.head.data + if (this.length === 1) this.head = this.tail = null + else this.head = this.head.next + --this.length + return ret + } + clear() { + this.head = this.tail = null + this.length = 0 + } + join(s) { + if (this.length === 0) return '' + let p = this.head + let ret = '' + p.data + while ((p = p.next) !== null) ret += s + p.data + return ret + } + concat(n) { + if (this.length === 0) return Buffer.alloc(0) + const ret = Buffer.allocUnsafe(n >>> 0) + let p = this.head + let i = 0 + while (p) { + TypedArrayPrototypeSet(ret, p.data, i) + i += p.data.length + p = p.next } - - // Consumes a specified amount of bytes or characters from the buffered data. - consume(n, hasStrings) { - const data = this.head.data - if (n < data.length) { - // `slice` is the same for buffers and strings. - const slice = data.slice(0, n) - this.head.data = data.slice(n) - return slice - } - if (n === data.length) { - // First chunk is a perfect match. - return this.shift() - } - // Result spans more than one buffer. - return hasStrings ? this._getString(n) : this._getBuffer(n) + return ret + } + + // Consumes a specified amount of bytes or characters from the buffered data. + consume(n, hasStrings) { + const data = this.head.data + if (n < data.length) { + // `slice` is the same for buffers and strings. + const slice = data.slice(0, n) + this.head.data = data.slice(n) + return slice } - first() { - return this.head.data + if (n === data.length) { + // First chunk is a perfect match. + return this.shift() } - *[SymbolIterator]() { - for (let p = this.head; p; p = p.next) { - yield p.data - } + // Result spans more than one buffer. + return hasStrings ? this._getString(n) : this._getBuffer(n) + } + first() { + return this.head.data + } + *[SymbolIterator]() { + for (let p = this.head; p; p = p.next) { + yield p.data } - - // Consumes a specified amount of characters from the buffered data. - _getString(n) { - let ret = '' - let p = this.head - let c = 0 - do { - const str = p.data - if (n > str.length) { + } + + // Consumes a specified amount of characters from the buffered data. + _getString(n) { + let ret = '' + let p = this.head + let c = 0 + do { + const str = p.data + if (n > str.length) { + ret += str + n -= str.length + } else { + if (n === str.length) { ret += str - n -= str.length + ++c + if (p.next) this.head = p.next + else this.head = this.tail = null } else { - if (n === str.length) { - ret += str - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - ret += StringPrototypeSlice(str, 0, n) - this.head = p - p.data = StringPrototypeSlice(str, n) - } - break + ret += StringPrototypeSlice(str, 0, n) + this.head = p + p.data = StringPrototypeSlice(str, n) } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Consumes a specified amount of bytes from the buffered data. - _getBuffer(n) { - const ret = Buffer.allocUnsafe(n) - const retLen = n - let p = this.head - let c = 0 - do { - const buf = p.data - if (n > buf.length) { + break + } + ++c + } while ((p = p.next) !== null) + this.length -= c + return ret + } + + // Consumes a specified amount of bytes from the buffered data. + _getBuffer(n) { + const ret = Buffer.allocUnsafe(n) + const retLen = n + let p = this.head + let c = 0 + do { + const buf = p.data + if (n > buf.length) { + TypedArrayPrototypeSet(ret, buf, retLen - n) + n -= buf.length + } else { + if (n === buf.length) { TypedArrayPrototypeSet(ret, buf, retLen - n) - n -= buf.length + ++c + if (p.next) this.head = p.next + else this.head = this.tail = null } else { - if (n === buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) - this.head = p - p.data = buf.slice(n) - } - break + TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) + this.head = p + p.data = buf.slice(n) } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret + break + } + ++c + } while ((p = p.next) !== null) + this.length -= c + return ret + } + + // Make sure the linked list only shows the minimal necessary information. + [Symbol.for('nodejs.util.inspect.custom')](_, options) { + return inspect(this, { + ...options, + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + }) + } +} + + +/***/ }), + +/***/ 80150: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { pipeline } = __webpack_require__(93002) +const Duplex = __webpack_require__(56725) +const { destroyer } = __webpack_require__(79638) +const { + isNodeStream, + isReadable, + isWritable, + isWebStream, + isTransformStream, + isWritableStream, + isReadableStream +} = __webpack_require__(19654) +const { + AbortError, + codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } +} = __webpack_require__(57186) +const eos = __webpack_require__(28425) +module.exports = function compose(...streams) { + if (streams.length === 0) { + throw new ERR_MISSING_ARGS('streams') + } + if (streams.length === 1) { + return Duplex.from(streams[0]) + } + const orgStreams = [...streams] + if (typeof streams[0] === 'function') { + streams[0] = Duplex.from(streams[0]) + } + if (typeof streams[streams.length - 1] === 'function') { + const idx = streams.length - 1 + streams[idx] = Duplex.from(streams[idx]) + } + for (let n = 0; n < streams.length; ++n) { + if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { + // TODO(ronag): Add checks for non streams. + continue } - - // Make sure the linked list only shows the minimal necessary information. - [Symbol.for('nodejs.util.inspect.custom')](_, options) { - return inspect(this, { - ...options, - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - }) + if ( + n < streams.length - 1 && + !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) + ) { + throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') + } + if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { + throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') } } - - - /***/ }), - - /***/ 80150: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { pipeline } = __webpack_require__(93002) - const Duplex = __webpack_require__(56725) - const { destroyer } = __webpack_require__(79638) - const { - isNodeStream, - isReadable, - isWritable, - isWebStream, - isTransformStream, - isWritableStream, - isReadableStream - } = __webpack_require__(19654) - const { - AbortError, - codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } - } = __webpack_require__(57186) - const eos = __webpack_require__(28425) - module.exports = function compose(...streams) { - if (streams.length === 0) { - throw new ERR_MISSING_ARGS('streams') - } - if (streams.length === 1) { - return Duplex.from(streams[0]) - } - const orgStreams = [...streams] - if (typeof streams[0] === 'function') { - streams[0] = Duplex.from(streams[0]) - } - if (typeof streams[streams.length - 1] === 'function') { - const idx = streams.length - 1 - streams[idx] = Duplex.from(streams[idx]) - } - for (let n = 0; n < streams.length; ++n) { - if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { - // TODO(ronag): Add checks for non streams. - continue - } - if ( - n < streams.length - 1 && - !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) - ) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') - } - if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') - } + let ondrain + let onfinish + let onreadable + let onclose + let d + function onfinished(err) { + const cb = onclose + onclose = null + if (cb) { + cb(err) + } else if (err) { + d.destroy(err) + } else if (!readable && !writable) { + d.destroy() } - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } else if (!readable && !writable) { - d.destroy() - } - } - const head = streams[0] - const tail = pipeline(streams, onfinished) - const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) - const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplex({ - // TODO (ronag): highWaterMark? - writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), - readableObjectMode: !!(tail !== null && tail !== undefined && tail.writableObjectMode), - writable, - readable - }) - if (writable) { - if (isNodeStream(head)) { - d._write = function (chunk, encoding, callback) { - if (head.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } + } + const head = streams[0] + const tail = pipeline(streams, onfinished) + const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) + const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) + + // TODO(ronag): Avoid double buffering. + // Implement Writable/Readable/Duplex traits. + // See, https://github.com/nodejs/node/pull/33515. + d = new Duplex({ + // TODO (ronag): highWaterMark? + writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), + readableObjectMode: !!(tail !== null && tail !== undefined && tail.writableObjectMode), + writable, + readable + }) + if (writable) { + if (isNodeStream(head)) { + d._write = function (chunk, encoding, callback) { + if (head.write(chunk, encoding)) { + callback() + } else { + ondrain = callback } - d._final = function (callback) { - head.end() - onfinish = callback + } + d._final = function (callback) { + head.end() + onfinish = callback + } + head.on('drain', function () { + if (ondrain) { + const cb = ondrain + ondrain = null + cb() } - head.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - } else if (isWebStream(head)) { - const writable = isTransformStream(head) ? head.writable : head - const writer = writable.getWriter() - d._write = async function (chunk, encoding, callback) { - try { - await writer.ready - writer.write(chunk).catch(() => {}) - callback() - } catch (err) { - callback(err) - } + }) + } else if (isWebStream(head)) { + const writable = isTransformStream(head) ? head.writable : head + const writer = writable.getWriter() + d._write = async function (chunk, encoding, callback) { + try { + await writer.ready + writer.write(chunk).catch(() => {}) + callback() + } catch (err) { + callback(err) } - d._final = async function (callback) { - try { - await writer.ready - writer.close().catch(() => {}) - onfinish = callback - } catch (err) { - callback(err) - } + } + d._final = async function (callback) { + try { + await writer.ready + writer.close().catch(() => {}) + onfinish = callback + } catch (err) { + callback(err) } } - const toRead = isTransformStream(tail) ? tail.readable : tail - eos(toRead, () => { - if (onfinish) { - const cb = onfinish - onfinish = null + } + const toRead = isTransformStream(tail) ? tail.readable : tail + eos(toRead, () => { + if (onfinish) { + const cb = onfinish + onfinish = null + cb() + } + }) + } + if (readable) { + if (isNodeStream(tail)) { + tail.on('readable', function () { + if (onreadable) { + const cb = onreadable + onreadable = null cb() } }) - } - if (readable) { - if (isNodeStream(tail)) { - tail.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() + tail.on('end', function () { + d.push(null) + }) + d._read = function () { + while (true) { + const buf = tail.read() + if (buf === null) { + onreadable = d._read + return } - }) - tail.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = tail.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } + if (!d.push(buf)) { + return } } - } else if (isWebStream(tail)) { - const readable = isTransformStream(tail) ? tail.readable : tail - const reader = readable.getReader() - d._read = async function () { - while (true) { - try { - const { value, done } = await reader.read() - if (!d.push(value)) { - return - } - if (done) { - d.push(null) - return - } - } catch { + } + } else if (isWebStream(tail)) { + const readable = isTransformStream(tail) ? tail.readable : tail + const reader = readable.getReader() + d._read = async function () { + while (true) { + try { + const { value, done } = await reader.read() + if (!d.push(value)) { + return + } + if (done) { + d.push(null) return } + } catch { + return } } } } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - if (isNodeStream(tail)) { - destroyer(tail, err) - } - } - } - return d - } - - - /***/ }), - - /***/ 79638: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - const { - aggregateTwoErrors, - codes: { ERR_MULTIPLE_CALLBACK }, - AbortError - } = __webpack_require__(57186) - const { Symbol } = __webpack_require__(78969) - const { kDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(19654) - const kDestroy = Symbol('kDestroy') - const kConstruct = Symbol('kConstruct') - function checkError(err, w, r) { - if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - } } - - // Backwards compat. cb() is undocumented and unused in core but - // unfortunately might be used by modules. - function destroy(err, cb) { - const r = this._readableState - const w = this._writableState - // With duplex streams we use the writable side for state. - const s = w || r - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - if (typeof cb === 'function') { - cb() + d._destroy = function (err, callback) { + if (!err && onclose !== null) { + err = new AbortError() + } + onreadable = null + ondrain = null + onfinish = null + if (onclose === null) { + callback(err) + } else { + onclose = callback + if (isNodeStream(tail)) { + destroyer(tail, err) } - return this } - - // We set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - checkError(err, w, r) - if (w) { - w.destroyed = true + } + return d +} + + +/***/ }), + +/***/ 79638: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +const { + aggregateTwoErrors, + codes: { ERR_MULTIPLE_CALLBACK }, + AbortError +} = __webpack_require__(57186) +const { Symbol } = __webpack_require__(78969) +const { kDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(19654) +const kDestroy = Symbol('kDestroy') +const kConstruct = Symbol('kConstruct') +function checkError(err, w, r) { + if (err) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + err.stack // eslint-disable-line no-unused-expressions + + if (w && !w.errored) { + w.errored = err } - if (r) { - r.destroyed = true + if (r && !r.errored) { + r.errored = err } - - // If still constructing then defer calling _destroy. - if (!s.constructed) { - this.once(kDestroy, function (er) { - _destroy(this, aggregateTwoErrors(er, err), cb) - }) - } else { - _destroy(this, err, cb) + } +} + +// Backwards compat. cb() is undocumented and unused in core but +// unfortunately might be used by modules. +function destroy(err, cb) { + const r = this._readableState + const w = this._writableState + // With duplex streams we use the writable side for state. + const s = w || r + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { + if (typeof cb === 'function') { + cb() } return this } - function _destroy(self, err, cb) { - let called = false - function onDestroy(err) { - if (called) { - return - } - called = true - const r = self._readableState - const w = self._writableState - checkError(err, w, r) - if (w) { - w.closed = true - } - if (r) { - r.closed = true - } - if (typeof cb === 'function') { - cb(err) - } - if (err) { - process.nextTick(emitErrorCloseNT, self, err) - } else { - process.nextTick(emitCloseNT, self) - } - } - try { - self._destroy(err || null, onDestroy) - } catch (err) { - onDestroy(err) - } + + // We set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + checkError(err, w, r) + if (w) { + w.destroyed = true } - function emitErrorCloseNT(self, err) { - emitErrorNT(self, err) - emitCloseNT(self) + if (r) { + r.destroyed = true } - function emitCloseNT(self) { + + // If still constructing then defer calling _destroy. + if (!s.constructed) { + this.once(kDestroy, function (er) { + _destroy(this, aggregateTwoErrors(er, err), cb) + }) + } else { + _destroy(this, err, cb) + } + return this +} +function _destroy(self, err, cb) { + let called = false + function onDestroy(err) { + if (called) { + return + } + called = true const r = self._readableState const w = self._writableState + checkError(err, w, r) if (w) { - w.closeEmitted = true + w.closed = true } if (r) { - r.closeEmitted = true - } - if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { - self.emit('close') - } - } - function emitErrorNT(self, err) { - const r = self._readableState - const w = self._writableState - if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { - return + r.closed = true } - if (w) { - w.errorEmitted = true + if (typeof cb === 'function') { + cb(err) } - if (r) { - r.errorEmitted = true + if (err) { + process.nextTick(emitErrorCloseNT, self, err) + } else { + process.nextTick(emitCloseNT, self) } - self.emit('error', err) } - function undestroy() { - const r = this._readableState - const w = this._writableState - if (r) { - r.constructed = true - r.closed = false - r.closeEmitted = false - r.destroyed = false - r.errored = null - r.errorEmitted = false - r.reading = false - r.ended = r.readable === false - r.endEmitted = r.readable === false - } - if (w) { - w.constructed = true - w.destroyed = false - w.closed = false - w.closeEmitted = false - w.errored = null - w.errorEmitted = false - w.finalCalled = false - w.prefinished = false - w.ended = w.writable === false - w.ending = w.writable === false - w.finished = w.writable === false - } - } - function errorOrDestroy(stream, err, sync) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - - const r = stream._readableState - const w = stream._writableState - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - return this + try { + self._destroy(err || null, onDestroy) + } catch (err) { + onDestroy(err) + } +} +function emitErrorCloseNT(self, err) { + emitErrorNT(self, err) + emitCloseNT(self) +} +function emitCloseNT(self) { + const r = self._readableState + const w = self._writableState + if (w) { + w.closeEmitted = true + } + if (r) { + r.closeEmitted = true + } + if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { + self.emit('close') + } +} +function emitErrorNT(self, err) { + const r = self._readableState + const w = self._writableState + if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { + return + } + if (w) { + w.errorEmitted = true + } + if (r) { + r.errorEmitted = true + } + self.emit('error', err) +} +function undestroy() { + const r = this._readableState + const w = this._writableState + if (r) { + r.constructed = true + r.closed = false + r.closeEmitted = false + r.destroyed = false + r.errored = null + r.errorEmitted = false + r.reading = false + r.ended = r.readable === false + r.endEmitted = r.readable === false + } + if (w) { + w.constructed = true + w.destroyed = false + w.closed = false + w.closeEmitted = false + w.errored = null + w.errorEmitted = false + w.finalCalled = false + w.prefinished = false + w.ended = w.writable === false + w.ending = w.writable === false + w.finished = w.writable === false + } +} +function errorOrDestroy(stream, err, sync) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + const r = stream._readableState + const w = stream._writableState + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { + return this + } + if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) + stream.destroy(err) + else if (err) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + err.stack // eslint-disable-line no-unused-expressions + + if (w && !w.errored) { + w.errored = err } - if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) - stream.destroy(err) - else if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - if (sync) { - process.nextTick(emitErrorNT, stream, err) - } else { - emitErrorNT(stream, err) - } + if (r && !r.errored) { + r.errored = err } - } - function construct(stream, cb) { - if (typeof stream._construct !== 'function') { + if (sync) { + process.nextTick(emitErrorNT, stream, err) + } else { + emitErrorNT(stream, err) + } + } +} +function construct(stream, cb) { + if (typeof stream._construct !== 'function') { + return + } + const r = stream._readableState + const w = stream._writableState + if (r) { + r.constructed = false + } + if (w) { + w.constructed = false + } + stream.once(kConstruct, cb) + if (stream.listenerCount(kConstruct) > 1) { + // Duplex + return + } + process.nextTick(constructNT, stream) +} +function constructNT(stream) { + let called = false + function onConstruct(err) { + if (called) { + errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) return } + called = true const r = stream._readableState const w = stream._writableState + const s = w || r if (r) { - r.constructed = false + r.constructed = true } if (w) { - w.constructed = false + w.constructed = true } - stream.once(kConstruct, cb) - if (stream.listenerCount(kConstruct) > 1) { - // Duplex - return + if (s.destroyed) { + stream.emit(kDestroy, err) + } else if (err) { + errorOrDestroy(stream, err, true) + } else { + process.nextTick(emitConstructNT, stream) } - process.nextTick(constructNT, stream) } - function constructNT(stream) { - let called = false - function onConstruct(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) - return - } - called = true - const r = stream._readableState - const w = stream._writableState - const s = w || r - if (r) { - r.constructed = true - } - if (w) { - w.constructed = true - } - if (s.destroyed) { - stream.emit(kDestroy, err) - } else if (err) { - errorOrDestroy(stream, err, true) - } else { - process.nextTick(emitConstructNT, stream) - } - } - try { - stream._construct((err) => { - process.nextTick(onConstruct, err) - }) - } catch (err) { + try { + stream._construct((err) => { process.nextTick(onConstruct, err) - } - } - function emitConstructNT(stream) { - stream.emit(kConstruct) - } - function isRequest(stream) { - return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' + }) + } catch (err) { + process.nextTick(onConstruct, err) + } +} +function emitConstructNT(stream) { + stream.emit(kConstruct) +} +function isRequest(stream) { + return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' +} +function emitCloseLegacy(stream) { + stream.emit('close') +} +function emitErrorCloseLegacy(stream, err) { + stream.emit('error', err) + process.nextTick(emitCloseLegacy, stream) +} + +// Normalize destroy for legacy. +function destroyer(stream, err) { + if (!stream || isDestroyed(stream)) { + return } - function emitCloseLegacy(stream) { - stream.emit('close') + if (!err && !isFinished(stream)) { + err = new AbortError() } - function emitErrorCloseLegacy(stream, err) { - stream.emit('error', err) + + // TODO: Remove isRequest branches. + if (isServerRequest(stream)) { + stream.socket = null + stream.destroy(err) + } else if (isRequest(stream)) { + stream.abort() + } else if (isRequest(stream.req)) { + stream.req.abort() + } else if (typeof stream.destroy === 'function') { + stream.destroy(err) + } else if (typeof stream.close === 'function') { + // TODO: Don't lose err? + stream.close() + } else if (err) { + process.nextTick(emitErrorCloseLegacy, stream, err) + } else { process.nextTick(emitCloseLegacy, stream) } - - // Normalize destroy for legacy. - function destroyer(stream, err) { - if (!stream || isDestroyed(stream)) { - return - } - if (!err && !isFinished(stream)) { - err = new AbortError() - } - - // TODO: Remove isRequest branches. - if (isServerRequest(stream)) { - stream.socket = null - stream.destroy(err) - } else if (isRequest(stream)) { - stream.abort() - } else if (isRequest(stream.req)) { - stream.req.abort() - } else if (typeof stream.destroy === 'function') { - stream.destroy(err) - } else if (typeof stream.close === 'function') { - // TODO: Don't lose err? - stream.close() - } else if (err) { - process.nextTick(emitErrorCloseLegacy, stream, err) - } else { - process.nextTick(emitCloseLegacy, stream) - } - if (!stream.destroyed) { - stream[kDestroyed] = true - } - } - module.exports = { - construct, - destroyer, - destroy, - undestroy, - errorOrDestroy - } - - - /***/ }), - - /***/ 56725: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a duplex stream is just a stream that is both readable and writable. - // Since JS doesn't have multiple prototype inheritance, this class - // prototypically inherits from Readable, and then parasitically from - // Writable. - - - - const { - ObjectDefineProperties, - ObjectGetOwnPropertyDescriptor, - ObjectKeys, - ObjectSetPrototypeOf - } = __webpack_require__(78969) - module.exports = Duplex - const Readable = __webpack_require__(69293) - const Writable = __webpack_require__(7282) - ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) - ObjectSetPrototypeOf(Duplex, Readable) - { - const keys = ObjectKeys(Writable.prototype) - // Allow the keys array to be GC'ed. - for (let i = 0; i < keys.length; i++) { - const method = keys[i] - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] - } - } - function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options) - Readable.call(this, options) - Writable.call(this, options) - if (options) { - this.allowHalfOpen = options.allowHalfOpen !== false - if (options.readable === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if (options.writable === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } else { - this.allowHalfOpen = true + if (!stream.destroyed) { + stream[kDestroyed] = true + } +} +module.exports = { + construct, + destroyer, + destroy, + undestroy, + errorOrDestroy +} + + +/***/ }), + +/***/ 56725: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototype inheritance, this class +// prototypically inherits from Readable, and then parasitically from +// Writable. + + + +const { + ObjectDefineProperties, + ObjectGetOwnPropertyDescriptor, + ObjectKeys, + ObjectSetPrototypeOf +} = __webpack_require__(78969) +module.exports = Duplex +const Readable = __webpack_require__(69293) +const Writable = __webpack_require__(7282) +ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) +ObjectSetPrototypeOf(Duplex, Readable) +{ + const keys = ObjectKeys(Writable.prototype) + // Allow the keys array to be GC'ed. + for (let i = 0; i < keys.length; i++) { + const method = keys[i] + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options) + Readable.call(this, options) + Writable.call(this, options) + if (options) { + this.allowHalfOpen = options.allowHalfOpen !== false + if (options.readable === false) { + this._readableState.readable = false + this._readableState.ended = true + this._readableState.endEmitted = true + } + if (options.writable === false) { + this._writableState.writable = false + this._writableState.ending = true + this._writableState.ended = true + this._writableState.finished = true } + } else { + this.allowHalfOpen = true } - ObjectDefineProperties(Duplex.prototype, { - writable: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') - }, - writableHighWaterMark: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') - }, - writableObjectMode: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') - }, - writableBuffer: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') - }, - writableLength: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') - }, - writableFinished: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') - }, - writableCorked: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') - }, - writableEnded: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') - }, - writableNeedDrain: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') +} +ObjectDefineProperties(Duplex.prototype, { + writable: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') + }, + writableHighWaterMark: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') + }, + writableObjectMode: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') + }, + writableBuffer: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') + }, + writableLength: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') + }, + writableFinished: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') + }, + writableCorked: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') + }, + writableEnded: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') + }, + writableNeedDrain: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') + }, + destroyed: { + __proto__: null, + get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false + } + return this._readableState.destroyed && this._writableState.destroyed }, - destroyed: { - __proto__: null, - get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false - } - return this._readableState.destroyed && this._writableState.destroyed - }, - set(value) { - // Backward compatibility, the user is explicitly - // managing destroyed. - if (this._readableState && this._writableState) { - this._readableState.destroyed = value - this._writableState.destroyed = value - } + set(value) { + // Backward compatibility, the user is explicitly + // managing destroyed. + if (this._readableState && this._writableState) { + this._readableState.destroyed = value + this._writableState.destroyed = value } } - }) - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters - } - Duplex.fromWeb = function (pair, options) { - return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) - } - Duplex.toWeb = function (duplex) { - return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) - } - let duplexify - Duplex.from = function (body) { - if (!duplexify) { - duplexify = __webpack_require__(77690) - } - return duplexify(body, 'body') - } - - - /***/ }), - - /***/ 77690: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - ;('use strict') - const bufferModule = __webpack_require__(2486) - const { - isReadable, - isWritable, - isIterable, - isNodeStream, - isReadableNodeStream, - isWritableNodeStream, - isDuplexNodeStream - } = __webpack_require__(19654) - const eos = __webpack_require__(28425) - const { - AbortError, - codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } - } = __webpack_require__(57186) - const { destroyer } = __webpack_require__(79638) - const Duplex = __webpack_require__(56725) - const Readable = __webpack_require__(69293) - const { createDeferredPromise } = __webpack_require__(64083) - const from = __webpack_require__(50841) - const Blob = globalThis.Blob || bufferModule.Blob - const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - return b instanceof Blob - } - : function isBlob(b) { - return false - } - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - const { FunctionPrototypeCall } = __webpack_require__(78969) - - // This is needed for pre node 17. - class Duplexify extends Duplex { - constructor(options) { - super(options) - - // https://github.com/nodejs/node/pull/34385 - - if ((options === null || options === undefined ? undefined : options.readable) === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if ((options === null || options === undefined ? undefined : options.writable) === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } - } - module.exports = function duplexify(body, name) { - if (isDuplexNodeStream(body)) { - return body - } - if (isReadableNodeStream(body)) { - return _duplexify({ - readable: body - }) - } - if (isWritableNodeStream(body)) { - return _duplexify({ - writable: body - }) - } - if (isNodeStream(body)) { - return _duplexify({ - writable: false, - readable: false - }) - } - - // TODO: Webstreams - // if (isReadableStream(body)) { - // return _duplexify({ readable: Readable.fromWeb(body) }); - // } - - // TODO: Webstreams - // if (isWritableStream(body)) { - // return _duplexify({ writable: Writable.fromWeb(body) }); - // } - - if (typeof body === 'function') { - const { value, write, final, destroy } = fromAsyncGen(body) - if (isIterable(value)) { - return from(Duplexify, value, { - // TODO (ronag): highWaterMark? - objectMode: true, - write, - final, - destroy - }) - } - const then = value === null || value === undefined ? undefined : value.then - if (typeof then === 'function') { - let d - const promise = FunctionPrototypeCall( - then, - value, - (val) => { - if (val != null) { - throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) - } - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - // TODO (ronag): highWaterMark? - objectMode: true, - readable: false, - write, - final(cb) { - final(async () => { - try { - await promise - process.nextTick(cb, null) - } catch (err) { - process.nextTick(cb, err) - } - }) - }, - destroy - })) + } +}) +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Duplex.fromWeb = function (pair, options) { + return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) +} +Duplex.toWeb = function (duplex) { + return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) +} +let duplexify +Duplex.from = function (body) { + if (!duplexify) { + duplexify = __webpack_require__(77690) + } + return duplexify(body, 'body') +} + + +/***/ }), + +/***/ 77690: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +;('use strict') +const bufferModule = __webpack_require__(2486) +const { + isReadable, + isWritable, + isIterable, + isNodeStream, + isReadableNodeStream, + isWritableNodeStream, + isDuplexNodeStream +} = __webpack_require__(19654) +const eos = __webpack_require__(28425) +const { + AbortError, + codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } +} = __webpack_require__(57186) +const { destroyer } = __webpack_require__(79638) +const Duplex = __webpack_require__(56725) +const Readable = __webpack_require__(69293) +const { createDeferredPromise } = __webpack_require__(64083) +const from = __webpack_require__(50841) +const Blob = globalThis.Blob || bufferModule.Blob +const isBlob = + typeof Blob !== 'undefined' + ? function isBlob(b) { + return b instanceof Blob + } + : function isBlob(b) { + return false } - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) - } - if (isBlob(body)) { - return duplexify(body.arrayBuffer()) - } - if (isIterable(body)) { - return from(Duplexify, body, { +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +const { FunctionPrototypeCall } = __webpack_require__(78969) + +// This is needed for pre node 17. +class Duplexify extends Duplex { + constructor(options) { + super(options) + + // https://github.com/nodejs/node/pull/34385 + + if ((options === null || options === undefined ? undefined : options.readable) === false) { + this._readableState.readable = false + this._readableState.ended = true + this._readableState.endEmitted = true + } + if ((options === null || options === undefined ? undefined : options.writable) === false) { + this._writableState.writable = false + this._writableState.ending = true + this._writableState.ended = true + this._writableState.finished = true + } + } +} +module.exports = function duplexify(body, name) { + if (isDuplexNodeStream(body)) { + return body + } + if (isReadableNodeStream(body)) { + return _duplexify({ + readable: body + }) + } + if (isWritableNodeStream(body)) { + return _duplexify({ + writable: body + }) + } + if (isNodeStream(body)) { + return _duplexify({ + writable: false, + readable: false + }) + } + + // TODO: Webstreams + // if (isReadableStream(body)) { + // return _duplexify({ readable: Readable.fromWeb(body) }); + // } + + // TODO: Webstreams + // if (isWritableStream(body)) { + // return _duplexify({ writable: Writable.fromWeb(body) }); + // } + + if (typeof body === 'function') { + const { value, write, final, destroy } = fromAsyncGen(body) + if (isIterable(value)) { + return from(Duplexify, value, { // TODO (ronag): highWaterMark? objectMode: true, - writable: false - }) - } - - // TODO: Webstreams. - // if ( - // isReadableStream(body?.readable) && - // isWritableStream(body?.writable) - // ) { - // return Duplexify.fromWeb(body); - // } - - if ( - typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || - typeof (body === null || body === undefined ? undefined : body.readable) === 'object' - ) { - const readable = - body !== null && body !== undefined && body.readable - ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) - ? body === null || body === undefined - ? undefined - : body.readable - : duplexify(body.readable) - : undefined - const writable = - body !== null && body !== undefined && body.writable - ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) - ? body === null || body === undefined - ? undefined - : body.writable - : duplexify(body.writable) - : undefined - return _duplexify({ - readable, - writable + write, + final, + destroy }) } - const then = body === null || body === undefined ? undefined : body.then + const then = value === null || value === undefined ? undefined : value.then if (typeof then === 'function') { let d - FunctionPrototypeCall( + const promise = FunctionPrototypeCall( then, - body, + value, (val) => { if (val != null) { - d.push(val) + throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) } - d.push(null) }, (err) => { destroyer(d, err) } ) return (d = new Duplexify({ + // TODO (ronag): highWaterMark? objectMode: true, - writable: false, - read() {} + readable: false, + write, + final(cb) { + final(async () => { + try { + await promise + process.nextTick(cb, null) + } catch (err) { + process.nextTick(cb, err) + } + }) + }, + destroy })) } - throw new ERR_INVALID_ARG_TYPE( - name, - [ - 'Blob', - 'ReadableStream', - 'WritableStream', - 'Stream', - 'Iterable', - 'AsyncIterable', - 'Function', - '{ readable, writable } pair', - 'Promise' - ], - body - ) + throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) } - function fromAsyncGen(fn) { - let { promise, resolve } = createDeferredPromise() - const ac = new AbortController() - const signal = ac.signal - const value = fn( - (async function* () { - while (true) { - const _promise = promise - promise = null - const { chunk, done, cb } = await _promise - process.nextTick(cb) - if (done) return - if (signal.aborted) - throw new AbortError(undefined, { - cause: signal.reason - }) - ;({ promise, resolve } = createDeferredPromise()) - yield chunk - } - })(), - { - signal - } - ) - return { - value, - write(chunk, encoding, cb) { - const _resolve = resolve - resolve = null - _resolve({ - chunk, - done: false, - cb - }) - }, - final(cb) { - const _resolve = resolve - resolve = null - _resolve({ - done: true, - cb - }) - }, - destroy(err, cb) { - ac.abort() - cb(err) - } - } + if (isBlob(body)) { + return duplexify(body.arrayBuffer()) } - function _duplexify(pair) { - const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable - const w = pair.writable - let readable = !!isReadable(r) - let writable = !!isWritable(w) - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } - } - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplexify({ + if (isIterable(body)) { + return from(Duplexify, body, { // TODO (ronag): highWaterMark? - readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), - writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), + objectMode: true, + writable: false + }) + } + + // TODO: Webstreams. + // if ( + // isReadableStream(body?.readable) && + // isWritableStream(body?.writable) + // ) { + // return Duplexify.fromWeb(body); + // } + + if ( + typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || + typeof (body === null || body === undefined ? undefined : body.readable) === 'object' + ) { + const readable = + body !== null && body !== undefined && body.readable + ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) + ? body === null || body === undefined + ? undefined + : body.readable + : duplexify(body.readable) + : undefined + const writable = + body !== null && body !== undefined && body.writable + ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) + ? body === null || body === undefined + ? undefined + : body.writable + : duplexify(body.writable) + : undefined + return _duplexify({ readable, writable }) - if (writable) { - eos(w, (err) => { - writable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - d._write = function (chunk, encoding, callback) { - if (w.write(chunk, encoding)) { - callback() - } else { - ondrain = callback + } + const then = body === null || body === undefined ? undefined : body.then + if (typeof then === 'function') { + let d + FunctionPrototypeCall( + then, + body, + (val) => { + if (val != null) { + d.push(val) } + d.push(null) + }, + (err) => { + destroyer(d, err) } - d._final = function (callback) { - w.end() - onfinish = callback + ) + return (d = new Duplexify({ + objectMode: true, + writable: false, + read() {} + })) + } + throw new ERR_INVALID_ARG_TYPE( + name, + [ + 'Blob', + 'ReadableStream', + 'WritableStream', + 'Stream', + 'Iterable', + 'AsyncIterable', + 'Function', + '{ readable, writable } pair', + 'Promise' + ], + body + ) +} +function fromAsyncGen(fn) { + let { promise, resolve } = createDeferredPromise() + const ac = new AbortController() + const signal = ac.signal + const value = fn( + (async function* () { + while (true) { + const _promise = promise + promise = null + const { chunk, done, cb } = await _promise + process.nextTick(cb) + if (done) return + if (signal.aborted) + throw new AbortError(undefined, { + cause: signal.reason + }) + ;({ promise, resolve } = createDeferredPromise()) + yield chunk } - w.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - w.on('finish', function () { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() - } - }) + })(), + { + signal } - if (readable) { - eos(r, (err) => { - readable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - r.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } + ) + return { + value, + write(chunk, encoding, cb) { + const _resolve = resolve + resolve = null + _resolve({ + chunk, + done: false, + cb }) - r.on('end', function () { - d.push(null) + }, + final(cb) { + const _resolve = resolve + resolve = null + _resolve({ + done: true, + cb }) - d._read = function () { - while (true) { - const buf = r.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } - } - } + }, + destroy(err, cb) { + ac.abort() + cb(err) + } + } +} +function _duplexify(pair) { + const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable + const w = pair.writable + let readable = !!isReadable(r) + let writable = !!isWritable(w) + let ondrain + let onfinish + let onreadable + let onclose + let d + function onfinished(err) { + const cb = onclose + onclose = null + if (cb) { + cb(err) + } else if (err) { + d.destroy(err) } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() + } + + // TODO(ronag): Avoid double buffering. + // Implement Writable/Readable/Duplex traits. + // See, https://github.com/nodejs/node/pull/33515. + d = new Duplexify({ + // TODO (ronag): highWaterMark? + readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), + writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), + readable, + writable + }) + if (writable) { + eos(w, (err) => { + writable = false + if (err) { + destroyer(r, err) } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) + onfinished(err) + }) + d._write = function (chunk, encoding, callback) { + if (w.write(chunk, encoding)) { + callback() } else { - onclose = callback - destroyer(w, err) - destroyer(r, err) + ondrain = callback } } - return d - } - - - /***/ }), - - /***/ 28425: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // Ported from https://github.com/mafintosh/end-of-stream with - // permission from the author, Mathias Buus (@mafintosh). - - ;('use strict') - const { AbortError, codes } = __webpack_require__(57186) - const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes - const { kEmptyObject, once } = __webpack_require__(64083) - const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(59021) - const { Promise, PromisePrototypeThen } = __webpack_require__(78969) - const { - isClosed, - isReadable, - isReadableNodeStream, - isReadableStream, - isReadableFinished, - isReadableErrored, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableFinished, - isWritableErrored, - isNodeStream, - willEmitClose: _willEmitClose, - kIsClosedPromise - } = __webpack_require__(19654) - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function' - } - const nop = () => {} - function eos(stream, options, callback) { - var _options$readable, _options$writable - if (arguments.length === 2) { - callback = options - options = kEmptyObject - } else if (options == null) { - options = kEmptyObject - } else { - validateObject(options, 'options') - } - validateFunction(callback, 'callback') - validateAbortSignal(options.signal, 'options.signal') - callback = once(callback) - if (isReadableStream(stream) || isWritableStream(stream)) { - return eosWeb(stream, options, callback) - } - if (!isNodeStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + d._final = function (callback) { + w.end() + onfinish = callback } - const readable = - (_options$readable = options.readable) !== null && _options$readable !== undefined - ? _options$readable - : isReadableNodeStream(stream) - const writable = - (_options$writable = options.writable) !== null && _options$writable !== undefined - ? _options$writable - : isWritableNodeStream(stream) - const wState = stream._writableState - const rState = stream._readableState - const onlegacyfinish = () => { - if (!stream.writable) { - onfinish() - } - } - - // TODO (ronag): Improve soft detection to include core modules and - // common ecosystem modules that do properly emit 'close' but fail - // this generic check. - let willEmitClose = - _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable - let writableFinished = isWritableFinished(stream, false) - const onfinish = () => { - writableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.readable || readable)) { - return + w.on('drain', function () { + if (ondrain) { + const cb = ondrain + ondrain = null + cb() } - if (!readable || readableFinished) { - callback.call(stream) + }) + w.on('finish', function () { + if (onfinish) { + const cb = onfinish + onfinish = null + cb() } - } - let readableFinished = isReadableFinished(stream, false) - const onend = () => { - readableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false + }) + } + if (readable) { + eos(r, (err) => { + readable = false + if (err) { + destroyer(r, err) } - if (willEmitClose && (!stream.writable || writable)) { - return + onfinished(err) + }) + r.on('readable', function () { + if (onreadable) { + const cb = onreadable + onreadable = null + cb() } - if (!writable || writableFinished) { - callback.call(stream) + }) + r.on('end', function () { + d.push(null) + }) + d._read = function () { + while (true) { + const buf = r.read() + if (buf === null) { + onreadable = d._read + return + } + if (!d.push(buf)) { + return + } } } - const onerror = (err) => { - callback.call(stream, err) + } + d._destroy = function (err, callback) { + if (!err && onclose !== null) { + err = new AbortError() } - let closed = isClosed(stream) - const onclose = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - if (readable && !readableFinished && isReadableNodeStream(stream, true)) { - if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - if (writable && !writableFinished) { - if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - callback.call(stream) + onreadable = null + ondrain = null + onfinish = null + if (onclose === null) { + callback(err) + } else { + onclose = callback + destroyer(w, err) + destroyer(r, err) } - const onclosed = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } + } + return d +} + + +/***/ }), + +/***/ 28425: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + +;('use strict') +const { AbortError, codes } = __webpack_require__(57186) +const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes +const { kEmptyObject, once } = __webpack_require__(64083) +const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(59021) +const { Promise, PromisePrototypeThen } = __webpack_require__(78969) +const { + isClosed, + isReadable, + isReadableNodeStream, + isReadableStream, + isReadableFinished, + isReadableErrored, + isWritable, + isWritableNodeStream, + isWritableStream, + isWritableFinished, + isWritableErrored, + isNodeStream, + willEmitClose: _willEmitClose, + kIsClosedPromise +} = __webpack_require__(19654) +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function' +} +const nop = () => {} +function eos(stream, options, callback) { + var _options$readable, _options$writable + if (arguments.length === 2) { + callback = options + options = kEmptyObject + } else if (options == null) { + options = kEmptyObject + } else { + validateObject(options, 'options') + } + validateFunction(callback, 'callback') + validateAbortSignal(options.signal, 'options.signal') + callback = once(callback) + if (isReadableStream(stream) || isWritableStream(stream)) { + return eosWeb(stream, options, callback) + } + if (!isNodeStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } + const readable = + (_options$readable = options.readable) !== null && _options$readable !== undefined + ? _options$readable + : isReadableNodeStream(stream) + const writable = + (_options$writable = options.writable) !== null && _options$writable !== undefined + ? _options$writable + : isWritableNodeStream(stream) + const wState = stream._writableState + const rState = stream._readableState + const onlegacyfinish = () => { + if (!stream.writable) { + onfinish() + } + } + + // TODO (ronag): Improve soft detection to include core modules and + // common ecosystem modules that do properly emit 'close' but fail + // this generic check. + let willEmitClose = + _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable + let writableFinished = isWritableFinished(stream, false) + const onfinish = () => { + writableFinished = true + // Stream should not be destroyed here. If it is that + // means that user space is doing something differently and + // we cannot trust willEmitClose. + if (stream.destroyed) { + willEmitClose = false + } + if (willEmitClose && (!stream.readable || readable)) { + return + } + if (!readable || readableFinished) { callback.call(stream) } - const onrequest = () => { - stream.req.on('finish', onfinish) + } + let readableFinished = isReadableFinished(stream, false) + const onend = () => { + readableFinished = true + // Stream should not be destroyed here. If it is that + // means that user space is doing something differently and + // we cannot trust willEmitClose. + if (stream.destroyed) { + willEmitClose = false } - if (isRequest(stream)) { - stream.on('complete', onfinish) - if (!willEmitClose) { - stream.on('abort', onclose) - } - if (stream.req) { - onrequest() - } else { - stream.on('request', onrequest) - } - } else if (writable && !wState) { - // legacy streams - stream.on('end', onlegacyfinish) - stream.on('close', onlegacyfinish) - } - - // Not all streams will emit 'close' after 'aborted'. - if (!willEmitClose && typeof stream.aborted === 'boolean') { - stream.on('aborted', onclose) - } - stream.on('end', onend) - stream.on('finish', onfinish) - if (options.error !== false) { - stream.on('error', onerror) - } - stream.on('close', onclose) - if (closed) { - process.nextTick(onclose) - } else if ( - (wState !== null && wState !== undefined && wState.errorEmitted) || - (rState !== null && rState !== undefined && rState.errorEmitted) - ) { - if (!willEmitClose) { - process.nextTick(onclosed) - } - } else if ( - !readable && - (!willEmitClose || isReadable(stream)) && - (writableFinished || isWritable(stream) === false) - ) { - process.nextTick(onclosed) - } else if ( - !writable && - (!willEmitClose || isWritable(stream)) && - (readableFinished || isReadable(stream) === false) - ) { - process.nextTick(onclosed) - } else if (rState && stream.req && stream.aborted) { - process.nextTick(onclosed) + if (willEmitClose && (!stream.writable || writable)) { + return } - const cleanup = () => { - callback = nop - stream.removeListener('aborted', onclose) - stream.removeListener('complete', onfinish) - stream.removeListener('abort', onclose) - stream.removeListener('request', onrequest) - if (stream.req) stream.req.removeListener('finish', onfinish) - stream.removeListener('end', onlegacyfinish) - stream.removeListener('close', onlegacyfinish) - stream.removeListener('finish', onfinish) - stream.removeListener('end', onend) - stream.removeListener('error', onerror) - stream.removeListener('close', onclose) - } - if (options.signal && !closed) { - const abort = () => { - // Keep it because cleanup removes it. - const endCallback = callback - cleanup() - endCallback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - const originalCallback = callback - callback = once((...args) => { - options.signal.removeEventListener('abort', abort) - originalCallback.apply(stream, args) - }) - options.signal.addEventListener('abort', abort) - } + if (!writable || writableFinished) { + callback.call(stream) } - return cleanup } - function eosWeb(stream, options, callback) { - let isAborted = false - let abort = nop - if (options.signal) { - abort = () => { - isAborted = true - callback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - const originalCallback = callback - callback = once((...args) => { - options.signal.removeEventListener('abort', abort) - originalCallback.apply(stream, args) - }) - options.signal.addEventListener('abort', abort) - } + const onerror = (err) => { + callback.call(stream, err) + } + let closed = isClosed(stream) + const onclose = () => { + closed = true + const errored = isWritableErrored(stream) || isReadableErrored(stream) + if (errored && typeof errored !== 'boolean') { + return callback.call(stream, errored) } - const resolverFn = (...args) => { - if (!isAborted) { - process.nextTick(() => callback.apply(stream, args)) - } + if (readable && !readableFinished && isReadableNodeStream(stream, true)) { + if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) } - PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) - return nop - } - function finished(stream, opts) { - var _opts - let autoCleanup = false - if (opts === null) { - opts = kEmptyObject + if (writable && !writableFinished) { + if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) } - if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { - validateBoolean(opts.cleanup, 'cleanup') - autoCleanup = opts.cleanup + callback.call(stream) + } + const onclosed = () => { + closed = true + const errored = isWritableErrored(stream) || isReadableErrored(stream) + if (errored && typeof errored !== 'boolean') { + return callback.call(stream, errored) } - return new Promise((resolve, reject) => { - const cleanup = eos(stream, opts, (err) => { - if (autoCleanup) { - cleanup() - } - if (err) { - reject(err) - } else { - resolve() - } - }) - }) + callback.call(stream) } - module.exports = eos - module.exports.finished = finished - - - /***/ }), - - /***/ 50841: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(78969) - const { Buffer } = __webpack_require__(2486) - const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(57186).codes) - function from(Readable, iterable, opts) { - let iterator - if (typeof iterable === 'string' || iterable instanceof Buffer) { - return new Readable({ - objectMode: true, - ...opts, - read() { - this.push(iterable) - this.push(null) - } - }) + const onrequest = () => { + stream.req.on('finish', onfinish) + } + if (isRequest(stream)) { + stream.on('complete', onfinish) + if (!willEmitClose) { + stream.on('abort', onclose) } - let isAsync - if (iterable && iterable[SymbolAsyncIterator]) { - isAsync = true - iterator = iterable[SymbolAsyncIterator]() - } else if (iterable && iterable[SymbolIterator]) { - isAsync = false - iterator = iterable[SymbolIterator]() + if (stream.req) { + onrequest() } else { - throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) + stream.on('request', onrequest) } - const readable = new Readable({ - objectMode: true, - highWaterMark: 1, - // TODO(ronag): What options should be allowed? - ...opts - }) - - // Flag to protect against _read - // being called before last iteration completion. - let reading = false - readable._read = function () { - if (!reading) { - reading = true - next() - } - } - readable._destroy = function (error, cb) { - PromisePrototypeThen( - close(error), - () => process.nextTick(cb, error), - // nextTick is here in case cb throws - (e) => process.nextTick(cb, e || error) + } else if (writable && !wState) { + // legacy streams + stream.on('end', onlegacyfinish) + stream.on('close', onlegacyfinish) + } + + // Not all streams will emit 'close' after 'aborted'. + if (!willEmitClose && typeof stream.aborted === 'boolean') { + stream.on('aborted', onclose) + } + stream.on('end', onend) + stream.on('finish', onfinish) + if (options.error !== false) { + stream.on('error', onerror) + } + stream.on('close', onclose) + if (closed) { + process.nextTick(onclose) + } else if ( + (wState !== null && wState !== undefined && wState.errorEmitted) || + (rState !== null && rState !== undefined && rState.errorEmitted) + ) { + if (!willEmitClose) { + process.nextTick(onclosed) + } + } else if ( + !readable && + (!willEmitClose || isReadable(stream)) && + (writableFinished || isWritable(stream) === false) + ) { + process.nextTick(onclosed) + } else if ( + !writable && + (!willEmitClose || isWritable(stream)) && + (readableFinished || isReadable(stream) === false) + ) { + process.nextTick(onclosed) + } else if (rState && stream.req && stream.aborted) { + process.nextTick(onclosed) + } + const cleanup = () => { + callback = nop + stream.removeListener('aborted', onclose) + stream.removeListener('complete', onfinish) + stream.removeListener('abort', onclose) + stream.removeListener('request', onrequest) + if (stream.req) stream.req.removeListener('finish', onfinish) + stream.removeListener('end', onlegacyfinish) + stream.removeListener('close', onlegacyfinish) + stream.removeListener('finish', onfinish) + stream.removeListener('end', onend) + stream.removeListener('error', onerror) + stream.removeListener('close', onclose) + } + if (options.signal && !closed) { + const abort = () => { + // Keep it because cleanup removes it. + const endCallback = callback + cleanup() + endCallback.call( + stream, + new AbortError(undefined, { + cause: options.signal.reason + }) ) } - async function close(error) { - const hadError = error !== undefined && error !== null - const hasThrow = typeof iterator.throw === 'function' - if (hadError && hasThrow) { - const { value, done } = await iterator.throw(error) - await value - if (done) { - return - } - } - if (typeof iterator.return === 'function') { - const { value } = await iterator.return() - await value - } + if (options.signal.aborted) { + process.nextTick(abort) + } else { + const originalCallback = callback + callback = once((...args) => { + options.signal.removeEventListener('abort', abort) + originalCallback.apply(stream, args) + }) + options.signal.addEventListener('abort', abort) + } + } + return cleanup +} +function eosWeb(stream, options, callback) { + let isAborted = false + let abort = nop + if (options.signal) { + abort = () => { + isAborted = true + callback.call( + stream, + new AbortError(undefined, { + cause: options.signal.reason + }) + ) } - async function next() { - for (;;) { - try { - const { value, done } = isAsync ? await iterator.next() : iterator.next() - if (done) { - readable.push(null) - } else { - const res = value && typeof value.then === 'function' ? await value : value - if (res === null) { - reading = false - throw new ERR_STREAM_NULL_VALUES() - } else if (readable.push(res)) { - continue - } else { - reading = false - } - } - } catch (err) { - readable.destroy(err) - } - break - } + if (options.signal.aborted) { + process.nextTick(abort) + } else { + const originalCallback = callback + callback = once((...args) => { + options.signal.removeEventListener('abort', abort) + originalCallback.apply(stream, args) + }) + options.signal.addEventListener('abort', abort) } - return readable - } - module.exports = from - - - /***/ }), - - /***/ 94965: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(78969) - const { EventEmitter: EE } = __webpack_require__(5939) - function Stream(opts) { - EE.call(this, opts) - } - ObjectSetPrototypeOf(Stream.prototype, EE.prototype) - ObjectSetPrototypeOf(Stream, EE) - Stream.prototype.pipe = function (dest, options) { - const source = this - function ondata(chunk) { - if (dest.writable && dest.write(chunk) === false && source.pause) { - source.pause() - } - } - source.on('data', ondata) - function ondrain() { - if (source.readable && source.resume) { - source.resume() - } - } - dest.on('drain', ondrain) - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend) - source.on('close', onclose) - } - let didOnEnd = false - function onend() { - if (didOnEnd) return - didOnEnd = true - dest.end() - } - function onclose() { - if (didOnEnd) return - didOnEnd = true - if (typeof dest.destroy === 'function') dest.destroy() - } - - // Don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup() - if (EE.listenerCount(this, 'error') === 0) { - this.emit('error', er) - } + } + const resolverFn = (...args) => { + if (!isAborted) { + process.nextTick(() => callback.apply(stream, args)) } - prependListener(source, 'error', onerror) - prependListener(dest, 'error', onerror) - - // Remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata) - dest.removeListener('drain', ondrain) - source.removeListener('end', onend) - source.removeListener('close', onclose) - source.removeListener('error', onerror) - dest.removeListener('error', onerror) - source.removeListener('end', cleanup) - source.removeListener('close', cleanup) - dest.removeListener('close', cleanup) - } - source.on('end', cleanup) - source.on('close', cleanup) - dest.on('close', cleanup) - dest.emit('pipe', source) - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest - } - function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) - else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) - else emitter._events[event] = [fn, emitter._events[event]] - } - module.exports = { - Stream, - prependListener - } - - - /***/ }), - - /***/ 69057: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - const { - codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, - AbortError - } = __webpack_require__(57186) - const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(59021) - const kWeakHandler = (__webpack_require__(78969).Symbol)('kWeak') - const { finished } = __webpack_require__(28425) - const staticCompose = __webpack_require__(80150) - const { addAbortSignalNoValidate } = __webpack_require__(7445) - const { isWritable, isNodeStream } = __webpack_require__(19654) - const { - ArrayPrototypePush, - MathFloor, - Number, - NumberIsNaN, - Promise, - PromiseReject, - PromisePrototypeThen, - Symbol - } = __webpack_require__(78969) - const kEmpty = Symbol('kEmpty') - const kEof = Symbol('kEof') - function compose(stream, options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - if (isNodeStream(stream) && !isWritable(stream)) { - throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') - } - const composedStream = staticCompose(this, stream) - if (options !== null && options !== undefined && options.signal) { - // Not validating as we already validated before - addAbortSignalNoValidate(options.signal, composedStream) - } - return composedStream - } - function map(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let concurrency = 1 - if ((options === null || options === undefined ? undefined : options.concurrency) != null) { - concurrency = MathFloor(options.concurrency) - } - validateInteger(concurrency, 'concurrency', 1) - return async function* map() { - var _options$signal, _options$signal2 - const ac = new AbortController() - const stream = this - const queue = [] - const signal = ac.signal - const signalOpt = { - signal + } + PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) + return nop +} +function finished(stream, opts) { + var _opts + let autoCleanup = false + if (opts === null) { + opts = kEmptyObject + } + if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { + validateBoolean(opts.cleanup, 'cleanup') + autoCleanup = opts.cleanup + } + return new Promise((resolve, reject) => { + const cleanup = eos(stream, opts, (err) => { + if (autoCleanup) { + cleanup() } - const abort = () => ac.abort() - if ( - options !== null && - options !== undefined && - (_options$signal = options.signal) !== null && - _options$signal !== undefined && - _options$signal.aborted - ) { - abort() + if (err) { + reject(err) + } else { + resolve() } - options === null || options === undefined - ? undefined - : (_options$signal2 = options.signal) === null || _options$signal2 === undefined - ? undefined - : _options$signal2.addEventListener('abort', abort) - let next - let resume - let done = false - function onDone() { - done = true + }) + }) +} +module.exports = eos +module.exports.finished = finished + + +/***/ }), + +/***/ 50841: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(78969) +const { Buffer } = __webpack_require__(2486) +const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(57186).codes) +function from(Readable, iterable, opts) { + let iterator + if (typeof iterable === 'string' || iterable instanceof Buffer) { + return new Readable({ + objectMode: true, + ...opts, + read() { + this.push(iterable) + this.push(null) } - async function pump() { - try { - for await (let val of stream) { - var _val - if (done) { - return - } - if (signal.aborted) { - throw new AbortError() - } - try { - val = fn(val, signalOpt) - } catch (err) { - val = PromiseReject(err) - } - if (val === kEmpty) { - continue - } - if (typeof ((_val = val) === null || _val === undefined ? undefined : _val.catch) === 'function') { - val.catch(onDone) - } - queue.push(val) - if (next) { - next() - next = null - } - if (!done && queue.length && queue.length >= concurrency) { - await new Promise((resolve) => { - resume = resolve - }) - } - } - queue.push(kEof) - } catch (err) { - const val = PromiseReject(err) - PromisePrototypeThen(val, undefined, onDone) - queue.push(val) - } finally { - var _options$signal3 - done = true - if (next) { - next() - next = null - } - options === null || options === undefined - ? undefined - : (_options$signal3 = options.signal) === null || _options$signal3 === undefined - ? undefined - : _options$signal3.removeEventListener('abort', abort) - } + }) + } + let isAsync + if (iterable && iterable[SymbolAsyncIterator]) { + isAsync = true + iterator = iterable[SymbolAsyncIterator]() + } else if (iterable && iterable[SymbolIterator]) { + isAsync = false + iterator = iterable[SymbolIterator]() + } else { + throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) + } + const readable = new Readable({ + objectMode: true, + highWaterMark: 1, + // TODO(ronag): What options should be allowed? + ...opts + }) + + // Flag to protect against _read + // being called before last iteration completion. + let reading = false + readable._read = function () { + if (!reading) { + reading = true + next() + } + } + readable._destroy = function (error, cb) { + PromisePrototypeThen( + close(error), + () => process.nextTick(cb, error), + // nextTick is here in case cb throws + (e) => process.nextTick(cb, e || error) + ) + } + async function close(error) { + const hadError = error !== undefined && error !== null + const hasThrow = typeof iterator.throw === 'function' + if (hadError && hasThrow) { + const { value, done } = await iterator.throw(error) + await value + if (done) { + return } - pump() + } + if (typeof iterator.return === 'function') { + const { value } = await iterator.return() + await value + } + } + async function next() { + for (;;) { try { - while (true) { - while (queue.length > 0) { - const val = await queue[0] - if (val === kEof) { - return - } - if (signal.aborted) { - throw new AbortError() - } - if (val !== kEmpty) { - yield val - } - queue.shift() - if (resume) { - resume() - resume = null - } + const { value, done } = isAsync ? await iterator.next() : iterator.next() + if (done) { + readable.push(null) + } else { + const res = value && typeof value.then === 'function' ? await value : value + if (res === null) { + reading = false + throw new ERR_STREAM_NULL_VALUES() + } else if (readable.push(res)) { + continue + } else { + reading = false } - await new Promise((resolve) => { - next = resolve - }) - } - } finally { - ac.abort() - done = true - if (resume) { - resume() - resume = null } + } catch (err) { + readable.destroy(err) } - }.call(this) - } - function asIndexedPairs(options = undefined) { - if (options != null) { - validateObject(options, 'options') + break } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - return async function* asIndexedPairs() { - let index = 0 - for await (const val of this) { - var _options$signal4 - if ( - options !== null && - options !== undefined && - (_options$signal4 = options.signal) !== null && - _options$signal4 !== undefined && - _options$signal4.aborted - ) { - throw new AbortError({ - cause: options.signal.reason - }) - } - yield [index++, val] - } - }.call(this) } - async function some(fn, options = undefined) { - for await (const unused of filter.call(this, fn, options)) { - return true - } - return false + return readable +} +module.exports = from + + +/***/ }), + +/***/ 94965: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(78969) +const { EventEmitter: EE } = __webpack_require__(5939) +function Stream(opts) { + EE.call(this, opts) +} +ObjectSetPrototypeOf(Stream.prototype, EE.prototype) +ObjectSetPrototypeOf(Stream, EE) +Stream.prototype.pipe = function (dest, options) { + const source = this + function ondata(chunk) { + if (dest.writable && dest.write(chunk) === false && source.pause) { + source.pause() + } + } + source.on('data', ondata) + function ondrain() { + if (source.readable && source.resume) { + source.resume() + } + } + dest.on('drain', ondrain) + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend) + source.on('close', onclose) } - async function every(fn, options = undefined) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - // https://en.wikipedia.org/wiki/De_Morgan%27s_laws - return !(await some.call( - this, - async (...args) => { - return !(await fn(...args)) - }, - options - )) + let didOnEnd = false + function onend() { + if (didOnEnd) return + didOnEnd = true + dest.end() } - async function find(fn, options) { - for await (const result of filter.call(this, fn, options)) { - return result - } - return undefined + function onclose() { + if (didOnEnd) return + didOnEnd = true + if (typeof dest.destroy === 'function') dest.destroy() } - async function forEach(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function forEachFn(value, options) { - await fn(value, options) - return kEmpty + + // Don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup() + if (EE.listenerCount(this, 'error') === 0) { + this.emit('error', er) } - // eslint-disable-next-line no-unused-vars - for await (const unused of map.call(this, forEachFn, options)); } - function filter(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function filterFn(value, options) { - if (await fn(value, options)) { - return value - } - return kEmpty - } - return map.call(this, filterFn, options) + prependListener(source, 'error', onerror) + prependListener(dest, 'error', onerror) + + // Remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata) + dest.removeListener('drain', ondrain) + source.removeListener('end', onend) + source.removeListener('close', onclose) + source.removeListener('error', onerror) + dest.removeListener('error', onerror) + source.removeListener('end', cleanup) + source.removeListener('close', cleanup) + dest.removeListener('close', cleanup) + } + source.on('end', cleanup) + source.on('close', cleanup) + dest.on('close', cleanup) + dest.emit('pipe', source) + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest +} +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) + else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) + else emitter._events[event] = [fn, emitter._events[event]] +} +module.exports = { + Stream, + prependListener +} + + +/***/ }), + +/***/ 69057: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +const { + codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, + AbortError +} = __webpack_require__(57186) +const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(59021) +const kWeakHandler = (__webpack_require__(78969).Symbol)('kWeak') +const { finished } = __webpack_require__(28425) +const staticCompose = __webpack_require__(80150) +const { addAbortSignalNoValidate } = __webpack_require__(7445) +const { isWritable, isNodeStream } = __webpack_require__(19654) +const { + ArrayPrototypePush, + MathFloor, + Number, + NumberIsNaN, + Promise, + PromiseReject, + PromisePrototypeThen, + Symbol +} = __webpack_require__(78969) +const kEmpty = Symbol('kEmpty') +const kEof = Symbol('kEof') +function compose(stream, options) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') } - - // Specific to provide better error to reduce since the argument is only - // missing if the stream has no items in it - but the code is still appropriate - class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { - constructor() { - super('reduce') - this.message = 'Reduce of an empty stream requires an initial value' - } + if (isNodeStream(stream) && !isWritable(stream)) { + throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') } - async function reduce(reducer, initialValue, options) { - var _options$signal5 - if (typeof reducer !== 'function') { - throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + const composedStream = staticCompose(this, stream) + if (options !== null && options !== undefined && options.signal) { + // Not validating as we already validated before + addAbortSignalNoValidate(options.signal, composedStream) + } + return composedStream +} +function map(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + let concurrency = 1 + if ((options === null || options === undefined ? undefined : options.concurrency) != null) { + concurrency = MathFloor(options.concurrency) + } + validateInteger(concurrency, 'concurrency', 1) + return async function* map() { + var _options$signal, _options$signal2 + const ac = new AbortController() + const stream = this + const queue = [] + const signal = ac.signal + const signalOpt = { + signal } - let hasInitialValue = arguments.length > 1 + const abort = () => ac.abort() if ( options !== null && options !== undefined && - (_options$signal5 = options.signal) !== null && - _options$signal5 !== undefined && - _options$signal5.aborted + (_options$signal = options.signal) !== null && + _options$signal !== undefined && + _options$signal.aborted ) { - const err = new AbortError(undefined, { - cause: options.signal.reason - }) - this.once('error', () => {}) // The error is already propagated - await finished(this.destroy(err)) - throw err - } - const ac = new AbortController() - const signal = ac.signal - if (options !== null && options !== undefined && options.signal) { - const opts = { - once: true, - [kWeakHandler]: this + abort() + } + options === null || options === undefined + ? undefined + : (_options$signal2 = options.signal) === null || _options$signal2 === undefined + ? undefined + : _options$signal2.addEventListener('abort', abort) + let next + let resume + let done = false + function onDone() { + done = true + } + async function pump() { + try { + for await (let val of stream) { + var _val + if (done) { + return + } + if (signal.aborted) { + throw new AbortError() + } + try { + val = fn(val, signalOpt) + } catch (err) { + val = PromiseReject(err) + } + if (val === kEmpty) { + continue + } + if (typeof ((_val = val) === null || _val === undefined ? undefined : _val.catch) === 'function') { + val.catch(onDone) + } + queue.push(val) + if (next) { + next() + next = null + } + if (!done && queue.length && queue.length >= concurrency) { + await new Promise((resolve) => { + resume = resolve + }) + } + } + queue.push(kEof) + } catch (err) { + const val = PromiseReject(err) + PromisePrototypeThen(val, undefined, onDone) + queue.push(val) + } finally { + var _options$signal3 + done = true + if (next) { + next() + next = null + } + options === null || options === undefined + ? undefined + : (_options$signal3 = options.signal) === null || _options$signal3 === undefined + ? undefined + : _options$signal3.removeEventListener('abort', abort) } - options.signal.addEventListener('abort', () => ac.abort(), opts) } - let gotAnyItemFromStream = false + pump() try { - for await (const value of this) { - var _options$signal6 - gotAnyItemFromStream = true - if ( - options !== null && - options !== undefined && - (_options$signal6 = options.signal) !== null && - _options$signal6 !== undefined && - _options$signal6.aborted - ) { - throw new AbortError() - } - if (!hasInitialValue) { - initialValue = value - hasInitialValue = true - } else { - initialValue = await reducer(initialValue, value, { - signal - }) + while (true) { + while (queue.length > 0) { + const val = await queue[0] + if (val === kEof) { + return + } + if (signal.aborted) { + throw new AbortError() + } + if (val !== kEmpty) { + yield val + } + queue.shift() + if (resume) { + resume() + resume = null + } } - } - if (!gotAnyItemFromStream && !hasInitialValue) { - throw new ReduceAwareErrMissingArgs() + await new Promise((resolve) => { + next = resolve + }) } } finally { ac.abort() + done = true + if (resume) { + resume() + resume = null + } } - return initialValue + }.call(this) +} +function asIndexedPairs(options = undefined) { + if (options != null) { + validateObject(options, 'options') } - async function toArray(options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - const result = [] + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + return async function* asIndexedPairs() { + let index = 0 for await (const val of this) { - var _options$signal7 + var _options$signal4 if ( options !== null && options !== undefined && - (_options$signal7 = options.signal) !== null && - _options$signal7 !== undefined && - _options$signal7.aborted + (_options$signal4 = options.signal) !== null && + _options$signal4 !== undefined && + _options$signal4.aborted ) { - throw new AbortError(undefined, { + throw new AbortError({ cause: options.signal.reason }) } - ArrayPrototypePush(result, val) + yield [index++, val] } + }.call(this) +} +async function some(fn, options = undefined) { + for await (const unused of filter.call(this, fn, options)) { + return true + } + return false +} +async function every(fn, options = undefined) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + // https://en.wikipedia.org/wiki/De_Morgan%27s_laws + return !(await some.call( + this, + async (...args) => { + return !(await fn(...args)) + }, + options + )) +} +async function find(fn, options) { + for await (const result of filter.call(this, fn, options)) { return result } - function flatMap(fn, options) { - const values = map.call(this, fn, options) - return async function* flatMap() { - for await (const val of values) { - yield* val - } - }.call(this) + return undefined +} +async function forEach(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) } - function toIntegerOrInfinity(number) { - // We coerce here to align with the spec - // https://github.com/tc39/proposal-iterator-helpers/issues/169 - number = Number(number) - if (NumberIsNaN(number)) { - return 0 - } - if (number < 0) { - throw new ERR_OUT_OF_RANGE('number', '>= 0', number) - } - return number + async function forEachFn(value, options) { + await fn(value, options) + return kEmpty } - function drop(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') + // eslint-disable-next-line no-unused-vars + for await (const unused of map.call(this, forEachFn, options)); +} +function filter(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + async function filterFn(value, options) { + if (await fn(value, options)) { + return value } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + return kEmpty + } + return map.call(this, filterFn, options) +} + +// Specific to provide better error to reduce since the argument is only +// missing if the stream has no items in it - but the code is still appropriate +class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { + constructor() { + super('reduce') + this.message = 'Reduce of an empty stream requires an initial value' + } +} +async function reduce(reducer, initialValue, options) { + var _options$signal5 + if (typeof reducer !== 'function') { + throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) + } + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + let hasInitialValue = arguments.length > 1 + if ( + options !== null && + options !== undefined && + (_options$signal5 = options.signal) !== null && + _options$signal5 !== undefined && + _options$signal5.aborted + ) { + const err = new AbortError(undefined, { + cause: options.signal.reason + }) + this.once('error', () => {}) // The error is already propagated + await finished(this.destroy(err)) + throw err + } + const ac = new AbortController() + const signal = ac.signal + if (options !== null && options !== undefined && options.signal) { + const opts = { + once: true, + [kWeakHandler]: this } - number = toIntegerOrInfinity(number) - return async function* drop() { - var _options$signal8 + options.signal.addEventListener('abort', () => ac.abort(), opts) + } + let gotAnyItemFromStream = false + try { + for await (const value of this) { + var _options$signal6 + gotAnyItemFromStream = true if ( options !== null && options !== undefined && - (_options$signal8 = options.signal) !== null && - _options$signal8 !== undefined && - _options$signal8.aborted + (_options$signal6 = options.signal) !== null && + _options$signal6 !== undefined && + _options$signal6.aborted ) { throw new AbortError() } - for await (const val of this) { - var _options$signal9 - if ( - options !== null && - options !== undefined && - (_options$signal9 = options.signal) !== null && - _options$signal9 !== undefined && - _options$signal9.aborted - ) { - throw new AbortError() - } - if (number-- <= 0) { - yield val - } + if (!hasInitialValue) { + initialValue = value + hasInitialValue = true + } else { + initialValue = await reducer(initialValue, value, { + signal + }) } - }.call(this) + } + if (!gotAnyItemFromStream && !hasInitialValue) { + throw new ReduceAwareErrMissingArgs() + } + } finally { + ac.abort() + } + return initialValue +} +async function toArray(options) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') } - function take(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') + const result = [] + for await (const val of this) { + var _options$signal7 + if ( + options !== null && + options !== undefined && + (_options$signal7 = options.signal) !== null && + _options$signal7 !== undefined && + _options$signal7.aborted + ) { + throw new AbortError(undefined, { + cause: options.signal.reason + }) } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + ArrayPrototypePush(result, val) + } + return result +} +function flatMap(fn, options) { + const values = map.call(this, fn, options) + return async function* flatMap() { + for await (const val of values) { + yield* val + } + }.call(this) +} +function toIntegerOrInfinity(number) { + // We coerce here to align with the spec + // https://github.com/tc39/proposal-iterator-helpers/issues/169 + number = Number(number) + if (NumberIsNaN(number)) { + return 0 + } + if (number < 0) { + throw new ERR_OUT_OF_RANGE('number', '>= 0', number) + } + return number +} +function drop(number, options = undefined) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + number = toIntegerOrInfinity(number) + return async function* drop() { + var _options$signal8 + if ( + options !== null && + options !== undefined && + (_options$signal8 = options.signal) !== null && + _options$signal8 !== undefined && + _options$signal8.aborted + ) { + throw new AbortError() } - number = toIntegerOrInfinity(number) - return async function* take() { - var _options$signal10 + for await (const val of this) { + var _options$signal9 if ( options !== null && options !== undefined && - (_options$signal10 = options.signal) !== null && - _options$signal10 !== undefined && - _options$signal10.aborted + (_options$signal9 = options.signal) !== null && + _options$signal9 !== undefined && + _options$signal9.aborted ) { throw new AbortError() } - for await (const val of this) { - var _options$signal11 - if ( - options !== null && - options !== undefined && - (_options$signal11 = options.signal) !== null && - _options$signal11 !== undefined && - _options$signal11.aborted - ) { - throw new AbortError() - } - if (number-- > 0) { - yield val - } else { - return - } - } - }.call(this) - } - module.exports.streamReturningOperators = { - asIndexedPairs, - drop, - filter, - flatMap, - map, - take, - compose - } - module.exports.promiseReturningOperators = { - every, - forEach, - reduce, - toArray, - some, - find - } - - - /***/ }), - - /***/ 92817: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a passthrough stream. - // basically just the most minimal sort of Transform stream. - // Every written chunk gets output as-is. - - - - const { ObjectSetPrototypeOf } = __webpack_require__(78969) - module.exports = PassThrough - const Transform = __webpack_require__(51314) - ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) - ObjectSetPrototypeOf(PassThrough, Transform) - function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options) - Transform.call(this, options) - } - PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk) - } - - - /***/ }), - - /***/ 93002: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // Ported from https://github.com/mafintosh/pump with - // permission from the author, Mathias Buus (@mafintosh). - - ;('use strict') - const { ArrayIsArray, Promise, SymbolAsyncIterator } = __webpack_require__(78969) - const eos = __webpack_require__(28425) - const { once } = __webpack_require__(64083) - const destroyImpl = __webpack_require__(79638) - const Duplex = __webpack_require__(56725) - const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_INVALID_RETURN_VALUE, - ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED, - ERR_STREAM_PREMATURE_CLOSE - }, - AbortError - } = __webpack_require__(57186) - const { validateFunction, validateAbortSignal } = __webpack_require__(59021) - const { - isIterable, - isReadable, - isReadableNodeStream, - isNodeStream, - isTransformStream, - isWebStream, - isReadableStream, - isReadableEnded - } = __webpack_require__(19654) - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - let PassThrough - let Readable - function destroyer(stream, reading, writing) { - let finished = false - stream.on('close', () => { - finished = true - }) - const cleanup = eos( - stream, - { - readable: reading, - writable: writing - }, - (err) => { - finished = !err + if (number-- <= 0) { + yield val } - ) - return { - destroy: (err) => { - if (finished) return - finished = true - destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) - }, - cleanup } + }.call(this) +} +function take(number, options = undefined) { + if (options != null) { + validateObject(options, 'options') } - function popCallback(streams) { - // Streams should never be an empty array. It should always contain at least - // a single stream. Therefore optimize for the average case instead of - // checking for length === 0 as well. - validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') - return streams.pop() - } - function makeAsyncIterable(val) { - if (isIterable(val)) { - return val - } else if (isReadableNodeStream(val)) { - // Legacy streams are not Iterable. - return fromReadable(val) - } - throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') } - async function* fromReadable(val) { - if (!Readable) { - Readable = __webpack_require__(69293) + number = toIntegerOrInfinity(number) + return async function* take() { + var _options$signal10 + if ( + options !== null && + options !== undefined && + (_options$signal10 = options.signal) !== null && + _options$signal10 !== undefined && + _options$signal10.aborted + ) { + throw new AbortError() } - yield* Readable.prototype[SymbolAsyncIterator].call(val) - } - async function pumpToNode(iterable, writable, finish, { end }) { - let error - let onresolve = null - const resume = (err) => { - if (err) { - error = err + for await (const val of this) { + var _options$signal11 + if ( + options !== null && + options !== undefined && + (_options$signal11 = options.signal) !== null && + _options$signal11 !== undefined && + _options$signal11.aborted + ) { + throw new AbortError() } - if (onresolve) { - const callback = onresolve - onresolve = null - callback() + if (number-- > 0) { + yield val + } else { + return } } - const wait = () => - new Promise((resolve, reject) => { - if (error) { - reject(error) - } else { - onresolve = () => { - if (error) { - reject(error) - } else { - resolve() - } + }.call(this) +} +module.exports.streamReturningOperators = { + asIndexedPairs, + drop, + filter, + flatMap, + map, + take, + compose +} +module.exports.promiseReturningOperators = { + every, + forEach, + reduce, + toArray, + some, + find +} + + +/***/ }), + +/***/ 92817: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +const { ObjectSetPrototypeOf } = __webpack_require__(78969) +module.exports = PassThrough +const Transform = __webpack_require__(51314) +ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) +ObjectSetPrototypeOf(PassThrough, Transform) +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options) + Transform.call(this, options) +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk) +} + + +/***/ }), + +/***/ 93002: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + +;('use strict') +const { ArrayIsArray, Promise, SymbolAsyncIterator } = __webpack_require__(78969) +const eos = __webpack_require__(28425) +const { once } = __webpack_require__(64083) +const destroyImpl = __webpack_require__(79638) +const Duplex = __webpack_require__(56725) +const { + aggregateTwoErrors, + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_RETURN_VALUE, + ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED, + ERR_STREAM_PREMATURE_CLOSE + }, + AbortError +} = __webpack_require__(57186) +const { validateFunction, validateAbortSignal } = __webpack_require__(59021) +const { + isIterable, + isReadable, + isReadableNodeStream, + isNodeStream, + isTransformStream, + isWebStream, + isReadableStream, + isReadableEnded +} = __webpack_require__(19654) +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +let PassThrough +let Readable +function destroyer(stream, reading, writing) { + let finished = false + stream.on('close', () => { + finished = true + }) + const cleanup = eos( + stream, + { + readable: reading, + writable: writing + }, + (err) => { + finished = !err + } + ) + return { + destroy: (err) => { + if (finished) return + finished = true + destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) + }, + cleanup + } +} +function popCallback(streams) { + // Streams should never be an empty array. It should always contain at least + // a single stream. Therefore optimize for the average case instead of + // checking for length === 0 as well. + validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') + return streams.pop() +} +function makeAsyncIterable(val) { + if (isIterable(val)) { + return val + } else if (isReadableNodeStream(val)) { + // Legacy streams are not Iterable. + return fromReadable(val) + } + throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) +} +async function* fromReadable(val) { + if (!Readable) { + Readable = __webpack_require__(69293) + } + yield* Readable.prototype[SymbolAsyncIterator].call(val) +} +async function pumpToNode(iterable, writable, finish, { end }) { + let error + let onresolve = null + const resume = (err) => { + if (err) { + error = err + } + if (onresolve) { + const callback = onresolve + onresolve = null + callback() + } + } + const wait = () => + new Promise((resolve, reject) => { + if (error) { + reject(error) + } else { + onresolve = () => { + if (error) { + reject(error) + } else { + resolve() } } - }) - writable.on('drain', resume) - const cleanup = eos( - writable, - { - readable: false - }, - resume - ) - try { - if (writable.writableNeedDrain) { - await wait() - } - for await (const chunk of iterable) { - if (!writable.write(chunk)) { - await wait() - } - } - if (end) { - writable.end() } + }) + writable.on('drain', resume) + const cleanup = eos( + writable, + { + readable: false + }, + resume + ) + try { + if (writable.writableNeedDrain) { await wait() - finish() - } catch (err) { - finish(error !== err ? aggregateTwoErrors(error, err) : err) - } finally { - cleanup() - writable.off('drain', resume) - } - } - async function pumpToWeb(readable, writable, finish, { end }) { - if (isTransformStream(writable)) { - writable = writable.writable } - // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure - const writer = writable.getWriter() - try { - for await (const chunk of readable) { - await writer.ready - writer.write(chunk).catch(() => {}) + for await (const chunk of iterable) { + if (!writable.write(chunk)) { + await wait() } + } + if (end) { + writable.end() + } + await wait() + finish() + } catch (err) { + finish(error !== err ? aggregateTwoErrors(error, err) : err) + } finally { + cleanup() + writable.off('drain', resume) + } +} +async function pumpToWeb(readable, writable, finish, { end }) { + if (isTransformStream(writable)) { + writable = writable.writable + } + // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure + const writer = writable.getWriter() + try { + for await (const chunk of readable) { await writer.ready - if (end) { - await writer.close() - } - finish() - } catch (err) { - try { - await writer.abort(err) - finish(err) - } catch (err) { - finish(err) - } + writer.write(chunk).catch(() => {}) + } + await writer.ready + if (end) { + await writer.close() + } + finish() + } catch (err) { + try { + await writer.abort(err) + finish(err) + } catch (err) { + finish(err) } } - function pipeline(...streams) { - return pipelineImpl(streams, once(popCallback(streams))) +} +function pipeline(...streams) { + return pipelineImpl(streams, once(popCallback(streams))) +} +function pipelineImpl(streams, callback, opts) { + if (streams.length === 1 && ArrayIsArray(streams[0])) { + streams = streams[0] } - function pipelineImpl(streams, callback, opts) { - if (streams.length === 1 && ArrayIsArray(streams[0])) { - streams = streams[0] + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams') + } + const ac = new AbortController() + const signal = ac.signal + const outerSignal = opts === null || opts === undefined ? undefined : opts.signal + + // Need to cleanup event listeners if last stream is readable + // https://github.com/nodejs/node/issues/35452 + const lastStreamCleanup = [] + validateAbortSignal(outerSignal, 'options.signal') + function abort() { + finishImpl(new AbortError()) + } + outerSignal === null || outerSignal === undefined ? undefined : outerSignal.addEventListener('abort', abort) + let error + let value + const destroys = [] + let finishCount = 0 + function finish(err) { + finishImpl(err, --finishCount === 0) + } + function finishImpl(err, final) { + if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { + error = err + } + if (!error && !final) { + return } - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams') + while (destroys.length) { + destroys.shift()(error) } - const ac = new AbortController() - const signal = ac.signal - const outerSignal = opts === null || opts === undefined ? undefined : opts.signal - - // Need to cleanup event listeners if last stream is readable - // https://github.com/nodejs/node/issues/35452 - const lastStreamCleanup = [] - validateAbortSignal(outerSignal, 'options.signal') - function abort() { - finishImpl(new AbortError()) - } - outerSignal === null || outerSignal === undefined ? undefined : outerSignal.addEventListener('abort', abort) - let error - let value - const destroys = [] - let finishCount = 0 - function finish(err) { - finishImpl(err, --finishCount === 0) - } - function finishImpl(err, final) { - if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { - error = err - } - if (!error && !final) { - return + outerSignal === null || outerSignal === undefined ? undefined : outerSignal.removeEventListener('abort', abort) + ac.abort() + if (final) { + if (!error) { + lastStreamCleanup.forEach((fn) => fn()) } - while (destroys.length) { - destroys.shift()(error) + process.nextTick(callback, error, value) + } + } + let ret + for (let i = 0; i < streams.length; i++) { + const stream = streams[i] + const reading = i < streams.length - 1 + const writing = i > 0 + const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false + const isLastStream = i === streams.length - 1 + if (isNodeStream(stream)) { + if (end) { + const { destroy, cleanup } = destroyer(stream, reading, writing) + destroys.push(destroy) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(cleanup) + } } - outerSignal === null || outerSignal === undefined ? undefined : outerSignal.removeEventListener('abort', abort) - ac.abort() - if (final) { - if (!error) { - lastStreamCleanup.forEach((fn) => fn()) + + // Catch stream errors that occur after pipe/pump has completed. + function onError(err) { + if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + finish(err) } - process.nextTick(callback, error, value) + } + stream.on('error', onError) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(() => { + stream.removeListener('error', onError) + }) } } - let ret - for (let i = 0; i < streams.length; i++) { - const stream = streams[i] - const reading = i < streams.length - 1 - const writing = i > 0 - const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false - const isLastStream = i === streams.length - 1 - if (isNodeStream(stream)) { - if (end) { - const { destroy, cleanup } = destroyer(stream, reading, writing) - destroys.push(destroy) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - - // Catch stream errors that occur after pipe/pump has completed. - function onError(err) { - if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - finish(err) - } - } - stream.on('error', onError) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(() => { - stream.removeListener('error', onError) - }) + if (i === 0) { + if (typeof stream === 'function') { + ret = stream({ + signal + }) + if (!isIterable(ret)) { + throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) } + } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { + ret = stream + } else { + ret = Duplex.from(stream) } - if (i === 0) { - if (typeof stream === 'function') { - ret = stream({ - signal - }) - if (!isIterable(ret)) { - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) - } - } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { - ret = stream - } else { - ret = Duplex.from(stream) + } else if (typeof stream === 'function') { + if (isTransformStream(ret)) { + var _ret + ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) + } else { + ret = makeAsyncIterable(ret) + } + ret = stream(ret, { + signal + }) + if (reading) { + if (!isIterable(ret, true)) { + throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) } - } else if (typeof stream === 'function') { - if (isTransformStream(ret)) { - var _ret - ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) - } else { - ret = makeAsyncIterable(ret) + } else { + var _ret2 + if (!PassThrough) { + PassThrough = __webpack_require__(92817) } - ret = stream(ret, { - signal + + // If the last argument to pipeline is not a stream + // we must create a proxy stream so that pipeline(...) + // always returns a stream which can be further + // composed through `.pipe(stream)`. + + const pt = new PassThrough({ + objectMode: true }) - if (reading) { - if (!isIterable(ret, true)) { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) - } - } else { - var _ret2 - if (!PassThrough) { - PassThrough = __webpack_require__(92817) - } - - // If the last argument to pipeline is not a stream - // we must create a proxy stream so that pipeline(...) - // always returns a stream which can be further - // composed through `.pipe(stream)`. - - const pt = new PassThrough({ - objectMode: true - }) - - // Handle Promises/A+ spec, `then` could be a getter that throws on - // second use. - const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then - if (typeof then === 'function') { - finishCount++ - then.call( - ret, - (val) => { - value = val - if (val != null) { - pt.write(val) - } - if (end) { - pt.end() - } - process.nextTick(finish) - }, - (err) => { - pt.destroy(err) - process.nextTick(finish, err) - } - ) - } else if (isIterable(ret, true)) { - finishCount++ - pumpToNode(ret, pt, finish, { - end - }) - } else if (isReadableStream(ret) || isTransformStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, pt, finish, { - end - }) - } else { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) - } - ret = pt - const { destroy, cleanup } = destroyer(ret, false, true) - destroys.push(destroy) - if (isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - } else if (isNodeStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount += 2 - const cleanup = pipe(ret, stream, finish, { - end - }) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } else if (isTransformStream(ret) || isReadableStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, stream, finish, { - end - }) - } else if (isIterable(ret)) { + + // Handle Promises/A+ spec, `then` could be a getter that throws on + // second use. + const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then + if (typeof then === 'function') { finishCount++ - pumpToNode(ret, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret + then.call( + ret, + (val) => { + value = val + if (val != null) { + pt.write(val) + } + if (end) { + pt.end() + } + process.nextTick(finish) + }, + (err) => { + pt.destroy(err) + process.nextTick(finish, err) + } ) - } - ret = stream - } else if (isWebStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount++ - pumpToWeb(makeAsyncIterable(ret), stream, finish, { - end - }) - } else if (isReadableStream(ret) || isIterable(ret)) { + } else if (isIterable(ret, true)) { finishCount++ - pumpToWeb(ret, stream, finish, { + pumpToNode(ret, pt, finish, { end }) - } else if (isTransformStream(ret)) { + } else if (isReadableStream(ret) || isTransformStream(ret)) { + const toRead = ret.readable || ret finishCount++ - pumpToWeb(ret.readable, stream, finish, { + pumpToNode(toRead, pt, finish, { end }) } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) + throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) + } + ret = pt + const { destroy, cleanup } = destroyer(ret, false, true) + destroys.push(destroy) + if (isLastStream) { + lastStreamCleanup.push(cleanup) } - ret = stream - } else { - ret = Duplex.from(stream) } - } - if ( - (signal !== null && signal !== undefined && signal.aborted) || - (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) - ) { - process.nextTick(abort) - } - return ret - } - function pipe(src, dst, finish, { end }) { - let ended = false - dst.on('close', () => { - if (!ended) { - // Finish if the destination closes before the source has completed. - finish(new ERR_STREAM_PREMATURE_CLOSE()) + } else if (isNodeStream(stream)) { + if (isReadableNodeStream(ret)) { + finishCount += 2 + const cleanup = pipe(ret, stream, finish, { + end + }) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(cleanup) + } + } else if (isTransformStream(ret) || isReadableStream(ret)) { + const toRead = ret.readable || ret + finishCount++ + pumpToNode(toRead, stream, finish, { + end + }) + } else if (isIterable(ret)) { + finishCount++ + pumpToNode(ret, stream, finish, { + end + }) + } else { + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) } - }) - src.pipe(dst, { - end: false - }) // If end is true we already will have a listener to end dst. - - if (end) { - // Compat. Before node v10.12.0 stdio used to throw an error so - // pipe() did/does not end() stdio destinations. - // Now they allow it but "secretly" don't close the underlying fd. - - function endFn() { - ended = true - dst.end() - } - if (isReadableEnded(src)) { - // End the destination if the source has already ended. - process.nextTick(endFn) + ret = stream + } else if (isWebStream(stream)) { + if (isReadableNodeStream(ret)) { + finishCount++ + pumpToWeb(makeAsyncIterable(ret), stream, finish, { + end + }) + } else if (isReadableStream(ret) || isIterable(ret)) { + finishCount++ + pumpToWeb(ret, stream, finish, { + end + }) + } else if (isTransformStream(ret)) { + finishCount++ + pumpToWeb(ret.readable, stream, finish, { + end + }) } else { - src.once('end', endFn) + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) } + ret = stream } else { - finish() + ret = Duplex.from(stream) } - eos( - src, - { - readable: true, - writable: false - }, - (err) => { - const rState = src._readableState - if ( - err && - err.code === 'ERR_STREAM_PREMATURE_CLOSE' && - rState && - rState.ended && - !rState.errored && - !rState.errorEmitted - ) { - // Some readable streams will emit 'close' before 'end'. However, since - // this is on the readable side 'end' should still be emitted if the - // stream has been ended and no error emitted. This should be allowed in - // favor of backwards compatibility. Since the stream is piped to a - // destination this should not result in any observable difference. - // We don't need to check if this is a writable premature close since - // eos will only fail with premature close on the reading side for - // duplex streams. - src.once('end', finish).once('error', finish) - } else { - finish(err) - } - } - ) - return eos( - dst, - { - readable: false, - writable: true - }, - finish - ) } - module.exports = { - pipelineImpl, - pipeline - } - - - /***/ }), - - /***/ 69293: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // 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') - const { - ArrayPrototypeIndexOf, - NumberIsInteger, - NumberIsNaN, - NumberParseInt, - ObjectDefineProperties, - ObjectKeys, - ObjectSetPrototypeOf, - Promise, - SafeSet, - SymbolAsyncIterator, - Symbol - } = __webpack_require__(78969) - module.exports = Readable - Readable.ReadableState = ReadableState - const { EventEmitter: EE } = __webpack_require__(5939) - const { Stream, prependListener } = __webpack_require__(94965) - const { Buffer } = __webpack_require__(2486) - const { addAbortSignal } = __webpack_require__(7445) - const eos = __webpack_require__(28425) - let debug = (__webpack_require__(64083).debuglog)('stream', (fn) => { - debug = fn + if ( + (signal !== null && signal !== undefined && signal.aborted) || + (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) + ) { + process.nextTick(abort) + } + return ret +} +function pipe(src, dst, finish, { end }) { + let ended = false + dst.on('close', () => { + if (!ended) { + // Finish if the destination closes before the source has completed. + finish(new ERR_STREAM_PREMATURE_CLOSE()) + } }) - const BufferList = __webpack_require__(29390) - const destroyImpl = __webpack_require__(79638) - const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(43617) - const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_OUT_OF_RANGE, - ERR_STREAM_PUSH_AFTER_EOF, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT - } - } = __webpack_require__(57186) - const { validateObject } = __webpack_require__(59021) - const kPaused = Symbol('kPaused') - const { StringDecoder } = __webpack_require__(10301) - const from = __webpack_require__(50841) - ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) - ObjectSetPrototypeOf(Readable, Stream) - const nop = () => {} - const { errorOrDestroy } = destroyImpl - function ReadableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(56725) - - // Object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.readableObjectMode) - - // The point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = options - ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift(). - this.buffer = new BufferList() - this.length = 0 - this.pipes = [] - this.flowing = null - this.ended = false - this.endEmitted = false - this.reading = false - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // A flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true - - // Whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false - this.emittedReadable = false - this.readableListening = false - this.resumeScheduled = false - this[kPaused] = null - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'end' (and potentially 'finish'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Has it been destroyed. - this.destroyed = false - - // Indicates whether the stream has errored. When true no further - // _read calls, 'data' or 'readable' events should occur. This is needed - // since when autoDestroy is disabled we need a way to tell whether the - // stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Ref the piped dest which we need a drain event on it - // type: null | Writable | Set. - this.awaitDrainWriters = null - this.multiAwaitDrain = false - - // If true, a maybeReadMore has been scheduled. - this.readingMore = false - this.dataEmitted = false - this.decoder = null - this.encoding = null - if (options && options.encoding) { - this.decoder = new StringDecoder(options.encoding) - this.encoding = options.encoding - } - } - function Readable(options) { - if (!(this instanceof Readable)) return new Readable(options) - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(56725) - this._readableState = new ReadableState(options, this, isDuplex) - if (options) { - if (typeof options.read === 'function') this._read = options.read - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal && !isDuplex) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - if (this._readableState.needReadable) { - maybeReadMore(this, this._readableState) - } - }) + src.pipe(dst, { + end: false + }) // If end is true we already will have a listener to end dst. + + if (end) { + // Compat. Before node v10.12.0 stdio used to throw an error so + // pipe() did/does not end() stdio destinations. + // Now they allow it but "secretly" don't close the underlying fd. + + function endFn() { + ended = true + dst.end() + } + if (isReadableEnded(src)) { + // End the destination if the source has already ended. + process.nextTick(endFn) + } else { + src.once('end', endFn) + } + } else { + finish() } - Readable.prototype.destroy = destroyImpl.destroy - Readable.prototype._undestroy = destroyImpl.undestroy - Readable.prototype._destroy = function (err, cb) { - cb(err) - } - Readable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) - } - - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, false) - } - - // Unshift should *always* be something directly out of read(). - Readable.prototype.unshift = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, true) - } - function readableAddChunk(stream, chunk, encoding, addToFront) { - debug('readableAddChunk', chunk) - const state = stream._readableState - let err - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding - if (state.encoding !== encoding) { - if (addToFront && state.encoding) { - // When unshifting, if state.encoding is set, we have to save - // the string in the BufferList with the state encoding. - chunk = Buffer.from(chunk, encoding).toString(state.encoding) - } else { - chunk = Buffer.from(chunk, encoding) - encoding = '' - } - } - } else if (chunk instanceof Buffer) { - encoding = '' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = '' - } else if (chunk != null) { - err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + eos( + src, + { + readable: true, + writable: false + }, + (err) => { + const rState = src._readableState + if ( + err && + err.code === 'ERR_STREAM_PREMATURE_CLOSE' && + rState && + rState.ended && + !rState.errored && + !rState.errorEmitted + ) { + // Some readable streams will emit 'close' before 'end'. However, since + // this is on the readable side 'end' should still be emitted if the + // stream has been ended and no error emitted. This should be allowed in + // favor of backwards compatibility. Since the stream is piped to a + // destination this should not result in any observable difference. + // We don't need to check if this is a writable premature close since + // eos will only fail with premature close on the reading side for + // duplex streams. + src.once('end', finish).once('error', finish) + } else { + finish(err) } } - if (err) { - errorOrDestroy(stream, err) - } else if (chunk === null) { - state.reading = false - onEofChunk(stream, state) - } else if (state.objectMode || (chunk && chunk.length > 0)) { - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) - else if (state.destroyed || state.errored) return false - else addChunk(stream, state, chunk, true) - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) - } else if (state.destroyed || state.errored) { - return false - } else { - state.reading = false - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk) - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) - else maybeReadMore(stream, state) + ) + return eos( + dst, + { + readable: false, + writable: true + }, + finish + ) +} +module.exports = { + pipelineImpl, + pipeline +} + + +/***/ }), + +/***/ 69293: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// 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') +const { + ArrayPrototypeIndexOf, + NumberIsInteger, + NumberIsNaN, + NumberParseInt, + ObjectDefineProperties, + ObjectKeys, + ObjectSetPrototypeOf, + Promise, + SafeSet, + SymbolAsyncIterator, + Symbol +} = __webpack_require__(78969) +module.exports = Readable +Readable.ReadableState = ReadableState +const { EventEmitter: EE } = __webpack_require__(5939) +const { Stream, prependListener } = __webpack_require__(94965) +const { Buffer } = __webpack_require__(2486) +const { addAbortSignal } = __webpack_require__(7445) +const eos = __webpack_require__(28425) +let debug = (__webpack_require__(64083).debuglog)('stream', (fn) => { + debug = fn +}) +const BufferList = __webpack_require__(29390) +const destroyImpl = __webpack_require__(79638) +const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(43617) +const { + aggregateTwoErrors, + codes: { + ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED, + ERR_OUT_OF_RANGE, + ERR_STREAM_PUSH_AFTER_EOF, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT + } +} = __webpack_require__(57186) +const { validateObject } = __webpack_require__(59021) +const kPaused = Symbol('kPaused') +const { StringDecoder } = __webpack_require__(10301) +const from = __webpack_require__(50841) +ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) +ObjectSetPrototypeOf(Readable, Stream) +const nop = () => {} +const { errorOrDestroy } = destroyImpl +function ReadableState(options, stream, isDuplex) { + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(56725) + + // Object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away. + this.objectMode = !!(options && options.objectMode) + if (isDuplex) this.objectMode = this.objectMode || !!(options && options.readableObjectMode) + + // The point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = options + ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) + : getDefaultHighWaterMark(false) + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift(). + this.buffer = new BufferList() + this.length = 0 + this.pipes = [] + this.flowing = null + this.ended = false + this.endEmitted = false + this.reading = false + + // Stream is still being constructed and cannot be + // destroyed until construction finished or failed. + // Async construction is opt in, therefore we start as + // constructed. + this.constructed = true + + // A flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true + + // Whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false + this.emittedReadable = false + this.readableListening = false + this.resumeScheduled = false + this[kPaused] = null + + // True if the error was already emitted and should not be thrown again. + this.errorEmitted = false + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = !options || options.emitClose !== false + + // Should .destroy() be called after 'end' (and potentially 'finish'). + this.autoDestroy = !options || options.autoDestroy !== false + + // Has it been destroyed. + this.destroyed = false + + // Indicates whether the stream has errored. When true no further + // _read calls, 'data' or 'readable' events should occur. This is needed + // since when autoDestroy is disabled we need a way to tell whether the + // stream has failed. + this.errored = null + + // Indicates whether the stream has finished destroying. + this.closed = false + + // True if close has been emitted or would have been emitted + // depending on emitClose. + this.closeEmitted = false + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' + + // Ref the piped dest which we need a drain event on it + // type: null | Writable | Set. + this.awaitDrainWriters = null + this.multiAwaitDrain = false + + // If true, a maybeReadMore has been scheduled. + this.readingMore = false + this.dataEmitted = false + this.decoder = null + this.encoding = null + if (options && options.encoding) { + this.decoder = new StringDecoder(options.encoding) + this.encoding = options.encoding + } +} +function Readable(options) { + if (!(this instanceof Readable)) return new Readable(options) + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5. + const isDuplex = this instanceof __webpack_require__(56725) + this._readableState = new ReadableState(options, this, isDuplex) + if (options) { + if (typeof options.read === 'function') this._read = options.read + if (typeof options.destroy === 'function') this._destroy = options.destroy + if (typeof options.construct === 'function') this._construct = options.construct + if (options.signal && !isDuplex) addAbortSignal(options.signal, this) + } + Stream.call(this, options) + destroyImpl.construct(this, () => { + if (this._readableState.needReadable) { + maybeReadMore(this, this._readableState) + } + }) +} +Readable.prototype.destroy = destroyImpl.destroy +Readable.prototype._undestroy = destroyImpl.undestroy +Readable.prototype._destroy = function (err, cb) { + cb(err) +} +Readable.prototype[EE.captureRejectionSymbol] = function (err) { + this.destroy(err) +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + return readableAddChunk(this, chunk, encoding, false) +} + +// Unshift should *always* be something directly out of read(). +Readable.prototype.unshift = function (chunk, encoding) { + return readableAddChunk(this, chunk, encoding, true) +} +function readableAddChunk(stream, chunk, encoding, addToFront) { + debug('readableAddChunk', chunk) + const state = stream._readableState + let err + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding + if (state.encoding !== encoding) { + if (addToFront && state.encoding) { + // When unshifting, if state.encoding is set, we have to save + // the string in the BufferList with the state encoding. + chunk = Buffer.from(chunk, encoding).toString(state.encoding) } else { - addChunk(stream, state, chunk, false) - } - } - } else if (!addToFront) { + chunk = Buffer.from(chunk, encoding) + encoding = '' + } + } + } else if (chunk instanceof Buffer) { + encoding = '' + } else if (Stream._isUint8Array(chunk)) { + chunk = Stream._uint8ArrayToBuffer(chunk) + encoding = '' + } else if (chunk != null) { + err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + } + } + if (err) { + errorOrDestroy(stream, err) + } else if (chunk === null) { + state.reading = false + onEofChunk(stream, state) + } else if (state.objectMode || (chunk && chunk.length > 0)) { + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) + else if (state.destroyed || state.errored) return false + else addChunk(stream, state, chunk, true) + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) + } else if (state.destroyed || state.errored) { + return false + } else { state.reading = false - maybeReadMore(stream, state) - } - - // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - return !state.ended && (state.length < state.highWaterMark || state.length === 0) - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { - // Use the guard to avoid creating `Set()` repeatedly - // when we have multiple pipes. - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk) + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) + else maybeReadMore(stream, state) } else { - state.awaitDrainWriters = null + addChunk(stream, state, chunk, false) } - state.dataEmitted = true - stream.emit('data', chunk) - } else { - // Update the buffer info. - state.length += state.objectMode ? 1 : chunk.length - if (addToFront) state.buffer.unshift(chunk) - else state.buffer.push(chunk) - if (state.needReadable) emitReadable(stream) } + } else if (!addToFront) { + state.reading = false maybeReadMore(stream, state) } - Readable.prototype.isPaused = function () { - const state = this._readableState - return state[kPaused] === true || state.flowing === false - } - - // Backwards compatibility. - Readable.prototype.setEncoding = function (enc) { - const decoder = new StringDecoder(enc) - this._readableState.decoder = decoder - // If setEncoding(null), decoder.encoding equals utf8. - this._readableState.encoding = this._readableState.decoder.encoding - const buffer = this._readableState.buffer - // Iterate over current buffer to convert already stored Buffers: - let content = '' - for (const data of buffer) { - content += decoder.write(data) - } - buffer.clear() - if (content !== '') buffer.push(content) - this._readableState.length = content.length - return this - } - - // Don't raise the hwm > 1GB. - const MAX_HWM = 0x40000000 - function computeNewHighWaterMark(n) { - if (n > MAX_HWM) { - throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0) +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { + // Use the guard to avoid creating `Set()` repeatedly + // when we have multiple pipes. + if (state.multiAwaitDrain) { + state.awaitDrainWriters.clear() } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts. - n-- - n |= n >>> 1 - n |= n >>> 2 - n |= n >>> 4 - n |= n >>> 8 - n |= n >>> 16 - n++ - } - return n - } - - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function howMuchToRead(n, state) { - if (n <= 0 || (state.length === 0 && state.ended)) return 0 - if (state.objectMode) return 1 - if (NumberIsNaN(n)) { - // Only flow one buffer at a time. - if (state.flowing && state.length) return state.buffer.first().length - return state.length - } - if (n <= state.length) return n - return state.ended ? state.length : 0 - } - - // You can override either this method, or the async _read(n) below. - Readable.prototype.read = function (n) { - debug('read', n) - // Same as parseInt(undefined, 10), however V8 7.3 performance regressed - // in this scenario, so we are doing it manually. - if (n === undefined) { - n = NaN - } else if (!NumberIsInteger(n)) { - n = NumberParseInt(n, 10) - } - const state = this._readableState - const nOrig = n - - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) - if (n !== 0) state.emittedReadable = false - - // If we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if ( - n === 0 && - state.needReadable && - ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) - ) { - debug('read: emitReadable', state.length, state.ended) - if (state.length === 0 && state.ended) endReadable(this) - else emitReadable(this) - return null - } - n = howMuchToRead(n, state) - - // If we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this) - return null + state.awaitDrainWriters = null } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - let doRead = state.needReadable - debug('need readable', doRead) - - // If we currently have less than the highWaterMark, then also read some. - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true - debug('length less than watermark', doRead) - } - - // However, if we've ended, then there's no point, if we're already - // reading, then it's unnecessary, if we're constructing we have to wait, - // and if we're destroyed or errored, then it's not allowed, - if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { - doRead = false - debug('reading, ended or constructing', doRead) - } else if (doRead) { - debug('do read') - state.reading = true - state.sync = true - // If the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true - - // Call internal read method - try { - this._read(state.highWaterMark) - } catch (err) { - errorOrDestroy(this, err) - } - state.sync = false - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state) + state.dataEmitted = true + stream.emit('data', chunk) + } else { + // Update the buffer info. + state.length += state.objectMode ? 1 : chunk.length + if (addToFront) state.buffer.unshift(chunk) + else state.buffer.push(chunk) + if (state.needReadable) emitReadable(stream) + } + maybeReadMore(stream, state) +} +Readable.prototype.isPaused = function () { + const state = this._readableState + return state[kPaused] === true || state.flowing === false +} + +// Backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + const decoder = new StringDecoder(enc) + this._readableState.decoder = decoder + // If setEncoding(null), decoder.encoding equals utf8. + this._readableState.encoding = this._readableState.decoder.encoding + const buffer = this._readableState.buffer + // Iterate over current buffer to convert already stored Buffers: + let content = '' + for (const data of buffer) { + content += decoder.write(data) + } + buffer.clear() + if (content !== '') buffer.push(content) + this._readableState.length = content.length + return this +} + +// Don't raise the hwm > 1GB. +const MAX_HWM = 0x40000000 +function computeNewHighWaterMark(n) { + if (n > MAX_HWM) { + throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts. + n-- + n |= n >>> 1 + n |= n >>> 2 + n |= n >>> 4 + n |= n >>> 8 + n |= n >>> 16 + n++ + } + return n +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || (state.length === 0 && state.ended)) return 0 + if (state.objectMode) return 1 + if (NumberIsNaN(n)) { + // Only flow one buffer at a time. + if (state.flowing && state.length) return state.buffer.first().length + return state.length + } + if (n <= state.length) return n + return state.ended ? state.length : 0 +} + +// You can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n) + // Same as parseInt(undefined, 10), however V8 7.3 performance regressed + // in this scenario, so we are doing it manually. + if (n === undefined) { + n = NaN + } else if (!NumberIsInteger(n)) { + n = NumberParseInt(n, 10) + } + const state = this._readableState + const nOrig = n + + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) + if (n !== 0) state.emittedReadable = false + + // If we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if ( + n === 0 && + state.needReadable && + ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) + ) { + debug('read: emitReadable', state.length, state.ended) + if (state.length === 0 && state.ended) endReadable(this) + else emitReadable(this) + return null + } + n = howMuchToRead(n, state) + + // If we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this) + return null + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + let doRead = state.needReadable + debug('need readable', doRead) + + // If we currently have less than the highWaterMark, then also read some. + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true + debug('length less than watermark', doRead) + } + + // However, if we've ended, then there's no point, if we're already + // reading, then it's unnecessary, if we're constructing we have to wait, + // and if we're destroyed or errored, then it's not allowed, + if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { + doRead = false + debug('reading, ended or constructing', doRead) + } else if (doRead) { + debug('do read') + state.reading = true + state.sync = true + // If the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true + + // Call internal read method + try { + this._read(state.highWaterMark) + } catch (err) { + errorOrDestroy(this, err) } - let ret - if (n > 0) ret = fromList(n, state) - else ret = null - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark - n = 0 + state.sync = false + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state) + } + let ret + if (n > 0) ret = fromList(n, state) + else ret = null + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark + n = 0 + } else { + state.length -= n + if (state.multiAwaitDrain) { + state.awaitDrainWriters.clear() } else { - state.length -= n - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } + state.awaitDrainWriters = null } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this) - } - if (ret !== null && !state.errorEmitted && !state.closeEmitted) { - state.dataEmitted = true - this.emit('data', ret) - } - return ret } - function onEofChunk(stream, state) { - debug('onEofChunk') - if (state.ended) return - if (state.decoder) { - const chunk = state.decoder.end() - if (chunk && chunk.length) { - state.buffer.push(chunk) - state.length += state.objectMode ? 1 : chunk.length - } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this) + } + if (ret !== null && !state.errorEmitted && !state.closeEmitted) { + state.dataEmitted = true + this.emit('data', ret) + } + return ret +} +function onEofChunk(stream, state) { + debug('onEofChunk') + if (state.ended) return + if (state.decoder) { + const chunk = state.decoder.end() + if (chunk && chunk.length) { + state.buffer.push(chunk) + state.length += state.objectMode ? 1 : chunk.length } - state.ended = true - if (state.sync) { - // If we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call. - emitReadable(stream) - } else { - // Emit 'readable' now to make sure it gets picked up. - state.needReadable = false - state.emittedReadable = true - // We have to emit readable now that we are EOF. Modules - // in the ecosystem (e.g. dicer) rely on this event being sync. - emitReadable_(stream) - } - } - - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - const state = stream._readableState - debug('emitReadable', state.needReadable, state.emittedReadable) + } + state.ended = true + if (state.sync) { + // If we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call. + emitReadable(stream) + } else { + // Emit 'readable' now to make sure it gets picked up. state.needReadable = false - if (!state.emittedReadable) { - debug('emitReadable', state.flowing) - state.emittedReadable = true - process.nextTick(emitReadable_, stream) - } + state.emittedReadable = true + // We have to emit readable now that we are EOF. Modules + // in the ecosystem (e.g. dicer) rely on this event being sync. + emitReadable_(stream) } - function emitReadable_(stream) { - const state = stream._readableState - debug('emitReadable_', state.destroyed, state.length, state.ended) - if (!state.destroyed && !state.errored && (state.length || state.ended)) { - stream.emit('readable') - state.emittedReadable = false - } - - // The stream needs another readable event if: - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark - flow(stream) - } - - // At this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore && state.constructed) { - state.readingMore = true - process.nextTick(maybeReadMore_, stream, state) - } - } - function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while ( - !state.reading && - !state.ended && - (state.length < state.highWaterMark || (state.flowing && state.length === 0)) - ) { - const len = state.length - debug('maybeReadMore read 0') - stream.read(0) - if (len === state.length) - // Didn't get any data, stop spinning. - break - } - state.readingMore = false - } - - // Abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function (n) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') - } - Readable.prototype.pipe = function (dest, pipeOpts) { - const src = this - const state = this._readableState - if (state.pipes.length === 1) { - if (!state.multiAwaitDrain) { - state.multiAwaitDrain = true - state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) - } - } - state.pipes.push(dest) - debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) - const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr - const endFn = doEnd ? onend : unpipe - if (state.endEmitted) process.nextTick(endFn) - else src.once('end', endFn) - dest.on('unpipe', onunpipe) - function onunpipe(readable, unpipeInfo) { - debug('onunpipe') - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true - cleanup() - } - } - } - function onend() { - debug('onend') - dest.end() - } - let ondrain - let cleanedUp = false - function cleanup() { - debug('cleanup') - // Cleanup event handlers once the pipe is broken. - dest.removeListener('close', onclose) - dest.removeListener('finish', onfinish) - if (ondrain) { - dest.removeListener('drain', ondrain) - } - dest.removeListener('error', onerror) - dest.removeListener('unpipe', onunpipe) - src.removeListener('end', onend) - src.removeListener('end', unpipe) - src.removeListener('data', ondata) - cleanedUp = true - - // If the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() - } - function pause() { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if (!cleanedUp) { - if (state.pipes.length === 1 && state.pipes[0] === dest) { - debug('false write response, pause', 0) - state.awaitDrainWriters = dest - state.multiAwaitDrain = false - } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { - debug('false write response, pause', state.awaitDrainWriters.size) - state.awaitDrainWriters.add(dest) - } - src.pause() - } - if (!ondrain) { - // When the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - ondrain = pipeOnDrain(src, dest) - dest.on('drain', ondrain) - } - } - src.on('data', ondata) - function ondata(chunk) { - debug('ondata') - const ret = dest.write(chunk) - debug('dest.write', ret) - if (ret === false) { - pause() - } - } - - // If the dest has an error, then stop piping into it. - // However, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er) - unpipe() - dest.removeListener('error', onerror) - if (dest.listenerCount('error') === 0) { - const s = dest._writableState || dest._readableState - if (s && !s.errorEmitted) { - // User incorrectly emitted 'error' directly on the stream. - errorOrDestroy(dest, er) - } else { - dest.emit('error', er) - } - } - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror) - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish) - unpipe() - } - dest.once('close', onclose) - function onfinish() { - debug('onfinish') - dest.removeListener('close', onclose) - unpipe() - } - dest.once('finish', onfinish) - function unpipe() { - debug('unpipe') - src.unpipe(dest) - } - - // Tell the dest that it's being piped to. - dest.emit('pipe', src) - - // Start the flow if it hasn't been started already. - - if (dest.writableNeedDrain === true) { - if (state.flowing) { - pause() - } - } else if (!state.flowing) { - debug('pipe resume') - src.resume() - } - return dest +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + const state = stream._readableState + debug('emitReadable', state.needReadable, state.emittedReadable) + state.needReadable = false + if (!state.emittedReadable) { + debug('emitReadable', state.flowing) + state.emittedReadable = true + process.nextTick(emitReadable_, stream) + } +} +function emitReadable_(stream) { + const state = stream._readableState + debug('emitReadable_', state.destroyed, state.length, state.ended) + if (!state.destroyed && !state.errored && (state.length || state.ended)) { + stream.emit('readable') + state.emittedReadable = false } - function pipeOnDrain(src, dest) { - return function pipeOnDrainFunctionResult() { - const state = src._readableState - - // `ondrain` will call directly, - // `this` maybe not a reference to dest, - // so we use the real dest here. - if (state.awaitDrainWriters === dest) { - debug('pipeOnDrain', 1) - state.awaitDrainWriters = null - } else if (state.multiAwaitDrain) { - debug('pipeOnDrain', state.awaitDrainWriters.size) - state.awaitDrainWriters.delete(dest) - } - if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { - src.resume() + + // The stream needs another readable event if: + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark + flow(stream) +} + +// At this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore && state.constructed) { + state.readingMore = true + process.nextTick(maybeReadMore_, stream, state) + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while ( + !state.reading && + !state.ended && + (state.length < state.highWaterMark || (state.flowing && state.length === 0)) + ) { + const len = state.length + debug('maybeReadMore read 0') + stream.read(0) + if (len === state.length) + // Didn't get any data, stop spinning. + break + } + state.readingMore = false +} + +// Abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') +} +Readable.prototype.pipe = function (dest, pipeOpts) { + const src = this + const state = this._readableState + if (state.pipes.length === 1) { + if (!state.multiAwaitDrain) { + state.multiAwaitDrain = true + state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) + } + } + state.pipes.push(dest) + debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) + const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr + const endFn = doEnd ? onend : unpipe + if (state.endEmitted) process.nextTick(endFn) + else src.once('end', endFn) + dest.on('unpipe', onunpipe) + function onunpipe(readable, unpipeInfo) { + debug('onunpipe') + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true + cleanup() } } } - Readable.prototype.unpipe = function (dest) { - const state = this._readableState - const unpipeInfo = { - hasUnpiped: false + function onend() { + debug('onend') + dest.end() + } + let ondrain + let cleanedUp = false + function cleanup() { + debug('cleanup') + // Cleanup event handlers once the pipe is broken. + dest.removeListener('close', onclose) + dest.removeListener('finish', onfinish) + if (ondrain) { + dest.removeListener('drain', ondrain) } - - // If we're not piping anywhere, then do nothing. - if (state.pipes.length === 0) return this - if (!dest) { - // remove all. - const dests = state.pipes - state.pipes = [] - this.pause() - for (let i = 0; i < dests.length; i++) - dests[i].emit('unpipe', this, { - hasUnpiped: false - }) - return this + dest.removeListener('error', onerror) + dest.removeListener('unpipe', onunpipe) + src.removeListener('end', onend) + src.removeListener('end', unpipe) + src.removeListener('data', ondata) + cleanedUp = true + + // If the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() + } + function pause() { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if (!cleanedUp) { + if (state.pipes.length === 1 && state.pipes[0] === dest) { + debug('false write response, pause', 0) + state.awaitDrainWriters = dest + state.multiAwaitDrain = false + } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { + debug('false write response, pause', state.awaitDrainWriters.size) + state.awaitDrainWriters.add(dest) + } + src.pause() + } + if (!ondrain) { + // When the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + ondrain = pipeOnDrain(src, dest) + dest.on('drain', ondrain) + } + } + src.on('data', ondata) + function ondata(chunk) { + debug('ondata') + const ret = dest.write(chunk) + debug('dest.write', ret) + if (ret === false) { + pause() } - - // Try to find the right one. - const index = ArrayPrototypeIndexOf(state.pipes, dest) - if (index === -1) return this - state.pipes.splice(index, 1) - if (state.pipes.length === 0) this.pause() - dest.emit('unpipe', this, unpipeInfo) - return this - } - - // Set up data events if they are asked for - // Ensure readable listeners eventually get something. - Readable.prototype.on = function (ev, fn) { - const res = Stream.prototype.on.call(this, ev, fn) - const state = this._readableState - if (ev === 'data') { - // Update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0 - - // Try start flowing on next tick if stream isn't explicitly paused. - if (state.flowing !== false) this.resume() - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true - state.flowing = false - state.emittedReadable = false - debug('on readable', state.length, state.reading) - if (state.length) { - emitReadable(this) - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this) - } - } - } - return res - } - Readable.prototype.addListener = Readable.prototype.on - Readable.prototype.removeListener = function (ev, fn) { - const res = Stream.prototype.removeListener.call(this, ev, fn) - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res - } - Readable.prototype.off = Readable.prototype.removeListener - Readable.prototype.removeAllListeners = function (ev) { - const res = Stream.prototype.removeAllListeners.apply(this, arguments) - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res - } - function updateReadableListening(self) { - const state = self._readableState - state.readableListening = self.listenerCount('readable') > 0 - if (state.resumeScheduled && state[kPaused] === false) { - // Flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true - - // Crude way to check if we should resume. - } else if (self.listenerCount('data') > 0) { - self.resume() - } else if (!state.readableListening) { - state.flowing = null - } - } - function nReadingNextTick(self) { - debug('readable nexttick read 0') - self.read(0) - } - - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function () { - const state = this._readableState - if (!state.flowing) { - debug('resume') - // We flow only if there is no one listening - // for readable, but we still have to call - // resume(). - state.flowing = !state.readableListening - resume(this, state) - } - state[kPaused] = false - return this } - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true - process.nextTick(resume_, stream, state) + + // If the dest has an error, then stop piping into it. + // However, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er) + unpipe() + dest.removeListener('error', onerror) + if (dest.listenerCount('error') === 0) { + const s = dest._writableState || dest._readableState + if (s && !s.errorEmitted) { + // User incorrectly emitted 'error' directly on the stream. + errorOrDestroy(dest, er) + } else { + dest.emit('error', er) + } } } - function resume_(stream, state) { - debug('resume', state.reading) - if (!state.reading) { - stream.read(0) - } - state.resumeScheduled = false - stream.emit('resume') - flow(stream) - if (state.flowing && !state.reading) stream.read(0) + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror) + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish) + unpipe() + } + dest.once('close', onclose) + function onfinish() { + debug('onfinish') + dest.removeListener('close', onclose) + unpipe() + } + dest.once('finish', onfinish) + function unpipe() { + debug('unpipe') + src.unpipe(dest) } - Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing) - if (this._readableState.flowing !== false) { - debug('pause') - this._readableState.flowing = false - this.emit('pause') + + // Tell the dest that it's being piped to. + dest.emit('pipe', src) + + // Start the flow if it hasn't been started already. + + if (dest.writableNeedDrain === true) { + if (state.flowing) { + pause() + } + } else if (!state.flowing) { + debug('pipe resume') + src.resume() + } + return dest +} +function pipeOnDrain(src, dest) { + return function pipeOnDrainFunctionResult() { + const state = src._readableState + + // `ondrain` will call directly, + // `this` maybe not a reference to dest, + // so we use the real dest here. + if (state.awaitDrainWriters === dest) { + debug('pipeOnDrain', 1) + state.awaitDrainWriters = null + } else if (state.multiAwaitDrain) { + debug('pipeOnDrain', state.awaitDrainWriters.size) + state.awaitDrainWriters.delete(dest) + } + if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { + src.resume() } - this._readableState[kPaused] = true + } +} +Readable.prototype.unpipe = function (dest) { + const state = this._readableState + const unpipeInfo = { + hasUnpiped: false + } + + // If we're not piping anywhere, then do nothing. + if (state.pipes.length === 0) return this + if (!dest) { + // remove all. + const dests = state.pipes + state.pipes = [] + this.pause() + for (let i = 0; i < dests.length; i++) + dests[i].emit('unpipe', this, { + hasUnpiped: false + }) return this } - function flow(stream) { - const state = stream._readableState - debug('flow', state.flowing) - while (state.flowing && stream.read() !== null); - } - - // Wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function (stream) { - let paused = false - - // TODO (ronag): Should this.destroy(err) emit - // 'error' on the wrapped stream? Would require - // a static factory method, e.g. Readable.wrap(stream). - - stream.on('data', (chunk) => { - if (!this.push(chunk) && stream.pause) { - paused = true - stream.pause() - } - }) - stream.on('end', () => { - this.push(null) - }) - stream.on('error', (err) => { - errorOrDestroy(this, err) - }) - stream.on('close', () => { - this.destroy() - }) - stream.on('destroy', () => { - this.destroy() - }) - this._read = () => { - if (paused && stream.resume) { - paused = false - stream.resume() - } + + // Try to find the right one. + const index = ArrayPrototypeIndexOf(state.pipes, dest) + if (index === -1) return this + state.pipes.splice(index, 1) + if (state.pipes.length === 0) this.pause() + dest.emit('unpipe', this, unpipeInfo) + return this +} + +// Set up data events if they are asked for +// Ensure readable listeners eventually get something. +Readable.prototype.on = function (ev, fn) { + const res = Stream.prototype.on.call(this, ev, fn) + const state = this._readableState + if (ev === 'data') { + // Update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0 + + // Try start flowing on next tick if stream isn't explicitly paused. + if (state.flowing !== false) this.resume() + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true + state.flowing = false + state.emittedReadable = false + debug('on readable', state.length, state.reading) + if (state.length) { + emitReadable(this) + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this) + } + } + } + return res +} +Readable.prototype.addListener = Readable.prototype.on +Readable.prototype.removeListener = function (ev, fn) { + const res = Stream.prototype.removeListener.call(this, ev, fn) + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this) + } + return res +} +Readable.prototype.off = Readable.prototype.removeListener +Readable.prototype.removeAllListeners = function (ev) { + const res = Stream.prototype.removeAllListeners.apply(this, arguments) + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this) + } + return res +} +function updateReadableListening(self) { + const state = self._readableState + state.readableListening = self.listenerCount('readable') > 0 + if (state.resumeScheduled && state[kPaused] === false) { + // Flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true + + // Crude way to check if we should resume. + } else if (self.listenerCount('data') > 0) { + self.resume() + } else if (!state.readableListening) { + state.flowing = null + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0') + self.read(0) +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + const state = this._readableState + if (!state.flowing) { + debug('resume') + // We flow only if there is no one listening + // for readable, but we still have to call + // resume(). + state.flowing = !state.readableListening + resume(this, state) + } + state[kPaused] = false + return this +} +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true + process.nextTick(resume_, stream, state) + } +} +function resume_(stream, state) { + debug('resume', state.reading) + if (!state.reading) { + stream.read(0) + } + state.resumeScheduled = false + stream.emit('resume') + flow(stream) + if (state.flowing && !state.reading) stream.read(0) +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing) + if (this._readableState.flowing !== false) { + debug('pause') + this._readableState.flowing = false + this.emit('pause') + } + this._readableState[kPaused] = true + return this +} +function flow(stream) { + const state = stream._readableState + debug('flow', state.flowing) + while (state.flowing && stream.read() !== null); +} + +// Wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + let paused = false + + // TODO (ronag): Should this.destroy(err) emit + // 'error' on the wrapped stream? Would require + // a static factory method, e.g. Readable.wrap(stream). + + stream.on('data', (chunk) => { + if (!this.push(chunk) && stream.pause) { + paused = true + stream.pause() } - - // Proxy all the other methods. Important when wrapping filters and duplexes. - const streamKeys = ObjectKeys(stream) - for (let j = 1; j < streamKeys.length; j++) { - const i = streamKeys[j] - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = stream[i].bind(stream) - } + }) + stream.on('end', () => { + this.push(null) + }) + stream.on('error', (err) => { + errorOrDestroy(this, err) + }) + stream.on('close', () => { + this.destroy() + }) + stream.on('destroy', () => { + this.destroy() + }) + this._read = () => { + if (paused && stream.resume) { + paused = false + stream.resume() } - return this } - Readable.prototype[SymbolAsyncIterator] = function () { - return streamToAsyncIterator(this) + + // Proxy all the other methods. Important when wrapping filters and duplexes. + const streamKeys = ObjectKeys(stream) + for (let j = 1; j < streamKeys.length; j++) { + const i = streamKeys[j] + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = stream[i].bind(stream) + } + } + return this +} +Readable.prototype[SymbolAsyncIterator] = function () { + return streamToAsyncIterator(this) +} +Readable.prototype.iterator = function (options) { + if (options !== undefined) { + validateObject(options, 'options') + } + return streamToAsyncIterator(this, options) +} +function streamToAsyncIterator(stream, options) { + if (typeof stream.read !== 'function') { + stream = Readable.wrap(stream, { + objectMode: true + }) } - Readable.prototype.iterator = function (options) { - if (options !== undefined) { - validateObject(options, 'options') + const iter = createAsyncIterator(stream, options) + iter.stream = stream + return iter +} +async function* createAsyncIterator(stream, options) { + let callback = nop + function next(resolve) { + if (this === stream) { + callback() + callback = nop + } else { + callback = resolve } - return streamToAsyncIterator(this, options) } - function streamToAsyncIterator(stream, options) { - if (typeof stream.read !== 'function') { - stream = Readable.wrap(stream, { - objectMode: true - }) + stream.on('readable', next) + let error + const cleanup = eos( + stream, + { + writable: false + }, + (err) => { + error = err ? aggregateTwoErrors(error, err) : null + callback() + callback = nop } - const iter = createAsyncIterator(stream, options) - iter.stream = stream - return iter - } - async function* createAsyncIterator(stream, options) { - let callback = nop - function next(resolve) { - if (this === stream) { - callback() - callback = nop + ) + try { + while (true) { + const chunk = stream.destroyed ? null : stream.read() + if (chunk !== null) { + yield chunk + } else if (error) { + throw error + } else if (error === null) { + return } else { - callback = resolve + await new Promise(next) } } - stream.on('readable', next) - let error - const cleanup = eos( - stream, - { - writable: false - }, - (err) => { - error = err ? aggregateTwoErrors(error, err) : null - callback() - callback = nop - } - ) - try { - while (true) { - const chunk = stream.destroyed ? null : stream.read() - if (chunk !== null) { - yield chunk - } else if (error) { - throw error - } else if (error === null) { - return - } else { - await new Promise(next) - } - } - } catch (err) { - error = aggregateTwoErrors(error, err) - throw error - } finally { - if ( - (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && - (error === undefined || stream._readableState.autoDestroy) - ) { - destroyImpl.destroyer(stream, null) - } else { - stream.off('readable', next) - cleanup() - } + } catch (err) { + error = aggregateTwoErrors(error, err) + throw error + } finally { + if ( + (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && + (error === undefined || stream._readableState.autoDestroy) + ) { + destroyImpl.destroyer(stream, null) + } else { + stream.off('readable', next) + cleanup() } } - - // Making it explicit these properties are not enumerable - // because otherwise some prototype manipulation in - // userland will fail. - ObjectDefineProperties(Readable.prototype, { - readable: { - __proto__: null, - get() { - const r = this._readableState - // r.readable === false means that this is part of a Duplex stream - // where the readable side was disabled upon construction. - // Compat. The user might manually disable readable side through - // deprecated setter. - return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted - }, - set(val) { - // Backwards compat. - if (this._readableState) { - this._readableState.readable = !!val - } - } - }, - readableDidRead: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.dataEmitted - } - }, - readableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._readableState.readable !== false && - (this._readableState.destroyed || this._readableState.errored) && - !this._readableState.endEmitted - ) - } - }, - readableHighWaterMark: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.highWaterMark - } - }, - readableBuffer: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState && this._readableState.buffer - } - }, - readableFlowing: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.flowing - }, - set: function (state) { - if (this._readableState) { - this._readableState.flowing = state - } - } - }, - readableLength: { - __proto__: null, - enumerable: false, - get() { - return this._readableState.length - } - }, - readableObjectMode: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.objectMode : false - } - }, - readableEncoding: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.encoding : null - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.errored : null - } - }, - closed: { - __proto__: null, - get() { - return this._readableState ? this._readableState.closed : false - } - }, - destroyed: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.destroyed : false - }, - set(value) { - // We ignore the value if the stream - // has not been initialized yet. - if (!this._readableState) { - return - } - - // Backward compatibility, the user is explicitly - // managing destroyed. - this._readableState.destroyed = value +} + +// Making it explicit these properties are not enumerable +// because otherwise some prototype manipulation in +// userland will fail. +ObjectDefineProperties(Readable.prototype, { + readable: { + __proto__: null, + get() { + const r = this._readableState + // r.readable === false means that this is part of a Duplex stream + // where the readable side was disabled upon construction. + // Compat. The user might manually disable readable side through + // deprecated setter. + return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted + }, + set(val) { + // Backwards compat. + if (this._readableState) { + this._readableState.readable = !!val } + } + }, + readableDidRead: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.dataEmitted + } + }, + readableAborted: { + __proto__: null, + enumerable: false, + get: function () { + return !!( + this._readableState.readable !== false && + (this._readableState.destroyed || this._readableState.errored) && + !this._readableState.endEmitted + ) + } + }, + readableHighWaterMark: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.highWaterMark + } + }, + readableBuffer: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState && this._readableState.buffer + } + }, + readableFlowing: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.flowing }, - readableEnded: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.endEmitted : false + set: function (state) { + if (this._readableState) { + this._readableState.flowing = state } } - }) - ObjectDefineProperties(ReadableState.prototype, { - // Legacy getter for `pipesCount`. - pipesCount: { - __proto__: null, - get() { - return this.pipes.length - } + }, + readableLength: { + __proto__: null, + enumerable: false, + get() { + return this._readableState.length + } + }, + readableObjectMode: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.objectMode : false + } + }, + readableEncoding: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.encoding : null + } + }, + errored: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.errored : null + } + }, + closed: { + __proto__: null, + get() { + return this._readableState ? this._readableState.closed : false + } + }, + destroyed: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.destroyed : false }, - // Legacy property for `paused`. - paused: { - __proto__: null, - get() { - return this[kPaused] !== false - }, - set(value) { - this[kPaused] = !!value + set(value) { + // We ignore the value if the stream + // has not been initialized yet. + if (!this._readableState) { + return } + + // Backward compatibility, the user is explicitly + // managing destroyed. + this._readableState.destroyed = value } - }) - - // Exposed for testing purposes only. - Readable._fromList = fromList - - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromList(n, state) { - // nothing buffered. - if (state.length === 0) return null - let ret - if (state.objectMode) ret = state.buffer.shift() - else if (!n || n >= state.length) { - // Read it all, truncate the list. - if (state.decoder) ret = state.buffer.join('') - else if (state.buffer.length === 1) ret = state.buffer.first() - else ret = state.buffer.concat(state.length) - state.buffer.clear() - } else { - // read part of list. - ret = state.buffer.consume(n, state.decoder) + }, + readableEnded: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.endEmitted : false } - return ret } - function endReadable(stream) { - const state = stream._readableState - debug('endReadable', state.endEmitted) - if (!state.endEmitted) { - state.ended = true - process.nextTick(endReadableNT, state, stream) - } - } - function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length) - - // Check that we didn't get one last unshift. - if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { - state.endEmitted = true - stream.emit('end') - if (stream.writable && stream.allowHalfOpen === false) { - process.nextTick(endWritableNT, stream) - } else if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well. - const wState = stream._writableState - const autoDestroy = - !wState || - (wState.autoDestroy && - // We don't expect the writable to ever 'finish' - // if writable is explicitly set to false. - (wState.finished || wState.writable === false)) - if (autoDestroy) { - stream.destroy() - } - } +}) +ObjectDefineProperties(ReadableState.prototype, { + // Legacy getter for `pipesCount`. + pipesCount: { + __proto__: null, + get() { + return this.pipes.length } - } - function endWritableNT(stream) { - const writable = stream.writable && !stream.writableEnded && !stream.destroyed - if (writable) { - stream.end() + }, + // Legacy property for `paused`. + paused: { + __proto__: null, + get() { + return this[kPaused] !== false + }, + set(value) { + this[kPaused] = !!value } } - Readable.from = function (iterable, opts) { - return from(Readable, iterable, opts) +}) + +// Exposed for testing purposes only. +Readable._fromList = fromList + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered. + if (state.length === 0) return null + let ret + if (state.objectMode) ret = state.buffer.shift() + else if (!n || n >= state.length) { + // Read it all, truncate the list. + if (state.decoder) ret = state.buffer.join('') + else if (state.buffer.length === 1) ret = state.buffer.first() + else ret = state.buffer.concat(state.length) + state.buffer.clear() + } else { + // read part of list. + ret = state.buffer.consume(n, state.decoder) + } + return ret +} +function endReadable(stream) { + const state = stream._readableState + debug('endReadable', state.endEmitted) + if (!state.endEmitted) { + state.ended = true + process.nextTick(endReadableNT, state, stream) } - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length) + + // Check that we didn't get one last unshift. + if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { + state.endEmitted = true + stream.emit('end') + if (stream.writable && stream.allowHalfOpen === false) { + process.nextTick(endWritableNT, stream) + } else if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well. + const wState = stream._writableState + const autoDestroy = + !wState || + (wState.autoDestroy && + // We don't expect the writable to ever 'finish' + // if writable is explicitly set to false. + (wState.finished || wState.writable === false)) + if (autoDestroy) { + stream.destroy() + } + } } - Readable.fromWeb = function (readableStream, options) { - return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) +} +function endWritableNT(stream) { + const writable = stream.writable && !stream.writableEnded && !stream.destroyed + if (writable) { + stream.end() } - Readable.toWeb = function (streamReadable, options) { - return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) +} +Readable.from = function (iterable, opts) { + return from(Readable, iterable, opts) +} +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Readable.fromWeb = function (readableStream, options) { + return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) +} +Readable.toWeb = function (streamReadable, options) { + return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) +} +Readable.wrap = function (src, options) { + var _ref, _src$readableObjectMo + return new Readable({ + objectMode: + (_ref = + (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined + ? _src$readableObjectMo + : src.objectMode) !== null && _ref !== undefined + ? _ref + : true, + ...options, + destroy(err, callback) { + destroyImpl.destroyer(src, err) + callback(err) + } + }).wrap(src) +} + + +/***/ }), + +/***/ 43617: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { MathFloor, NumberIsInteger } = __webpack_require__(78969) +const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(57186).codes) +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null +} +function getDefaultHighWaterMark(objectMode) { + return objectMode ? 16 : 16 * 1024 +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) + if (hwm != null) { + if (!NumberIsInteger(hwm) || hwm < 0) { + const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' + throw new ERR_INVALID_ARG_VALUE(name, hwm) + } + return MathFloor(hwm) } - Readable.wrap = function (src, options) { - var _ref, _src$readableObjectMo - return new Readable({ - objectMode: - (_ref = - (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined - ? _src$readableObjectMo - : src.objectMode) !== null && _ref !== undefined - ? _ref - : true, + + // Default value + return getDefaultHighWaterMark(state.objectMode) +} +module.exports = { + getHighWaterMark, + getDefaultHighWaterMark +} + + +/***/ }), + +/***/ 51314: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(78969) +module.exports = Transform +const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(57186).codes) +const Duplex = __webpack_require__(56725) +const { getHighWaterMark } = __webpack_require__(43617) +ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) +ObjectSetPrototypeOf(Transform, Duplex) +const kCallback = Symbol('kCallback') +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options) + + // TODO (ronag): This should preferably always be + // applied but would be semver-major. Or even better; + // make Transform a Readable with the Writable interface. + const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null + if (readableHighWaterMark === 0) { + // A Duplex will buffer both on the writable and readable side while + // a Transform just wants to buffer hwm number of elements. To avoid + // buffering twice we disable buffering on the writable side. + options = { ...options, - destroy(err, callback) { - destroyImpl.destroyer(src, err) - callback(err) - } - }).wrap(src) - } - - - /***/ }), - - /***/ 43617: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { MathFloor, NumberIsInteger } = __webpack_require__(78969) - const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(57186).codes) - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null - } - function getDefaultHighWaterMark(objectMode) { - return objectMode ? 16 : 16 * 1024 - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) - if (hwm != null) { - if (!NumberIsInteger(hwm) || hwm < 0) { - const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' - throw new ERR_INVALID_ARG_VALUE(name, hwm) - } - return MathFloor(hwm) - } - - // Default value - return getDefaultHighWaterMark(state.objectMode) - } - module.exports = { - getHighWaterMark, - getDefaultHighWaterMark - } - - - /***/ }), - - /***/ 51314: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. - - - - const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(78969) - module.exports = Transform - const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(57186).codes) - const Duplex = __webpack_require__(56725) - const { getHighWaterMark } = __webpack_require__(43617) - ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) - ObjectSetPrototypeOf(Transform, Duplex) - const kCallback = Symbol('kCallback') - function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options) - - // TODO (ronag): This should preferably always be - // applied but would be semver-major. Or even better; - // make Transform a Readable with the Writable interface. - const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null - if (readableHighWaterMark === 0) { - // A Duplex will buffer both on the writable and readable side while - // a Transform just wants to buffer hwm number of elements. To avoid - // buffering twice we disable buffering on the writable side. - options = { - ...options, - highWaterMark: null, - readableHighWaterMark, - // TODO (ronag): 0 is not optimal since we have - // a "bug" where we check needDrain before calling _write and not after. - // Refs: https://github.com/nodejs/node/pull/32887 - // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: options.writableHighWaterMark || 0 - } - } - Duplex.call(this, options) - - // We have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false - this[kCallback] = null - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform - if (typeof options.flush === 'function') this._flush = options.flush - } - - // When the writable side finishes, then flush out anything remaining. - // Backwards compat. Some Transform streams incorrectly implement _final - // instead of or in addition to _flush. By using 'prefinish' instead of - // implementing _final we continue supporting this unfortunate use case. - this.on('prefinish', prefinish) - } - function final(cb) { - if (typeof this._flush === 'function' && !this.destroyed) { - this._flush((er, data) => { - if (er) { - if (cb) { - cb(er) - } else { - this.destroy(er) - } - return - } - if (data != null) { - this.push(data) - } - this.push(null) - if (cb) { - cb() - } - }) - } else { - this.push(null) - if (cb) { - cb() - } + highWaterMark: null, + readableHighWaterMark, + // TODO (ronag): 0 is not optimal since we have + // a "bug" where we check needDrain before calling _write and not after. + // Refs: https://github.com/nodejs/node/pull/32887 + // Refs: https://github.com/nodejs/node/pull/35941 + writableHighWaterMark: options.writableHighWaterMark || 0 } } - function prefinish() { - if (this._final !== final) { - final.call(this) - } - } - Transform.prototype._final = final - Transform.prototype._transform = function (chunk, encoding, callback) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') + Duplex.call(this, options) + + // We have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false + this[kCallback] = null + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform + if (typeof options.flush === 'function') this._flush = options.flush } - Transform.prototype._write = function (chunk, encoding, callback) { - const rState = this._readableState - const wState = this._writableState - const length = rState.length - this._transform(chunk, encoding, (err, val) => { - if (err) { - callback(err) + + // When the writable side finishes, then flush out anything remaining. + // Backwards compat. Some Transform streams incorrectly implement _final + // instead of or in addition to _flush. By using 'prefinish' instead of + // implementing _final we continue supporting this unfortunate use case. + this.on('prefinish', prefinish) +} +function final(cb) { + if (typeof this._flush === 'function' && !this.destroyed) { + this._flush((er, data) => { + if (er) { + if (cb) { + cb(er) + } else { + this.destroy(er) + } return } - if (val != null) { - this.push(val) + if (data != null) { + this.push(data) } - if ( - wState.ended || - // Backwards compat. - length === rState.length || - // Backwards compat. - rState.length < rState.highWaterMark - ) { - callback() - } else { - this[kCallback] = callback + this.push(null) + if (cb) { + cb() } }) + } else { + this.push(null) + if (cb) { + cb() + } } - Transform.prototype._read = function () { - if (this[kCallback]) { - const callback = this[kCallback] - this[kCallback] = null +} +function prefinish() { + if (this._final !== final) { + final.call(this) + } +} +Transform.prototype._final = final +Transform.prototype._transform = function (chunk, encoding, callback) { + throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') +} +Transform.prototype._write = function (chunk, encoding, callback) { + const rState = this._readableState + const wState = this._writableState + const length = rState.length + this._transform(chunk, encoding, (err, val) => { + if (err) { + callback(err) + return + } + if (val != null) { + this.push(val) + } + if ( + wState.ended || + // Backwards compat. + length === rState.length || + // Backwards compat. + rState.length < rState.highWaterMark + ) { callback() + } else { + this[kCallback] = callback } + }) +} +Transform.prototype._read = function () { + if (this[kCallback]) { + const callback = this[kCallback] + this[kCallback] = null + callback() } - - - /***/ }), - - /***/ 19654: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { Symbol, SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(78969) - const kDestroyed = Symbol('kDestroyed') - const kIsErrored = Symbol('kIsErrored') - const kIsReadable = Symbol('kIsReadable') - const kIsDisturbed = Symbol('kIsDisturbed') - const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') - const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') - function isReadableNodeStream(obj, strict = false) { - var _obj$_readableState - return !!( - ( - obj && - typeof obj.pipe === 'function' && - typeof obj.on === 'function' && - (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && - (!obj._writableState || - ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined - ? undefined - : _obj$_readableState.readable) !== false) && - // Duplex - (!obj._writableState || obj._readableState) - ) // Writable has .pipe. - ) - } - - function isWritableNodeStream(obj) { - var _obj$_writableState - return !!( - ( - obj && - typeof obj.write === 'function' && - typeof obj.on === 'function' && - (!obj._readableState || - ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined - ? undefined - : _obj$_writableState.writable) !== false) - ) // Duplex - ) - } - - function isDuplexNodeStream(obj) { - return !!( +} + + +/***/ }), + +/***/ 19654: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { Symbol, SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(78969) +const kDestroyed = Symbol('kDestroyed') +const kIsErrored = Symbol('kIsErrored') +const kIsReadable = Symbol('kIsReadable') +const kIsDisturbed = Symbol('kIsDisturbed') +const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') +const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') +function isReadableNodeStream(obj, strict = false) { + var _obj$_readableState + return !!( + ( obj && typeof obj.pipe === 'function' && - obj._readableState && typeof obj.on === 'function' && - typeof obj.write === 'function' - ) - } - function isNodeStream(obj) { - return ( - obj && - (obj._readableState || - obj._writableState || - (typeof obj.write === 'function' && typeof obj.on === 'function') || - (typeof obj.pipe === 'function' && typeof obj.on === 'function')) - ) - } - function isReadableStream(obj) { - return !!( + (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && + (!obj._writableState || + ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined + ? undefined + : _obj$_readableState.readable) !== false) && + // Duplex + (!obj._writableState || obj._readableState) + ) // Writable has .pipe. + ) +} + +function isWritableNodeStream(obj) { + var _obj$_writableState + return !!( + ( obj && - !isNodeStream(obj) && - typeof obj.pipeThrough === 'function' && - typeof obj.getReader === 'function' && - typeof obj.cancel === 'function' - ) - } - function isWritableStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') - } - function isTransformStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') - } - function isWebStream(obj) { - return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) - } - function isIterable(obj, isAsync) { - if (obj == null) return false - if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' - if (isAsync === false) return typeof obj[SymbolIterator] === 'function' - return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' + typeof obj.write === 'function' && + typeof obj.on === 'function' && + (!obj._readableState || + ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined + ? undefined + : _obj$_writableState.writable) !== false) + ) // Duplex + ) +} + +function isDuplexNodeStream(obj) { + return !!( + obj && + typeof obj.pipe === 'function' && + obj._readableState && + typeof obj.on === 'function' && + typeof obj.write === 'function' + ) +} +function isNodeStream(obj) { + return ( + obj && + (obj._readableState || + obj._writableState || + (typeof obj.write === 'function' && typeof obj.on === 'function') || + (typeof obj.pipe === 'function' && typeof obj.on === 'function')) + ) +} +function isReadableStream(obj) { + return !!( + obj && + !isNodeStream(obj) && + typeof obj.pipeThrough === 'function' && + typeof obj.getReader === 'function' && + typeof obj.cancel === 'function' + ) +} +function isWritableStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') +} +function isTransformStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') +} +function isWebStream(obj) { + return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) +} +function isIterable(obj, isAsync) { + if (obj == null) return false + if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' + if (isAsync === false) return typeof obj[SymbolIterator] === 'function' + return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' +} +function isDestroyed(stream) { + if (!isNodeStream(stream)) return null + const wState = stream._writableState + const rState = stream._readableState + const state = wState || rState + return !!(stream.destroyed || stream[kDestroyed] || (state !== null && state !== undefined && state.destroyed)) +} + +// Have been end():d. +function isWritableEnded(stream) { + if (!isWritableNodeStream(stream)) return null + if (stream.writableEnded === true) return true + const wState = stream._writableState + if (wState !== null && wState !== undefined && wState.errored) return false + if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null + return wState.ended +} + +// Have emitted 'finish'. +function isWritableFinished(stream, strict) { + if (!isWritableNodeStream(stream)) return null + if (stream.writableFinished === true) return true + const wState = stream._writableState + if (wState !== null && wState !== undefined && wState.errored) return false + if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null + return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) +} + +// Have been push(null):d. +function isReadableEnded(stream) { + if (!isReadableNodeStream(stream)) return null + if (stream.readableEnded === true) return true + const rState = stream._readableState + if (!rState || rState.errored) return false + if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null + return rState.ended +} + +// Have emitted 'end'. +function isReadableFinished(stream, strict) { + if (!isReadableNodeStream(stream)) return null + const rState = stream._readableState + if (rState !== null && rState !== undefined && rState.errored) return false + if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null + return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) +} +function isReadable(stream) { + if (stream && stream[kIsReadable] != null) return stream[kIsReadable] + if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null + if (isDestroyed(stream)) return false + return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) +} +function isWritable(stream) { + if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null + if (isDestroyed(stream)) return false + return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) +} +function isFinished(stream, opts) { + if (!isNodeStream(stream)) { + return null } - function isDestroyed(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return !!(stream.destroyed || stream[kDestroyed] || (state !== null && state !== undefined && state.destroyed)) - } - - // Have been end():d. - function isWritableEnded(stream) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableEnded === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null - return wState.ended - } - - // Have emitted 'finish'. - function isWritableFinished(stream, strict) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableFinished === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null - return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) - } - - // Have been push(null):d. - function isReadableEnded(stream) { - if (!isReadableNodeStream(stream)) return null - if (stream.readableEnded === true) return true - const rState = stream._readableState - if (!rState || rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null - return rState.ended - } - - // Have emitted 'end'. - function isReadableFinished(stream, strict) { - if (!isReadableNodeStream(stream)) return null - const rState = stream._readableState - if (rState !== null && rState !== undefined && rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null - return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) - } - function isReadable(stream) { - if (stream && stream[kIsReadable] != null) return stream[kIsReadable] - if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) - } - function isWritable(stream) { - if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) - } - function isFinished(stream, opts) { - if (!isNodeStream(stream)) { - return null - } - if (isDestroyed(stream)) { - return true - } - if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { - return false - } - if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { - return false - } + if (isDestroyed(stream)) { return true } - function isWritableErrored(stream) { - var _stream$_writableStat, _stream$_writableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.writableErrored) { - return stream.writableErrored - } - return (_stream$_writableStat = - (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined - ? undefined - : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined - ? _stream$_writableStat - : null + if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { + return false } - function isReadableErrored(stream) { - var _stream$_readableStat, _stream$_readableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.readableErrored) { - return stream.readableErrored - } - return (_stream$_readableStat = - (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined - ? undefined - : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined - ? _stream$_readableStat - : null + if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { + return false } - function isClosed(stream) { - if (!isNodeStream(stream)) { - return null - } - if (typeof stream.closed === 'boolean') { - return stream.closed - } - const wState = stream._writableState - const rState = stream._readableState - if ( - typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || - typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' - ) { - return ( - (wState === null || wState === undefined ? undefined : wState.closed) || - (rState === null || rState === undefined ? undefined : rState.closed) - ) - } - if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { - return stream._closed - } + return true +} +function isWritableErrored(stream) { + var _stream$_writableStat, _stream$_writableStat2 + if (!isNodeStream(stream)) { return null } - function isOutgoingMessage(stream) { - return ( - typeof stream._closed === 'boolean' && - typeof stream._defaultKeepAlive === 'boolean' && - typeof stream._removedConnection === 'boolean' && - typeof stream._removedContLen === 'boolean' - ) + if (stream.writableErrored) { + return stream.writableErrored + } + return (_stream$_writableStat = + (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined + ? undefined + : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined + ? _stream$_writableStat + : null +} +function isReadableErrored(stream) { + var _stream$_readableStat, _stream$_readableStat2 + if (!isNodeStream(stream)) { + return null } - function isServerResponse(stream) { - return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) + if (stream.readableErrored) { + return stream.readableErrored + } + return (_stream$_readableStat = + (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined + ? undefined + : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined + ? _stream$_readableStat + : null +} +function isClosed(stream) { + if (!isNodeStream(stream)) { + return null } - function isServerRequest(stream) { - var _stream$req - return ( - typeof stream._consuming === 'boolean' && - typeof stream._dumped === 'boolean' && - ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === - undefined - ) + if (typeof stream.closed === 'boolean') { + return stream.closed } - function willEmitClose(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState + const wState = stream._writableState + const rState = stream._readableState + if ( + typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || + typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' + ) { return ( - (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) + (wState === null || wState === undefined ? undefined : wState.closed) || + (rState === null || rState === undefined ? undefined : rState.closed) ) } - function isDisturbed(stream) { - var _stream$kIsDisturbed - return !!( - stream && - ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined - ? _stream$kIsDisturbed - : stream.readableDidRead || stream.readableAborted) - ) - } - function isErrored(stream) { - var _ref, - _ref2, - _ref3, - _ref4, - _ref5, - _stream$kIsErrored, - _stream$_readableStat3, - _stream$_writableStat3, - _stream$_readableStat4, - _stream$_writableStat4 - return !!( - stream && - ((_ref = - (_ref2 = - (_ref3 = - (_ref4 = - (_ref5 = - (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined - ? _stream$kIsErrored - : stream.readableErrored) !== null && _ref5 !== undefined - ? _ref5 - : stream.writableErrored) !== null && _ref4 !== undefined - ? _ref4 - : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined - ? undefined - : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined - ? _ref3 - : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined + if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { + return stream._closed + } + return null +} +function isOutgoingMessage(stream) { + return ( + typeof stream._closed === 'boolean' && + typeof stream._defaultKeepAlive === 'boolean' && + typeof stream._removedConnection === 'boolean' && + typeof stream._removedContLen === 'boolean' + ) +} +function isServerResponse(stream) { + return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) +} +function isServerRequest(stream) { + var _stream$req + return ( + typeof stream._consuming === 'boolean' && + typeof stream._dumped === 'boolean' && + ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === + undefined + ) +} +function willEmitClose(stream) { + if (!isNodeStream(stream)) return null + const wState = stream._writableState + const rState = stream._readableState + const state = wState || rState + return ( + (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) + ) +} +function isDisturbed(stream) { + var _stream$kIsDisturbed + return !!( + stream && + ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined + ? _stream$kIsDisturbed + : stream.readableDidRead || stream.readableAborted) + ) +} +function isErrored(stream) { + var _ref, + _ref2, + _ref3, + _ref4, + _ref5, + _stream$kIsErrored, + _stream$_readableStat3, + _stream$_writableStat3, + _stream$_readableStat4, + _stream$_writableStat4 + return !!( + stream && + ((_ref = + (_ref2 = + (_ref3 = + (_ref4 = + (_ref5 = + (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined + ? _stream$kIsErrored + : stream.readableErrored) !== null && _ref5 !== undefined + ? _ref5 + : stream.writableErrored) !== null && _ref4 !== undefined + ? _ref4 + : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined ? undefined - : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined - ? _ref2 - : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined + : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined + ? _ref3 + : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined ? undefined - : _stream$_readableStat4.errored) !== null && _ref !== undefined - ? _ref - : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined + : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined + ? _ref2 + : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined ? undefined - : _stream$_writableStat4.errored) - ) - } - module.exports = { - kDestroyed, - isDisturbed, - kIsDisturbed, - isErrored, - kIsErrored, - isReadable, - kIsReadable, - kIsClosedPromise, - kControllerErrorFunction, - isClosed, - isDestroyed, - isDuplexNodeStream, - isFinished, - isIterable, - isReadableNodeStream, - isReadableStream, - isReadableEnded, - isReadableFinished, - isReadableErrored, - isNodeStream, - isWebStream, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableEnded, - isWritableFinished, - isWritableErrored, - isServerRequest, - isServerResponse, - willEmitClose, - isTransformStream - } - - - /***/ }), - - /***/ 7282: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // 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. - - // A bit simpler than readable streams. - // Implement an async ._write(chunk, encoding, cb), and it'll handle all - // the drain event emission and buffering. - - ;('use strict') - const { - ArrayPrototypeSlice, - Error, - FunctionPrototypeSymbolHasInstance, - ObjectDefineProperty, - ObjectDefineProperties, - ObjectSetPrototypeOf, - StringPrototypeToLowerCase, - Symbol, - SymbolHasInstance - } = __webpack_require__(78969) - module.exports = Writable - Writable.WritableState = WritableState - const { EventEmitter: EE } = __webpack_require__(5939) - const Stream = (__webpack_require__(94965).Stream) - const { Buffer } = __webpack_require__(2486) - const destroyImpl = __webpack_require__(79638) - const { addAbortSignal } = __webpack_require__(7445) - const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(43617) - const { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED, - ERR_STREAM_ALREADY_FINISHED, - ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING - } = (__webpack_require__(57186).codes) - const { errorOrDestroy } = destroyImpl - ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) - ObjectSetPrototypeOf(Writable, Stream) - function nop() {} - const kOnFinished = Symbol('kOnFinished') - function WritableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(56725) - - // Object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) - - // The point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write(). - this.highWaterMark = options - ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // if _final has been called. - this.finalCalled = false - - // drain event flag. - this.needDrain = false - // At the start of calling end() - this.ending = false - // When end() has been called, and returned. - this.ended = false - // When 'finish' is emitted. - this.finished = false - - // Has it been destroyed - this.destroyed = false - - // Should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - const noDecode = !!(options && options.decodeStrings === false) - this.decodeStrings = !noDecode - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0 - - // A flag to see when we're in the middle of a write. - this.writing = false - - // When true all writes will be buffered until .uncork() call. - this.corked = 0 - - // A flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true - - // A flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false - - // The callback that's passed to _write(chunk, cb). - this.onwrite = onwrite.bind(undefined, stream) - - // The callback that the user supplies to write(chunk, encoding, cb). - this.writecb = null - - // The amount that is being written when _write is called. - this.writelen = 0 - - // Storage for data passed to the afterWrite() callback in case of - // synchronous _write() completion. - this.afterWriteTickInfo = null - resetBuffer(this) - - // Number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted. - this.pendingcb = 0 - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // Emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams. - this.prefinished = false - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'finish' (and potentially 'end'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Indicates whether the stream has errored. When true all write() calls - // should return false. This is needed since when autoDestroy - // is disabled we need a way to tell whether the stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - this[kOnFinished] = [] - } - function resetBuffer(state) { - state.buffered = [] - state.bufferedIndex = 0 - state.allBuffers = true - state.allNoop = true - } - WritableState.prototype.getBuffer = function getBuffer() { - return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) - } - ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { - __proto__: null, - get() { - return this.buffered.length - this.bufferedIndex - } - }) - function Writable(options) { - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(56725) - if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) - this._writableState = new WritableState(options, this, isDuplex) - if (options) { - if (typeof options.write === 'function') this._write = options.write - if (typeof options.writev === 'function') this._writev = options.writev - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.final === 'function') this._final = options.final - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - const state = this._writableState - if (!state.writing) { - clearBuffer(this, state) - } - finishMaybe(this, state) - }) - } - ObjectDefineProperty(Writable, SymbolHasInstance, { - __proto__: null, - value: function (object) { - if (FunctionPrototypeSymbolHasInstance(this, object)) return true - if (this !== Writable) return false - return object && object._writableState instanceof WritableState + : _stream$_readableStat4.errored) !== null && _ref !== undefined + ? _ref + : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined + ? undefined + : _stream$_writableStat4.errored) + ) +} +module.exports = { + kDestroyed, + isDisturbed, + kIsDisturbed, + isErrored, + kIsErrored, + isReadable, + kIsReadable, + kIsClosedPromise, + kControllerErrorFunction, + isClosed, + isDestroyed, + isDuplexNodeStream, + isFinished, + isIterable, + isReadableNodeStream, + isReadableStream, + isReadableEnded, + isReadableFinished, + isReadableErrored, + isNodeStream, + isWebStream, + isWritable, + isWritableNodeStream, + isWritableStream, + isWritableEnded, + isWritableFinished, + isWritableErrored, + isServerRequest, + isServerResponse, + willEmitClose, + isTransformStream +} + + +/***/ }), + +/***/ 7282: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +;('use strict') +const { + ArrayPrototypeSlice, + Error, + FunctionPrototypeSymbolHasInstance, + ObjectDefineProperty, + ObjectDefineProperties, + ObjectSetPrototypeOf, + StringPrototypeToLowerCase, + Symbol, + SymbolHasInstance +} = __webpack_require__(78969) +module.exports = Writable +Writable.WritableState = WritableState +const { EventEmitter: EE } = __webpack_require__(5939) +const Stream = (__webpack_require__(94965).Stream) +const { Buffer } = __webpack_require__(2486) +const destroyImpl = __webpack_require__(79638) +const { addAbortSignal } = __webpack_require__(7445) +const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(43617) +const { + ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED, + ERR_STREAM_ALREADY_FINISHED, + ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING +} = (__webpack_require__(57186).codes) +const { errorOrDestroy } = destroyImpl +ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) +ObjectSetPrototypeOf(Writable, Stream) +function nop() {} +const kOnFinished = Symbol('kOnFinished') +function WritableState(options, stream, isDuplex) { + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(56725) + + // Object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!(options && options.objectMode) + if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) + + // The point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write(). + this.highWaterMark = options + ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) + : getDefaultHighWaterMark(false) + + // if _final has been called. + this.finalCalled = false + + // drain event flag. + this.needDrain = false + // At the start of calling end() + this.ending = false + // When end() has been called, and returned. + this.ended = false + // When 'finish' is emitted. + this.finished = false + + // Has it been destroyed + this.destroyed = false + + // Should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + const noDecode = !!(options && options.decodeStrings === false) + this.decodeStrings = !noDecode + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' + + // Not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0 + + // A flag to see when we're in the middle of a write. + this.writing = false + + // When true all writes will be buffered until .uncork() call. + this.corked = 0 + + // A flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true + + // A flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false + + // The callback that's passed to _write(chunk, cb). + this.onwrite = onwrite.bind(undefined, stream) + + // The callback that the user supplies to write(chunk, encoding, cb). + this.writecb = null + + // The amount that is being written when _write is called. + this.writelen = 0 + + // Storage for data passed to the afterWrite() callback in case of + // synchronous _write() completion. + this.afterWriteTickInfo = null + resetBuffer(this) + + // Number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted. + this.pendingcb = 0 + + // Stream is still being constructed and cannot be + // destroyed until construction finished or failed. + // Async construction is opt in, therefore we start as + // constructed. + this.constructed = true + + // Emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams. + this.prefinished = false + + // True if the error was already emitted and should not be thrown again. + this.errorEmitted = false + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = !options || options.emitClose !== false + + // Should .destroy() be called after 'finish' (and potentially 'end'). + this.autoDestroy = !options || options.autoDestroy !== false + + // Indicates whether the stream has errored. When true all write() calls + // should return false. This is needed since when autoDestroy + // is disabled we need a way to tell whether the stream has failed. + this.errored = null + + // Indicates whether the stream has finished destroying. + this.closed = false + + // True if close has been emitted or would have been emitted + // depending on emitClose. + this.closeEmitted = false + this[kOnFinished] = [] +} +function resetBuffer(state) { + state.buffered = [] + state.bufferedIndex = 0 + state.allBuffers = true + state.allNoop = true +} +WritableState.prototype.getBuffer = function getBuffer() { + return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) +} +ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { + __proto__: null, + get() { + return this.buffered.length - this.bufferedIndex + } +}) +function Writable(options) { + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5. + const isDuplex = this instanceof __webpack_require__(56725) + if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) + this._writableState = new WritableState(options, this, isDuplex) + if (options) { + if (typeof options.write === 'function') this._write = options.write + if (typeof options.writev === 'function') this._writev = options.writev + if (typeof options.destroy === 'function') this._destroy = options.destroy + if (typeof options.final === 'function') this._final = options.final + if (typeof options.construct === 'function') this._construct = options.construct + if (options.signal) addAbortSignal(options.signal, this) + } + Stream.call(this, options) + destroyImpl.construct(this, () => { + const state = this._writableState + if (!state.writing) { + clearBuffer(this, state) } + finishMaybe(this, state) }) - - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) - } - function _write(stream, chunk, encoding, cb) { - const state = stream._writableState - if (typeof encoding === 'function') { - cb = encoding - encoding = state.defaultEncoding - } else { - if (!encoding) encoding = state.defaultEncoding - else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - if (typeof cb !== 'function') cb = nop - } - if (chunk === null) { - throw new ERR_STREAM_NULL_VALUES() - } else if (!state.objectMode) { - if (typeof chunk === 'string') { - if (state.decodeStrings !== false) { - chunk = Buffer.from(chunk, encoding) - encoding = 'buffer' - } - } else if (chunk instanceof Buffer) { - encoding = 'buffer' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) +} +ObjectDefineProperty(Writable, SymbolHasInstance, { + __proto__: null, + value: function (object) { + if (FunctionPrototypeSymbolHasInstance(this, object)) return true + if (this !== Writable) return false + return object && object._writableState instanceof WritableState + } +}) + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) +} +function _write(stream, chunk, encoding, cb) { + const state = stream._writableState + if (typeof encoding === 'function') { + cb = encoding + encoding = state.defaultEncoding + } else { + if (!encoding) encoding = state.defaultEncoding + else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) + if (typeof cb !== 'function') cb = nop + } + if (chunk === null) { + throw new ERR_STREAM_NULL_VALUES() + } else if (!state.objectMode) { + if (typeof chunk === 'string') { + if (state.decodeStrings !== false) { + chunk = Buffer.from(chunk, encoding) encoding = 'buffer' - } else { - throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) } + } else if (chunk instanceof Buffer) { + encoding = 'buffer' + } else if (Stream._isUint8Array(chunk)) { + chunk = Stream._uint8ArrayToBuffer(chunk) + encoding = 'buffer' + } else { + throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + } + } + let err + if (state.ending) { + err = new ERR_STREAM_WRITE_AFTER_END() + } else if (state.destroyed) { + err = new ERR_STREAM_DESTROYED('write') + } + if (err) { + process.nextTick(cb, err) + errorOrDestroy(stream, err, true) + return err + } + state.pendingcb++ + return writeOrBuffer(stream, state, chunk, encoding, cb) +} +Writable.prototype.write = function (chunk, encoding, cb) { + return _write(this, chunk, encoding, cb) === true +} +Writable.prototype.cork = function () { + this._writableState.corked++ +} +Writable.prototype.uncork = function () { + const state = this._writableState + if (state.corked) { + state.corked-- + if (!state.writing) clearBuffer(this, state) + } +} +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) + if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) + this._writableState.defaultEncoding = encoding + return this +} + +// If we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, callback) { + const len = state.objectMode ? 1 : chunk.length + state.length += len + + // stream._write resets state.length + const ret = state.length < state.highWaterMark + // We must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true + if (state.writing || state.corked || state.errored || !state.constructed) { + state.buffered.push({ + chunk, + encoding, + callback + }) + if (state.allBuffers && encoding !== 'buffer') { + state.allBuffers = false } - let err - if (state.ending) { - err = new ERR_STREAM_WRITE_AFTER_END() - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('write') - } - if (err) { - process.nextTick(cb, err) - errorOrDestroy(stream, err, true) - return err - } - state.pendingcb++ - return writeOrBuffer(stream, state, chunk, encoding, cb) - } - Writable.prototype.write = function (chunk, encoding, cb) { - return _write(this, chunk, encoding, cb) === true - } - Writable.prototype.cork = function () { - this._writableState.corked++ - } - Writable.prototype.uncork = function () { - const state = this._writableState - if (state.corked) { - state.corked-- - if (!state.writing) clearBuffer(this, state) + if (state.allNoop && callback !== nop) { + state.allNoop = false } - } - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) - if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - this._writableState.defaultEncoding = encoding - return this - } - - // If we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, chunk, encoding, callback) { - const len = state.objectMode ? 1 : chunk.length - state.length += len - - // stream._write resets state.length - const ret = state.length < state.highWaterMark - // We must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true - if (state.writing || state.corked || state.errored || !state.constructed) { - state.buffered.push({ - chunk, - encoding, - callback - }) - if (state.allBuffers && encoding !== 'buffer') { - state.allBuffers = false - } - if (state.allNoop && callback !== nop) { - state.allNoop = false - } - } else { - state.writelen = len - state.writecb = callback - state.writing = true - state.sync = true - stream._write(chunk, encoding, state.onwrite) - state.sync = false - } - - // Return false if errored or destroyed in order to break - // any synchronous while(stream.write(data)) loops. - return ret && !state.errored && !state.destroyed - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { + } else { state.writelen = len - state.writecb = cb + state.writecb = callback state.writing = true state.sync = true - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) - else if (writev) stream._writev(chunk, state.onwrite) - else stream._write(chunk, encoding, state.onwrite) + stream._write(chunk, encoding, state.onwrite) state.sync = false } - function onwriteError(stream, state, er, cb) { - --state.pendingcb - cb(er) - // Ensure callbacks are invoked even when autoDestroy is - // not enabled. Passing `er` here doesn't make sense since - // it's related to one specific write, not to the buffered - // writes. - errorBuffer(state) - // This can emit error, but error must always follow cb. - errorOrDestroy(stream, er) - } - function onwrite(stream, er) { - const state = stream._writableState - const sync = state.sync - const cb = state.writecb - if (typeof cb !== 'function') { - errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) - return + + // Return false if errored or destroyed in order to break + // any synchronous while(stream.write(data)) loops. + return ret && !state.errored && !state.destroyed +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len + state.writecb = cb + state.writing = true + state.sync = true + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) + else if (writev) stream._writev(chunk, state.onwrite) + else stream._write(chunk, encoding, state.onwrite) + state.sync = false +} +function onwriteError(stream, state, er, cb) { + --state.pendingcb + cb(er) + // Ensure callbacks are invoked even when autoDestroy is + // not enabled. Passing `er` here doesn't make sense since + // it's related to one specific write, not to the buffered + // writes. + errorBuffer(state) + // This can emit error, but error must always follow cb. + errorOrDestroy(stream, er) +} +function onwrite(stream, er) { + const state = stream._writableState + const sync = state.sync + const cb = state.writecb + if (typeof cb !== 'function') { + errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) + return + } + state.writing = false + state.writecb = null + state.length -= state.writelen + state.writelen = 0 + if (er) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + er.stack // eslint-disable-line no-unused-expressions + + if (!state.errored) { + state.errored = er } - state.writing = false - state.writecb = null - state.length -= state.writelen - state.writelen = 0 - if (er) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - er.stack // eslint-disable-line no-unused-expressions - - if (!state.errored) { - state.errored = er - } - - // In case of duplex streams we need to notify the readable side of the - // error. - if (stream._readableState && !stream._readableState.errored) { - stream._readableState.errored = er - } - if (sync) { - process.nextTick(onwriteError, stream, state, er, cb) - } else { - onwriteError(stream, state, er, cb) - } + + // In case of duplex streams we need to notify the readable side of the + // error. + if (stream._readableState && !stream._readableState.errored) { + stream._readableState.errored = er + } + if (sync) { + process.nextTick(onwriteError, stream, state, er, cb) } else { - if (state.buffered.length > state.bufferedIndex) { - clearBuffer(stream, state) - } - if (sync) { - // It is a common case that the callback passed to .write() is always - // the same. In that case, we do not schedule a new nextTick(), but - // rather just increase a counter, to improve performance and avoid - // memory allocations. - if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { - state.afterWriteTickInfo.count++ - } else { - state.afterWriteTickInfo = { - count: 1, - cb, - stream, - state - } - process.nextTick(afterWriteTick, state.afterWriteTickInfo) - } + onwriteError(stream, state, er, cb) + } + } else { + if (state.buffered.length > state.bufferedIndex) { + clearBuffer(stream, state) + } + if (sync) { + // It is a common case that the callback passed to .write() is always + // the same. In that case, we do not schedule a new nextTick(), but + // rather just increase a counter, to improve performance and avoid + // memory allocations. + if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { + state.afterWriteTickInfo.count++ } else { - afterWrite(stream, state, 1, cb) + state.afterWriteTickInfo = { + count: 1, + cb, + stream, + state + } + process.nextTick(afterWriteTick, state.afterWriteTickInfo) } + } else { + afterWrite(stream, state, 1, cb) } } - function afterWriteTick({ stream, state, count, cb }) { - state.afterWriteTickInfo = null - return afterWrite(stream, state, count, cb) +} +function afterWriteTick({ stream, state, count, cb }) { + state.afterWriteTickInfo = null + return afterWrite(stream, state, count, cb) +} +function afterWrite(stream, state, count, cb) { + const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain + if (needDrain) { + state.needDrain = false + stream.emit('drain') } - function afterWrite(stream, state, count, cb) { - const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain - if (needDrain) { - state.needDrain = false - stream.emit('drain') - } - while (count-- > 0) { - state.pendingcb-- - cb() - } - if (state.destroyed) { - errorBuffer(state) - } - finishMaybe(stream, state) + while (count-- > 0) { + state.pendingcb-- + cb() } - - // If there's something in the buffer waiting, then invoke callbacks. - function errorBuffer(state) { - if (state.writing) { - return - } - for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { - var _state$errored - const { chunk, callback } = state.buffered[n] - const len = state.objectMode ? 1 : chunk.length - state.length -= len - callback( - (_state$errored = state.errored) !== null && _state$errored !== undefined - ? _state$errored - : new ERR_STREAM_DESTROYED('write') - ) - } - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - var _state$errored2 - onfinishCallbacks[i]( - (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined - ? _state$errored2 - : new ERR_STREAM_DESTROYED('end') - ) - } - resetBuffer(state) + if (state.destroyed) { + errorBuffer(state) } - - // If there's something in the buffer waiting, then process it. - function clearBuffer(stream, state) { - if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { - return - } - const { buffered, bufferedIndex, objectMode } = state - const bufferedLength = buffered.length - bufferedIndex - if (!bufferedLength) { - return - } - let i = bufferedIndex - state.bufferProcessing = true - if (bufferedLength > 1 && stream._writev) { - state.pendingcb -= bufferedLength - 1 - const callback = state.allNoop - ? nop - : (err) => { - for (let n = i; n < buffered.length; ++n) { - buffered[n].callback(err) - } - } - // Make a copy of `buffered` if it's going to be used by `callback` above, - // since `doWrite` will mutate the array. - const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) - chunks.allBuffers = state.allBuffers - doWrite(stream, state, true, state.length, chunks, '', callback) + finishMaybe(stream, state) +} + +// If there's something in the buffer waiting, then invoke callbacks. +function errorBuffer(state) { + if (state.writing) { + return + } + for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { + var _state$errored + const { chunk, callback } = state.buffered[n] + const len = state.objectMode ? 1 : chunk.length + state.length -= len + callback( + (_state$errored = state.errored) !== null && _state$errored !== undefined + ? _state$errored + : new ERR_STREAM_DESTROYED('write') + ) + } + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + var _state$errored2 + onfinishCallbacks[i]( + (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined + ? _state$errored2 + : new ERR_STREAM_DESTROYED('end') + ) + } + resetBuffer(state) +} + +// If there's something in the buffer waiting, then process it. +function clearBuffer(stream, state) { + if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { + return + } + const { buffered, bufferedIndex, objectMode } = state + const bufferedLength = buffered.length - bufferedIndex + if (!bufferedLength) { + return + } + let i = bufferedIndex + state.bufferProcessing = true + if (bufferedLength > 1 && stream._writev) { + state.pendingcb -= bufferedLength - 1 + const callback = state.allNoop + ? nop + : (err) => { + for (let n = i; n < buffered.length; ++n) { + buffered[n].callback(err) + } + } + // Make a copy of `buffered` if it's going to be used by `callback` above, + // since `doWrite` will mutate the array. + const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) + chunks.allBuffers = state.allBuffers + doWrite(stream, state, true, state.length, chunks, '', callback) + resetBuffer(state) + } else { + do { + const { chunk, encoding, callback } = buffered[i] + buffered[i++] = null + const len = objectMode ? 1 : chunk.length + doWrite(stream, state, false, len, chunk, encoding, callback) + } while (i < buffered.length && !state.writing) + if (i === buffered.length) { resetBuffer(state) + } else if (i > 256) { + buffered.splice(0, i) + state.bufferedIndex = 0 } else { - do { - const { chunk, encoding, callback } = buffered[i] - buffered[i++] = null - const len = objectMode ? 1 : chunk.length - doWrite(stream, state, false, len, chunk, encoding, callback) - } while (i < buffered.length && !state.writing) - if (i === buffered.length) { - resetBuffer(state) - } else if (i > 256) { - buffered.splice(0, i) - state.bufferedIndex = 0 - } else { - state.bufferedIndex = i - } + state.bufferedIndex = i } - state.bufferProcessing = false } - Writable.prototype._write = function (chunk, encoding, cb) { - if (this._writev) { - this._writev( - [ - { - chunk, - encoding - } - ], - cb - ) - } else { - throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') + state.bufferProcessing = false +} +Writable.prototype._write = function (chunk, encoding, cb) { + if (this._writev) { + this._writev( + [ + { + chunk, + encoding + } + ], + cb + ) + } else { + throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') + } +} +Writable.prototype._writev = null +Writable.prototype.end = function (chunk, encoding, cb) { + const state = this._writableState + if (typeof chunk === 'function') { + cb = chunk + chunk = null + encoding = null + } else if (typeof encoding === 'function') { + cb = encoding + encoding = null + } + let err + if (chunk !== null && chunk !== undefined) { + const ret = _write(this, chunk, encoding) + if (ret instanceof Error) { + err = ret } } - Writable.prototype._writev = null - Writable.prototype.end = function (chunk, encoding, cb) { - const state = this._writableState - if (typeof chunk === 'function') { - cb = chunk - chunk = null - encoding = null - } else if (typeof encoding === 'function') { - cb = encoding - encoding = null - } - let err - if (chunk !== null && chunk !== undefined) { - const ret = _write(this, chunk, encoding) - if (ret instanceof Error) { - err = ret - } - } - - // .end() fully uncorks. - if (state.corked) { - state.corked = 1 - this.uncork() + + // .end() fully uncorks. + if (state.corked) { + state.corked = 1 + this.uncork() + } + if (err) { + // Do nothing... + } else if (!state.errored && !state.ending) { + // This is forgiving in terms of unnecessary calls to end() and can hide + // logic errors. However, usually such errors are harmless and causing a + // hard error can be disproportionately destructive. It is not always + // trivial for the user to determine whether end() needs to be called + // or not. + + state.ending = true + finishMaybe(this, state, true) + state.ended = true + } else if (state.finished) { + err = new ERR_STREAM_ALREADY_FINISHED('end') + } else if (state.destroyed) { + err = new ERR_STREAM_DESTROYED('end') + } + if (typeof cb === 'function') { + if (err || state.finished) { + process.nextTick(cb, err) + } else { + state[kOnFinished].push(cb) + } + } + return this +} +function needFinish(state) { + return ( + state.ending && + !state.destroyed && + state.constructed && + state.length === 0 && + !state.errored && + state.buffered.length === 0 && + !state.finished && + !state.writing && + !state.errorEmitted && + !state.closeEmitted + ) +} +function callFinal(stream, state) { + let called = false + function onFinish(err) { + if (called) { + errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) + return } + called = true + state.pendingcb-- if (err) { - // Do nothing... - } else if (!state.errored && !state.ending) { - // This is forgiving in terms of unnecessary calls to end() and can hide - // logic errors. However, usually such errors are harmless and causing a - // hard error can be disproportionately destructive. It is not always - // trivial for the user to determine whether end() needs to be called - // or not. - - state.ending = true - finishMaybe(this, state, true) - state.ended = true - } else if (state.finished) { - err = new ERR_STREAM_ALREADY_FINISHED('end') - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('end') - } - if (typeof cb === 'function') { - if (err || state.finished) { - process.nextTick(cb, err) - } else { - state[kOnFinished].push(cb) - } + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i](err) + } + errorOrDestroy(stream, err, state.sync) + } else if (needFinish(state)) { + state.prefinished = true + stream.emit('prefinish') + // Backwards compat. Don't check state.sync here. + // Some streams assume 'finish' will be emitted + // asynchronously relative to _final callback. + state.pendingcb++ + process.nextTick(finish, stream, state) + } + } + state.sync = true + state.pendingcb++ + try { + stream._final(onFinish) + } catch (err) { + onFinish(err) + } + state.sync = false +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.finalCalled = true + callFinal(stream, state) + } else { + state.prefinished = true + stream.emit('prefinish') } - return this - } - function needFinish(state) { - return ( - state.ending && - !state.destroyed && - state.constructed && - state.length === 0 && - !state.errored && - state.buffered.length === 0 && - !state.finished && - !state.writing && - !state.errorEmitted && - !state.closeEmitted - ) } - function callFinal(stream, state) { - let called = false - function onFinish(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) - return - } - called = true - state.pendingcb-- - if (err) { - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i](err) - } - errorOrDestroy(stream, err, state.sync) +} +function finishMaybe(stream, state, sync) { + if (needFinish(state)) { + prefinish(stream, state) + if (state.pendingcb === 0) { + if (sync) { + state.pendingcb++ + process.nextTick( + (stream, state) => { + if (needFinish(state)) { + finish(stream, state) + } else { + state.pendingcb-- + } + }, + stream, + state + ) } else if (needFinish(state)) { - state.prefinished = true - stream.emit('prefinish') - // Backwards compat. Don't check state.sync here. - // Some streams assume 'finish' will be emitted - // asynchronously relative to _final callback. state.pendingcb++ - process.nextTick(finish, stream, state) - } - } - state.sync = true - state.pendingcb++ - try { - stream._final(onFinish) - } catch (err) { - onFinish(err) - } - state.sync = false - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.finalCalled = true - callFinal(stream, state) - } else { - state.prefinished = true - stream.emit('prefinish') + finish(stream, state) } } } - function finishMaybe(stream, state, sync) { - if (needFinish(state)) { - prefinish(stream, state) - if (state.pendingcb === 0) { - if (sync) { - state.pendingcb++ - process.nextTick( - (stream, state) => { - if (needFinish(state)) { - finish(stream, state) - } else { - state.pendingcb-- - } - }, - stream, - state - ) - } else if (needFinish(state)) { - state.pendingcb++ - finish(stream, state) - } - } - } +} +function finish(stream, state) { + state.pendingcb-- + state.finished = true + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i]() } - function finish(stream, state) { - state.pendingcb-- - state.finished = true - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i]() - } - stream.emit('finish') - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well. - const rState = stream._readableState - const autoDestroy = - !rState || - (rState.autoDestroy && - // We don't expect the readable to ever 'end' - // if readable is explicitly set to false. - (rState.endEmitted || rState.readable === false)) - if (autoDestroy) { - stream.destroy() - } + stream.emit('finish') + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well. + const rState = stream._readableState + const autoDestroy = + !rState || + (rState.autoDestroy && + // We don't expect the readable to ever 'end' + // if readable is explicitly set to false. + (rState.endEmitted || rState.readable === false)) + if (autoDestroy) { + stream.destroy() + } + } +} +ObjectDefineProperties(Writable.prototype, { + closed: { + __proto__: null, + get() { + return this._writableState ? this._writableState.closed : false } - } - ObjectDefineProperties(Writable.prototype, { - closed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.closed : false - } - }, - destroyed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.destroyed : false - }, - set(value) { - // Backward compatibility, the user is explicitly managing destroyed. - if (this._writableState) { - this._writableState.destroyed = value - } - } - }, - writable: { - __proto__: null, - get() { - const w = this._writableState - // w.writable === false means that this is part of a Duplex stream - // where the writable side was disabled upon construction. - // Compat. The user might manually disable writable side through - // deprecated setter. - return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended - }, - set(val) { - // Backwards compatible. - if (this._writableState) { - this._writableState.writable = !!val - } - } - }, - writableFinished: { - __proto__: null, - get() { - return this._writableState ? this._writableState.finished : false - } - }, - writableObjectMode: { - __proto__: null, - get() { - return this._writableState ? this._writableState.objectMode : false - } - }, - writableBuffer: { - __proto__: null, - get() { - return this._writableState && this._writableState.getBuffer() - } - }, - writableEnded: { - __proto__: null, - get() { - return this._writableState ? this._writableState.ending : false - } - }, - writableNeedDrain: { - __proto__: null, - get() { - const wState = this._writableState - if (!wState) return false - return !wState.destroyed && !wState.ending && wState.needDrain - } - }, - writableHighWaterMark: { - __proto__: null, - get() { - return this._writableState && this._writableState.highWaterMark - } - }, - writableCorked: { - __proto__: null, - get() { - return this._writableState ? this._writableState.corked : 0 - } - }, - writableLength: { - __proto__: null, - get() { - return this._writableState && this._writableState.length - } + }, + destroyed: { + __proto__: null, + get() { + return this._writableState ? this._writableState.destroyed : false }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._writableState ? this._writableState.errored : null + set(value) { + // Backward compatibility, the user is explicitly managing destroyed. + if (this._writableState) { + this._writableState.destroyed = value } + } + }, + writable: { + __proto__: null, + get() { + const w = this._writableState + // w.writable === false means that this is part of a Duplex stream + // where the writable side was disabled upon construction. + // Compat. The user might manually disable writable side through + // deprecated setter. + return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended }, - writableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._writableState.writable !== false && - (this._writableState.destroyed || this._writableState.errored) && - !this._writableState.finished - ) + set(val) { + // Backwards compatible. + if (this._writableState) { + this._writableState.writable = !!val } } - }) - const destroy = destroyImpl.destroy - Writable.prototype.destroy = function (err, cb) { - const state = this._writableState - - // Invoke pending callbacks. - if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { - process.nextTick(errorBuffer, state) - } - destroy.call(this, err, cb) - return this - } - Writable.prototype._undestroy = destroyImpl.undestroy - Writable.prototype._destroy = function (err, cb) { - cb(err) - } - Writable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) - } - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters - } - Writable.fromWeb = function (writableStream, options) { - return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) - } - Writable.toWeb = function (streamWritable) { - return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) - } - - - /***/ }), - - /***/ 59021: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - /* eslint jsdoc/require-jsdoc: "error" */ - - - - const { - ArrayIsArray, - ArrayPrototypeIncludes, - ArrayPrototypeJoin, - ArrayPrototypeMap, - NumberIsInteger, - NumberIsNaN, - NumberMAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER, - NumberParseInt, - ObjectPrototypeHasOwnProperty, - RegExpPrototypeExec, - String, - StringPrototypeToUpperCase, - StringPrototypeTrim - } = __webpack_require__(78969) - const { - hideStackFrames, - codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } - } = __webpack_require__(57186) - const { normalizeEncoding } = __webpack_require__(64083) - const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(64083).types) - const signals = {} - - /** - * @param {*} value - * @returns {boolean} - */ - function isInt32(value) { - return value === (value | 0) - } - - /** - * @param {*} value - * @returns {boolean} - */ - function isUint32(value) { - return value === value >>> 0 - } - const octalReg = /^[0-7]+$/ - const modeDesc = 'must be a 32-bit unsigned integer or an octal string' - - /** - * Parse and validate values that will be converted into mode_t (the S_* - * constants). Only valid numbers and octal strings are allowed. They could be - * converted to 32-bit unsigned integers or non-negative signed integers in the - * C++ land, but any value higher than 0o777 will result in platform-specific - * behaviors. - * - * @param {*} value Values to be validated - * @param {string} name Name of the argument - * @param {number} [def] If specified, will be returned for invalid values - * @returns {number} - */ - function parseFileMode(value, name, def) { - if (typeof value === 'undefined') { - value = def + }, + writableFinished: { + __proto__: null, + get() { + return this._writableState ? this._writableState.finished : false } - if (typeof value === 'string') { - if (RegExpPrototypeExec(octalReg, value) === null) { - throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) - } - value = NumberParseInt(value, 8) + }, + writableObjectMode: { + __proto__: null, + get() { + return this._writableState ? this._writableState.objectMode : false } - validateUint32(value, name) - return value - } - - /** - * @callback validateInteger - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateInteger} */ - const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - }) - - /** - * @callback validateInt32 - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateInt32} */ - const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { - // The defaults for min and max correspond to the limits of 32-bit integers. - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + }, + writableBuffer: { + __proto__: null, + get() { + return this._writableState && this._writableState.getBuffer() } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + }, + writableEnded: { + __proto__: null, + get() { + return this._writableState ? this._writableState.ending : false } - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) + }, + writableNeedDrain: { + __proto__: null, + get() { + const wState = this._writableState + if (!wState) return false + return !wState.destroyed && !wState.ending && wState.needDrain } - }) - - /** - * @callback validateUint32 - * @param {*} value - * @param {string} name - * @param {number|boolean} [positive=false] - * @returns {asserts value is number} - */ - - /** @type {validateUint32} */ - const validateUint32 = hideStackFrames((value, name, positive = false) => { - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + }, + writableHighWaterMark: { + __proto__: null, + get() { + return this._writableState && this._writableState.highWaterMark } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + }, + writableCorked: { + __proto__: null, + get() { + return this._writableState ? this._writableState.corked : 0 } - const min = positive ? 1 : 0 - // 2 ** 32 === 4294967296 - const max = 4294967295 - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) + }, + writableLength: { + __proto__: null, + get() { + return this._writableState && this._writableState.length } - }) - - /** - * @callback validateString - * @param {*} value - * @param {string} name - * @returns {asserts value is string} - */ - - /** @type {validateString} */ - function validateString(value, name) { - if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) - } - - /** - * @callback validateNumber - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateNumber} */ - function validateNumber(value, name, min = undefined, max) { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if ( - (min != null && value < min) || - (max != null && value > max) || - ((min != null || max != null) && NumberIsNaN(value)) - ) { - throw new ERR_OUT_OF_RANGE( - name, - `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, - value - ) + }, + errored: { + __proto__: null, + enumerable: false, + get() { + return this._writableState ? this._writableState.errored : null } - } - - /** - * @callback validateOneOf - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} oneOf - */ - - /** @type {validateOneOf} */ - const validateOneOf = hideStackFrames((value, name, oneOf) => { - if (!ArrayPrototypeIncludes(oneOf, value)) { - const allowed = ArrayPrototypeJoin( - ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), - ', ' + }, + writableAborted: { + __proto__: null, + enumerable: false, + get: function () { + return !!( + this._writableState.writable !== false && + (this._writableState.destroyed || this._writableState.errored) && + !this._writableState.finished ) - const reason = 'must be one of: ' + allowed - throw new ERR_INVALID_ARG_VALUE(name, value, reason) } - }) - - /** - * @callback validateBoolean - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean} - */ - - /** @type {validateBoolean} */ - function validateBoolean(value, name) { - if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) - } - - /** - * @param {any} options - * @param {string} key - * @param {boolean} defaultValue - * @returns {boolean} - */ - function getOwnPropertyValueOrDefault(options, key, defaultValue) { - return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] } - - /** - * @callback validateObject - * @param {*} value - * @param {string} name - * @param {{ - * allowArray?: boolean, - * allowFunction?: boolean, - * nullable?: boolean - * }} [options] - */ - - /** @type {validateObject} */ - const validateObject = hideStackFrames((value, name, options = null) => { - const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) - const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) - const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) - if ( - (!nullable && value === null) || - (!allowArray && ArrayIsArray(value)) || - (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) - ) { - throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) - } - }) - - /** - * @callback validateDictionary - We are using the Web IDL Standard definition - * of "dictionary" here, which means any value - * whose Type is either Undefined, Null, or - * Object (which includes functions). - * @param {*} value - * @param {string} name - * @see https://webidl.spec.whatwg.org/#es-dictionary - * @see https://tc39.es/ecma262/#table-typeof-operator-results - */ - - /** @type {validateDictionary} */ - const validateDictionary = hideStackFrames((value, name) => { - if (value != null && typeof value !== 'object' && typeof value !== 'function') { - throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) - } - }) - - /** - * @callback validateArray - * @param {*} value - * @param {string} name - * @param {number} [minLength] - * @returns {asserts value is any[]} - */ - - /** @type {validateArray} */ - const validateArray = hideStackFrames((value, name, minLength = 0) => { - if (!ArrayIsArray(value)) { - throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) - } - if (value.length < minLength) { - const reason = `must be longer than ${minLength}` - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } - }) - - /** - * @callback validateStringArray - * @param {*} value - * @param {string} name - * @returns {asserts value is string[]} - */ - - /** @type {validateStringArray} */ - function validateStringArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateString(value[i], `${name}[${i}]`) - } +}) +const destroy = destroyImpl.destroy +Writable.prototype.destroy = function (err, cb) { + const state = this._writableState + + // Invoke pending callbacks. + if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { + process.nextTick(errorBuffer, state) + } + destroy.call(this, err, cb) + return this +} +Writable.prototype._undestroy = destroyImpl.undestroy +Writable.prototype._destroy = function (err, cb) { + cb(err) +} +Writable.prototype[EE.captureRejectionSymbol] = function (err) { + this.destroy(err) +} +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Writable.fromWeb = function (writableStream, options) { + return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) +} +Writable.toWeb = function (streamWritable) { + return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) +} + + +/***/ }), + +/***/ 59021: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint jsdoc/require-jsdoc: "error" */ + + + +const { + ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, + ArrayPrototypeMap, + NumberIsInteger, + NumberIsNaN, + NumberMAX_SAFE_INTEGER, + NumberMIN_SAFE_INTEGER, + NumberParseInt, + ObjectPrototypeHasOwnProperty, + RegExpPrototypeExec, + String, + StringPrototypeToUpperCase, + StringPrototypeTrim +} = __webpack_require__(78969) +const { + hideStackFrames, + codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } +} = __webpack_require__(57186) +const { normalizeEncoding } = __webpack_require__(64083) +const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(64083).types) +const signals = {} + +/** + * @param {*} value + * @returns {boolean} + */ +function isInt32(value) { + return value === (value | 0) +} + +/** + * @param {*} value + * @returns {boolean} + */ +function isUint32(value) { + return value === value >>> 0 +} +const octalReg = /^[0-7]+$/ +const modeDesc = 'must be a 32-bit unsigned integer or an octal string' + +/** + * Parse and validate values that will be converted into mode_t (the S_* + * constants). Only valid numbers and octal strings are allowed. They could be + * converted to 32-bit unsigned integers or non-negative signed integers in the + * C++ land, but any value higher than 0o777 will result in platform-specific + * behaviors. + * + * @param {*} value Values to be validated + * @param {string} name Name of the argument + * @param {number} [def] If specified, will be returned for invalid values + * @returns {number} + */ +function parseFileMode(value, name, def) { + if (typeof value === 'undefined') { + value = def + } + if (typeof value === 'string') { + if (RegExpPrototypeExec(octalReg, value) === null) { + throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) + } + value = NumberParseInt(value, 8) + } + validateUint32(value, name) + return value +} + +/** + * @callback validateInteger + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateInteger} */ +const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { + if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) +}) + +/** + * @callback validateInt32 + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateInt32} */ +const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { + // The defaults for min and max correspond to the limits of 32-bit integers. + if (typeof value !== 'number') { + throw new ERR_INVALID_ARG_TYPE(name, 'number', value) } - - /** - * @callback validateBooleanArray - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean[]} - */ - - /** @type {validateBooleanArray} */ - function validateBooleanArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateBoolean(value[i], `${name}[${i}]`) - } + if (!NumberIsInteger(value)) { + throw new ERR_OUT_OF_RANGE(name, 'an integer', value) } - - /** - * @param {*} signal - * @param {string} [name='signal'] - * @returns {asserts signal is keyof signals} - */ - function validateSignalName(signal, name = 'signal') { - validateString(signal, name) - if (signals[signal] === undefined) { - if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { - throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') - } - throw new ERR_UNKNOWN_SIGNAL(signal) - } + if (value < min || value > max) { + throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) } - - /** - * @callback validateBuffer - * @param {*} buffer - * @param {string} [name='buffer'] - * @returns {asserts buffer is ArrayBufferView} - */ - - /** @type {validateBuffer} */ - const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { - if (!isArrayBufferView(buffer)) { - throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) - } - }) - - /** - * @param {string} data - * @param {string} encoding - */ - function validateEncoding(data, encoding) { - const normalizedEncoding = normalizeEncoding(encoding) - const length = data.length - if (normalizedEncoding === 'hex' && length % 2 !== 0) { - throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) - } +}) + +/** + * @callback validateUint32 + * @param {*} value + * @param {string} name + * @param {number|boolean} [positive=false] + * @returns {asserts value is number} + */ + +/** @type {validateUint32} */ +const validateUint32 = hideStackFrames((value, name, positive = false) => { + if (typeof value !== 'number') { + throw new ERR_INVALID_ARG_TYPE(name, 'number', value) } - - /** - * Check that the port number is not NaN when coerced to a number, - * is an integer and that it falls within the legal range of port numbers. - * @param {*} port - * @param {string} [name='Port'] - * @param {boolean} [allowZero=true] - * @returns {number} - */ - function validatePort(port, name = 'Port', allowZero = true) { - if ( - (typeof port !== 'number' && typeof port !== 'string') || - (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || - +port !== +port >>> 0 || - port > 0xffff || - (port === 0 && !allowZero) - ) { - throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) - } - return port | 0 + if (!NumberIsInteger(value)) { + throw new ERR_OUT_OF_RANGE(name, 'an integer', value) } - - /** - * @callback validateAbortSignal - * @param {*} signal - * @param {string} name - */ - - /** @type {validateAbortSignal} */ - const validateAbortSignal = hideStackFrames((signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } - }) - - /** - * @callback validateFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - - /** @type {validateFunction} */ - const validateFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) - }) - - /** - * @callback validatePlainFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - - /** @type {validatePlainFunction} */ - const validatePlainFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) - }) - - /** - * @callback validateUndefined - * @param {*} value - * @param {string} name - * @returns {asserts value is undefined} - */ - - /** @type {validateUndefined} */ - const validateUndefined = hideStackFrames((value, name) => { - if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) - }) - - /** - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} union - */ - function validateUnion(value, name, union) { - if (!ArrayPrototypeIncludes(union, value)) { - throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) - } + const min = positive ? 1 : 0 + // 2 ** 32 === 4294967296 + const max = 4294967295 + if (value < min || value > max) { + throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) } - - /* - The rules for the Link header field are described here: - https://www.rfc-editor.org/rfc/rfc8288.html#section-3 - - This regex validates any string surrounded by angle brackets - (not necessarily a valid URI reference) followed by zero or more - link-params separated by semicolons. - */ - const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ - - /** - * @param {any} value - * @param {string} name - */ - function validateLinkHeaderFormat(value, name) { - if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { - throw new ERR_INVALID_ARG_VALUE( - name, - value, - 'must be an array or string of format "; rel=preload; as=style"' - ) - } +}) + +/** + * @callback validateString + * @param {*} value + * @param {string} name + * @returns {asserts value is string} + */ + +/** @type {validateString} */ +function validateString(value, name) { + if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) +} + +/** + * @callback validateNumber + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateNumber} */ +function validateNumber(value, name, min = undefined, max) { + if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + if ( + (min != null && value < min) || + (max != null && value > max) || + ((min != null || max != null) && NumberIsNaN(value)) + ) { + throw new ERR_OUT_OF_RANGE( + name, + `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, + value + ) } - - /** - * @param {any} hints - * @return {string} - */ - function validateLinkHeaderValue(hints) { - if (typeof hints === 'string') { - validateLinkHeaderFormat(hints, 'hints') - return hints - } else if (ArrayIsArray(hints)) { - const hintsLength = hints.length - let result = '' - if (hintsLength === 0) { - return result - } - for (let i = 0; i < hintsLength; i++) { - const link = hints[i] - validateLinkHeaderFormat(link, 'hints') - result += link - if (i !== hintsLength - 1) { - result += ', ' - } - } - return result - } +} + +/** + * @callback validateOneOf + * @template T + * @param {T} value + * @param {string} name + * @param {T[]} oneOf + */ + +/** @type {validateOneOf} */ +const validateOneOf = hideStackFrames((value, name, oneOf) => { + if (!ArrayPrototypeIncludes(oneOf, value)) { + const allowed = ArrayPrototypeJoin( + ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), + ', ' + ) + const reason = 'must be one of: ' + allowed + throw new ERR_INVALID_ARG_VALUE(name, value, reason) + } +}) + +/** + * @callback validateBoolean + * @param {*} value + * @param {string} name + * @returns {asserts value is boolean} + */ + +/** @type {validateBoolean} */ +function validateBoolean(value, name) { + if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) +} + +/** + * @param {any} options + * @param {string} key + * @param {boolean} defaultValue + * @returns {boolean} + */ +function getOwnPropertyValueOrDefault(options, key, defaultValue) { + return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] +} + +/** + * @callback validateObject + * @param {*} value + * @param {string} name + * @param {{ + * allowArray?: boolean, + * allowFunction?: boolean, + * nullable?: boolean + * }} [options] + */ + +/** @type {validateObject} */ +const validateObject = hideStackFrames((value, name, options = null) => { + const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) + const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) + const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) + if ( + (!nullable && value === null) || + (!allowArray && ArrayIsArray(value)) || + (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) + ) { + throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) + } +}) + +/** + * @callback validateDictionary - We are using the Web IDL Standard definition + * of "dictionary" here, which means any value + * whose Type is either Undefined, Null, or + * Object (which includes functions). + * @param {*} value + * @param {string} name + * @see https://webidl.spec.whatwg.org/#es-dictionary + * @see https://tc39.es/ecma262/#table-typeof-operator-results + */ + +/** @type {validateDictionary} */ +const validateDictionary = hideStackFrames((value, name) => { + if (value != null && typeof value !== 'object' && typeof value !== 'function') { + throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) + } +}) + +/** + * @callback validateArray + * @param {*} value + * @param {string} name + * @param {number} [minLength] + * @returns {asserts value is any[]} + */ + +/** @type {validateArray} */ +const validateArray = hideStackFrames((value, name, minLength = 0) => { + if (!ArrayIsArray(value)) { + throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) + } + if (value.length < minLength) { + const reason = `must be longer than ${minLength}` + throw new ERR_INVALID_ARG_VALUE(name, value, reason) + } +}) + +/** + * @callback validateStringArray + * @param {*} value + * @param {string} name + * @returns {asserts value is string[]} + */ + +/** @type {validateStringArray} */ +function validateStringArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`) + } +} + +/** + * @callback validateBooleanArray + * @param {*} value + * @param {string} name + * @returns {asserts value is boolean[]} + */ + +/** @type {validateBooleanArray} */ +function validateBooleanArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`) + } +} + +/** + * @param {*} signal + * @param {string} [name='signal'] + * @returns {asserts signal is keyof signals} + */ +function validateSignalName(signal, name = 'signal') { + validateString(signal, name) + if (signals[signal] === undefined) { + if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { + throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') + } + throw new ERR_UNKNOWN_SIGNAL(signal) + } +} + +/** + * @callback validateBuffer + * @param {*} buffer + * @param {string} [name='buffer'] + * @returns {asserts buffer is ArrayBufferView} + */ + +/** @type {validateBuffer} */ +const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { + if (!isArrayBufferView(buffer)) { + throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) + } +}) + +/** + * @param {string} data + * @param {string} encoding + */ +function validateEncoding(data, encoding) { + const normalizedEncoding = normalizeEncoding(encoding) + const length = data.length + if (normalizedEncoding === 'hex' && length % 2 !== 0) { + throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) + } +} + +/** + * Check that the port number is not NaN when coerced to a number, + * is an integer and that it falls within the legal range of port numbers. + * @param {*} port + * @param {string} [name='Port'] + * @param {boolean} [allowZero=true] + * @returns {number} + */ +function validatePort(port, name = 'Port', allowZero = true) { + if ( + (typeof port !== 'number' && typeof port !== 'string') || + (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || + +port !== +port >>> 0 || + port > 0xffff || + (port === 0 && !allowZero) + ) { + throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) + } + return port | 0 +} + +/** + * @callback validateAbortSignal + * @param {*} signal + * @param {string} name + */ + +/** @type {validateAbortSignal} */ +const validateAbortSignal = hideStackFrames((signal, name) => { + if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { + throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) + } +}) + +/** + * @callback validateFunction + * @param {*} value + * @param {string} name + * @returns {asserts value is Function} + */ + +/** @type {validateFunction} */ +const validateFunction = hideStackFrames((value, name) => { + if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) +}) + +/** + * @callback validatePlainFunction + * @param {*} value + * @param {string} name + * @returns {asserts value is Function} + */ + +/** @type {validatePlainFunction} */ +const validatePlainFunction = hideStackFrames((value, name) => { + if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) +}) + +/** + * @callback validateUndefined + * @param {*} value + * @param {string} name + * @returns {asserts value is undefined} + */ + +/** @type {validateUndefined} */ +const validateUndefined = hideStackFrames((value, name) => { + if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) +}) + +/** + * @template T + * @param {T} value + * @param {string} name + * @param {T[]} union + */ +function validateUnion(value, name, union) { + if (!ArrayPrototypeIncludes(union, value)) { + throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) + } +} + +/* + The rules for the Link header field are described here: + https://www.rfc-editor.org/rfc/rfc8288.html#section-3 + + This regex validates any string surrounded by angle brackets + (not necessarily a valid URI reference) followed by zero or more + link-params separated by semicolons. +*/ +const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ + +/** + * @param {any} value + * @param {string} name + */ +function validateLinkHeaderFormat(value, name) { + if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { throw new ERR_INVALID_ARG_VALUE( - 'hints', - hints, + name, + value, 'must be an array or string of format "; rel=preload; as=style"' ) } - module.exports = { - isInt32, - isUint32, - parseFileMode, - validateArray, - validateStringArray, - validateBooleanArray, - validateBoolean, - validateBuffer, - validateDictionary, - validateEncoding, - validateFunction, - validateInt32, - validateInteger, - validateNumber, - validateObject, - validateOneOf, - validatePlainFunction, - validatePort, - validateSignalName, - validateString, - validateUint32, - validateUndefined, - validateUnion, - validateAbortSignal, - validateLinkHeaderValue - } - - - /***/ }), - - /***/ 92756: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const CustomStream = __webpack_require__(95808) - const promises = __webpack_require__(73428) - const originalDestroy = CustomStream.Readable.destroy - module.exports = CustomStream.Readable - - // Explicit export naming is needed for ESM - module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer - module.exports._isUint8Array = CustomStream._isUint8Array - module.exports.isDisturbed = CustomStream.isDisturbed - module.exports.isErrored = CustomStream.isErrored - module.exports.isReadable = CustomStream.isReadable - module.exports.Readable = CustomStream.Readable - module.exports.Writable = CustomStream.Writable - module.exports.Duplex = CustomStream.Duplex - module.exports.Transform = CustomStream.Transform - module.exports.PassThrough = CustomStream.PassThrough - module.exports.addAbortSignal = CustomStream.addAbortSignal - module.exports.finished = CustomStream.finished - module.exports.destroy = CustomStream.destroy - module.exports.destroy = originalDestroy - module.exports.pipeline = CustomStream.pipeline - module.exports.compose = CustomStream.compose - Object.defineProperty(CustomStream, 'promises', { - configurable: true, - enumerable: true, - get() { - return promises +} + +/** + * @param {any} hints + * @return {string} + */ +function validateLinkHeaderValue(hints) { + if (typeof hints === 'string') { + validateLinkHeaderFormat(hints, 'hints') + return hints + } else if (ArrayIsArray(hints)) { + const hintsLength = hints.length + let result = '' + if (hintsLength === 0) { + return result } - }) - module.exports.Stream = CustomStream.Stream - - // Allow default importing - module.exports["default"] = module.exports - - - /***/ }), - - /***/ 57186: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(64083) - - /* - This file is a reduced and adapted version of the main lib/internal/errors.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/errors.js - - Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) - with the upstream file. - */ - - const AggregateError = globalThis.AggregateError || CustomAggregateError - const kIsNodeError = Symbol('kIsNodeError') - const kTypes = [ - 'string', - 'function', - 'number', - 'object', - // Accept 'Function' and 'Object' as alternative to the lower cased version. - 'Function', - 'Object', - 'boolean', - 'bigint', - 'symbol' - ] - const classRegExp = /^([A-Z][a-z0-9]*)+$/ - const nodeInternalPrefix = '__node_internal_' - const codes = {} - function assert(value, message) { - if (!value) { - throw new codes.ERR_INTERNAL_ASSERTION(message) - } - } - - // Only use this for integers! Decimal numbers do not work with this function. - function addNumericalSeparator(val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` - } - function getMessage(key, msg, args) { - if (typeof msg === 'function') { - assert( - msg.length <= args.length, - // Default options do not count. - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` - ) - return msg(...args) + for (let i = 0; i < hintsLength; i++) { + const link = hints[i] + validateLinkHeaderFormat(link, 'hints') + result += link + if (i !== hintsLength - 1) { + result += ', ' + } } - const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length + return result + } + throw new ERR_INVALID_ARG_VALUE( + 'hints', + hints, + 'must be an array or string of format "; rel=preload; as=style"' + ) +} +module.exports = { + isInt32, + isUint32, + parseFileMode, + validateArray, + validateStringArray, + validateBooleanArray, + validateBoolean, + validateBuffer, + validateDictionary, + validateEncoding, + validateFunction, + validateInt32, + validateInteger, + validateNumber, + validateObject, + validateOneOf, + validatePlainFunction, + validatePort, + validateSignalName, + validateString, + validateUint32, + validateUndefined, + validateUnion, + validateAbortSignal, + validateLinkHeaderValue +} + + +/***/ }), + +/***/ 92756: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const CustomStream = __webpack_require__(95808) +const promises = __webpack_require__(73428) +const originalDestroy = CustomStream.Readable.destroy +module.exports = CustomStream.Readable + +// Explicit export naming is needed for ESM +module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer +module.exports._isUint8Array = CustomStream._isUint8Array +module.exports.isDisturbed = CustomStream.isDisturbed +module.exports.isErrored = CustomStream.isErrored +module.exports.isReadable = CustomStream.isReadable +module.exports.Readable = CustomStream.Readable +module.exports.Writable = CustomStream.Writable +module.exports.Duplex = CustomStream.Duplex +module.exports.Transform = CustomStream.Transform +module.exports.PassThrough = CustomStream.PassThrough +module.exports.addAbortSignal = CustomStream.addAbortSignal +module.exports.finished = CustomStream.finished +module.exports.destroy = CustomStream.destroy +module.exports.destroy = originalDestroy +module.exports.pipeline = CustomStream.pipeline +module.exports.compose = CustomStream.compose +Object.defineProperty(CustomStream, 'promises', { + configurable: true, + enumerable: true, + get() { + return promises + } +}) +module.exports.Stream = CustomStream.Stream + +// Allow default importing +module.exports["default"] = module.exports + + +/***/ }), + +/***/ 57186: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(64083) + +/* + This file is a reduced and adapted version of the main lib/internal/errors.js file defined at + + https://github.com/nodejs/node/blob/master/lib/internal/errors.js + + Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) + with the upstream file. +*/ + +const AggregateError = globalThis.AggregateError || CustomAggregateError +const kIsNodeError = Symbol('kIsNodeError') +const kTypes = [ + 'string', + 'function', + 'number', + 'object', + // Accept 'Function' and 'Object' as alternative to the lower cased version. + 'Function', + 'Object', + 'boolean', + 'bigint', + 'symbol' +] +const classRegExp = /^([A-Z][a-z0-9]*)+$/ +const nodeInternalPrefix = '__node_internal_' +const codes = {} +function assert(value, message) { + if (!value) { + throw new codes.ERR_INTERNAL_ASSERTION(message) + } +} + +// Only use this for integers! Decimal numbers do not work with this function. +function addNumericalSeparator(val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} +function getMessage(key, msg, args) { + if (typeof msg === 'function') { assert( - expectedLength === args.length, - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` + msg.length <= args.length, + // Default options do not count. + `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` ) - if (args.length === 0) { - return msg - } - return format(msg, ...args) + return msg(...args) } - function E(code, message, Base) { - if (!Base) { - Base = Error + const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length + assert( + expectedLength === args.length, + `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` + ) + if (args.length === 0) { + return msg + } + return format(msg, ...args) +} +function E(code, message, Base) { + if (!Base) { + Base = Error + } + class NodeError extends Base { + constructor(...args) { + super(getMessage(code, message, args)) } - class NodeError extends Base { - constructor(...args) { - super(getMessage(code, message, args)) - } - toString() { - return `${this.name} [${code}]: ${this.message}` - } + toString() { + return `${this.name} [${code}]: ${this.message}` } - Object.defineProperties(NodeError.prototype, { - name: { - value: Base.name, - writable: true, - enumerable: false, - configurable: true + } + Object.defineProperties(NodeError.prototype, { + name: { + value: Base.name, + writable: true, + enumerable: false, + configurable: true + }, + toString: { + value() { + return `${this.name} [${code}]: ${this.message}` }, - toString: { - value() { - return `${this.name} [${code}]: ${this.message}` - }, - writable: true, - enumerable: false, - configurable: true - } - }) - NodeError.prototype.code = code - NodeError.prototype[kIsNodeError] = true - codes[code] = NodeError - } - function hideStackFrames(fn) { - // We rename the functions that will be hidden to cut off the stacktrace - // at the outermost one - const hidden = nodeInternalPrefix + fn.name - Object.defineProperty(fn, 'name', { - value: hidden - }) - return fn - } - function aggregateTwoErrors(innerError, outerError) { - if (innerError && outerError && innerError !== outerError) { - if (Array.isArray(outerError.errors)) { - // If `outerError` is already an `AggregateError`. - outerError.errors.push(innerError) - return outerError - } - const err = new AggregateError([outerError, innerError], outerError.message) - err.code = outerError.code - return err - } - return innerError || outerError - } - class AbortError extends Error { - constructor(message = 'The operation was aborted', options = undefined) { - if (options !== undefined && typeof options !== 'object') { - throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) - } - super(message, options) - this.code = 'ABORT_ERR' - this.name = 'AbortError' - } - } - E('ERR_ASSERTION', '%s', Error) - E( - 'ERR_INVALID_ARG_TYPE', - (name, expected, actual) => { - assert(typeof name === 'string', "'name' must be a string") - if (!Array.isArray(expected)) { - expected = [expected] - } - let msg = 'The ' - if (name.endsWith(' argument')) { - // For cases like 'first argument' - msg += `${name} ` + writable: true, + enumerable: false, + configurable: true + } + }) + NodeError.prototype.code = code + NodeError.prototype[kIsNodeError] = true + codes[code] = NodeError +} +function hideStackFrames(fn) { + // We rename the functions that will be hidden to cut off the stacktrace + // at the outermost one + const hidden = nodeInternalPrefix + fn.name + Object.defineProperty(fn, 'name', { + value: hidden + }) + return fn +} +function aggregateTwoErrors(innerError, outerError) { + if (innerError && outerError && innerError !== outerError) { + if (Array.isArray(outerError.errors)) { + // If `outerError` is already an `AggregateError`. + outerError.errors.push(innerError) + return outerError + } + const err = new AggregateError([outerError, innerError], outerError.message) + err.code = outerError.code + return err + } + return innerError || outerError +} +class AbortError extends Error { + constructor(message = 'The operation was aborted', options = undefined) { + if (options !== undefined && typeof options !== 'object') { + throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) + } + super(message, options) + this.code = 'ABORT_ERR' + this.name = 'AbortError' + } +} +E('ERR_ASSERTION', '%s', Error) +E( + 'ERR_INVALID_ARG_TYPE', + (name, expected, actual) => { + assert(typeof name === 'string', "'name' must be a string") + if (!Array.isArray(expected)) { + expected = [expected] + } + let msg = 'The ' + if (name.endsWith(' argument')) { + // For cases like 'first argument' + msg += `${name} ` + } else { + msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` + } + msg += 'must be ' + const types = [] + const instances = [] + const other = [] + for (const value of expected) { + assert(typeof value === 'string', 'All expected entries have to be of type string') + if (kTypes.includes(value)) { + types.push(value.toLowerCase()) + } else if (classRegExp.test(value)) { + instances.push(value) } else { - msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` - } - msg += 'must be ' - const types = [] - const instances = [] - const other = [] - for (const value of expected) { - assert(typeof value === 'string', 'All expected entries have to be of type string') - if (kTypes.includes(value)) { - types.push(value.toLowerCase()) - } else if (classRegExp.test(value)) { - instances.push(value) - } else { - assert(value !== 'object', 'The value "object" should be written as "Object"') - other.push(value) - } - } - - // Special handle `object` in case other instances are allowed to outline - // the differences between each other. - if (instances.length > 0) { - const pos = types.indexOf('object') - if (pos !== -1) { - types.splice(types, pos, 1) - instances.push('Object') - } - } - if (types.length > 0) { - switch (types.length) { - case 1: - msg += `of type ${types[0]}` - break - case 2: - msg += `one of type ${types[0]} or ${types[1]}` - break - default: { - const last = types.pop() - msg += `one of type ${types.join(', ')}, or ${last}` - } - } - if (instances.length > 0 || other.length > 0) { - msg += ' or ' - } + assert(value !== 'object', 'The value "object" should be written as "Object"') + other.push(value) } - if (instances.length > 0) { - switch (instances.length) { - case 1: - msg += `an instance of ${instances[0]}` - break - case 2: - msg += `an instance of ${instances[0]} or ${instances[1]}` - break - default: { - const last = instances.pop() - msg += `an instance of ${instances.join(', ')}, or ${last}` - } - } - if (other.length > 0) { - msg += ' or ' - } + } + + // Special handle `object` in case other instances are allowed to outline + // the differences between each other. + if (instances.length > 0) { + const pos = types.indexOf('object') + if (pos !== -1) { + types.splice(types, pos, 1) + instances.push('Object') } - switch (other.length) { - case 0: - break + } + if (types.length > 0) { + switch (types.length) { case 1: - if (other[0].toLowerCase() !== other[0]) { - msg += 'an ' - } - msg += `${other[0]}` + msg += `of type ${types[0]}` break case 2: - msg += `one of ${other[0]} or ${other[1]}` + msg += `one of type ${types[0]} or ${types[1]}` break default: { - const last = other.pop() - msg += `one of ${other.join(', ')}, or ${last}` + const last = types.pop() + msg += `one of type ${types.join(', ')}, or ${last}` } } - if (actual == null) { - msg += `. Received ${actual}` - } else if (typeof actual === 'function' && actual.name) { - msg += `. Received function ${actual.name}` - } else if (typeof actual === 'object') { - var _actual$constructor - if ( - (_actual$constructor = actual.constructor) !== null && - _actual$constructor !== undefined && - _actual$constructor.name - ) { - msg += `. Received an instance of ${actual.constructor.name}` - } else { - const inspected = inspect(actual, { - depth: -1 - }) - msg += `. Received ${inspected}` - } - } else { - let inspected = inspect(actual, { - colors: false - }) - if (inspected.length > 25) { - inspected = `${inspected.slice(0, 25)}...` - } - msg += `. Received type ${typeof actual} (${inspected})` + if (instances.length > 0 || other.length > 0) { + msg += ' or ' } - return msg - }, - TypeError - ) - E( - 'ERR_INVALID_ARG_VALUE', - (name, value, reason = 'is invalid') => { - let inspected = inspect(value) - if (inspected.length > 128) { - inspected = inspected.slice(0, 128) + '...' - } - const type = name.includes('.') ? 'property' : 'argument' - return `The ${type} '${name}' ${reason}. Received ${inspected}` - }, - TypeError - ) - E( - 'ERR_INVALID_RETURN_VALUE', - (input, name, value) => { - var _value$constructor - const type = - value !== null && - value !== undefined && - (_value$constructor = value.constructor) !== null && - _value$constructor !== undefined && - _value$constructor.name - ? `instance of ${value.constructor.name}` - : `type ${typeof value}` - return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` - }, - TypeError - ) - E( - 'ERR_MISSING_ARGS', - (...args) => { - assert(args.length > 0, 'At least one arg needs to be specified') - let msg - const len = args.length - args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') - switch (len) { + } + if (instances.length > 0) { + switch (instances.length) { case 1: - msg += `The ${args[0]} argument` + msg += `an instance of ${instances[0]}` break case 2: - msg += `The ${args[0]} and ${args[1]} arguments` - break - default: - { - const last = args.pop() - msg += `The ${args.join(', ')}, and ${last} arguments` - } + msg += `an instance of ${instances[0]} or ${instances[1]}` break + default: { + const last = instances.pop() + msg += `an instance of ${instances.join(', ')}, or ${last}` + } } - return `${msg} must be specified` - }, - TypeError - ) - E( - 'ERR_OUT_OF_RANGE', - (str, range, input) => { - assert(range, 'Missing "range" argument') - let received - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > 2n ** 32n || input < -(2n ** 32n)) { - received = addNumericalSeparator(received) - } - received += 'n' - } else { - received = inspect(input) + if (other.length > 0) { + msg += ' or ' } - return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` - }, - RangeError - ) - E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) - E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) - E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) - E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) - E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) - E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) - E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) - E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) - E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) - E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) - E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) - module.exports = { - AbortError, - aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), - hideStackFrames, - codes - } - - - /***/ }), - - /***/ 78969: - /***/ ((module) => { - - "use strict"; - - - /* - This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js - - Don't try to replace with the original file and keep it up to date with the upstream file. - */ - module.exports = { - ArrayIsArray(self) { - return Array.isArray(self) - }, - ArrayPrototypeIncludes(self, el) { - return self.includes(el) - }, - ArrayPrototypeIndexOf(self, el) { - return self.indexOf(el) - }, - ArrayPrototypeJoin(self, sep) { - return self.join(sep) - }, - ArrayPrototypeMap(self, fn) { - return self.map(fn) - }, - ArrayPrototypePop(self, el) { - return self.pop(el) - }, - ArrayPrototypePush(self, el) { - return self.push(el) - }, - ArrayPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - Error, - FunctionPrototypeCall(fn, thisArgs, ...args) { - return fn.call(thisArgs, ...args) - }, - FunctionPrototypeSymbolHasInstance(self, instance) { - return Function.prototype[Symbol.hasInstance].call(self, instance) - }, - MathFloor: Math.floor, - Number, - NumberIsInteger: Number.isInteger, - NumberIsNaN: Number.isNaN, - NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, - NumberParseInt: Number.parseInt, - ObjectDefineProperties(self, props) { - return Object.defineProperties(self, props) - }, - ObjectDefineProperty(self, name, prop) { - return Object.defineProperty(self, name, prop) - }, - ObjectGetOwnPropertyDescriptor(self, name) { - return Object.getOwnPropertyDescriptor(self, name) - }, - ObjectKeys(obj) { - return Object.keys(obj) - }, - ObjectSetPrototypeOf(target, proto) { - return Object.setPrototypeOf(target, proto) - }, - Promise, - PromisePrototypeCatch(self, fn) { - return self.catch(fn) - }, - PromisePrototypeThen(self, thenFn, catchFn) { - return self.then(thenFn, catchFn) - }, - PromiseReject(err) { - return Promise.reject(err) - }, - ReflectApply: Reflect.apply, - RegExpPrototypeTest(self, value) { - return self.test(value) - }, - SafeSet: Set, - String, - StringPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - StringPrototypeToLowerCase(self) { - return self.toLowerCase() - }, - StringPrototypeToUpperCase(self) { - return self.toUpperCase() - }, - StringPrototypeTrim(self) { - return self.trim() - }, - Symbol, - SymbolFor: Symbol.for, - SymbolAsyncIterator: Symbol.asyncIterator, - SymbolHasInstance: Symbol.hasInstance, - SymbolIterator: Symbol.iterator, - TypedArrayPrototypeSet(self, buf, len) { - return self.set(buf, len) - }, - Uint8Array - } - - - /***/ }), - - /***/ 64083: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const bufferModule = __webpack_require__(2486) - const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor - const Blob = globalThis.Blob || bufferModule.Blob - /* eslint-disable indent */ - const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - // eslint-disable-next-line indent - return b instanceof Blob - } - : function isBlob(b) { - return false - } - /* eslint-enable indent */ - - // This is a simplified version of AggregateError - class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) - } - let message = '' - for (let i = 0; i < errors.length; i++) { - message += ` ${errors[i].stack}\n` - } - super(message) - this.name = 'AggregateError' - this.errors = errors - } - } - module.exports = { - AggregateError, - kEmptyObject: Object.freeze({}), - once(callback) { - let called = false - return function (...args) { - if (called) { - return + } + switch (other.length) { + case 0: + break + case 1: + if (other[0].toLowerCase() !== other[0]) { + msg += 'an ' } - called = true - callback.apply(this, args) - } - }, - createDeferredPromise: function () { - let resolve - let reject - - // eslint-disable-next-line promise/param-names - const promise = new Promise((res, rej) => { - resolve = res - reject = rej - }) - return { - promise, - resolve, - reject + msg += `${other[0]}` + break + case 2: + msg += `one of ${other[0]} or ${other[1]}` + break + default: { + const last = other.pop() + msg += `one of ${other.join(', ')}, or ${last}` } - }, - promisify(fn) { - return new Promise((resolve, reject) => { - fn((err, ...args) => { - if (err) { - return reject(err) - } - return resolve(...args) + } + if (actual == null) { + msg += `. Received ${actual}` + } else if (typeof actual === 'function' && actual.name) { + msg += `. Received function ${actual.name}` + } else if (typeof actual === 'object') { + var _actual$constructor + if ( + (_actual$constructor = actual.constructor) !== null && + _actual$constructor !== undefined && + _actual$constructor.name + ) { + msg += `. Received an instance of ${actual.constructor.name}` + } else { + const inspected = inspect(actual, { + depth: -1 }) + msg += `. Received ${inspected}` + } + } else { + let inspected = inspect(actual, { + colors: false }) - }, - debuglog() { - return function () {} - }, - format(format, ...args) { - // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args - return format.replace(/%([sdifj])/g, function (...[_unused, type]) { - const replacement = args.shift() - if (type === 'f') { - return replacement.toFixed(6) - } else if (type === 'j') { - return JSON.stringify(replacement) - } else if (type === 's' && typeof replacement === 'object') { - const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' - return `${ctor} {}`.trim() - } else { - return replacement.toString() - } - }) - }, - inspect(value) { - // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options - switch (typeof value) { - case 'string': - if (value.includes("'")) { - if (!value.includes('"')) { - return `"${value}"` - } else if (!value.includes('`') && !value.includes('${')) { - return `\`${value}\`` - } - } - return `'${value}'` - case 'number': - if (isNaN(value)) { - return 'NaN' - } else if (Object.is(value, -0)) { - return String(value) - } - return value - case 'bigint': - return `${String(value)}n` - case 'boolean': - case 'undefined': - return String(value) - case 'object': - return '{}' + if (inspected.length > 25) { + inspected = `${inspected.slice(0, 25)}...` } - }, - types: { - isAsyncFunction(fn) { - return fn instanceof AsyncFunction - }, - isArrayBufferView(arr) { - return ArrayBuffer.isView(arr) + msg += `. Received type ${typeof actual} (${inspected})` + } + return msg + }, + TypeError +) +E( + 'ERR_INVALID_ARG_VALUE', + (name, value, reason = 'is invalid') => { + let inspected = inspect(value) + if (inspected.length > 128) { + inspected = inspected.slice(0, 128) + '...' + } + const type = name.includes('.') ? 'property' : 'argument' + return `The ${type} '${name}' ${reason}. Received ${inspected}` + }, + TypeError +) +E( + 'ERR_INVALID_RETURN_VALUE', + (input, name, value) => { + var _value$constructor + const type = + value !== null && + value !== undefined && + (_value$constructor = value.constructor) !== null && + _value$constructor !== undefined && + _value$constructor.name + ? `instance of ${value.constructor.name}` + : `type ${typeof value}` + return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` + }, + TypeError +) +E( + 'ERR_MISSING_ARGS', + (...args) => { + assert(args.length > 0, 'At least one arg needs to be specified') + let msg + const len = args.length + args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') + switch (len) { + case 1: + msg += `The ${args[0]} argument` + break + case 2: + msg += `The ${args[0]} and ${args[1]} arguments` + break + default: + { + const last = args.pop() + msg += `The ${args.join(', ')}, and ${last} arguments` + } + break + } + return `${msg} must be specified` + }, + TypeError +) +E( + 'ERR_OUT_OF_RANGE', + (str, range, input) => { + assert(range, 'Missing "range" argument') + let received + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > 2n ** 32n || input < -(2n ** 32n)) { + received = addNumericalSeparator(received) + } + received += 'n' + } else { + received = inspect(input) + } + return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` + }, + RangeError +) +E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) +E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) +E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) +E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) +E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) +E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) +E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) +E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) +E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) +E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) +E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) +module.exports = { + AbortError, + aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), + hideStackFrames, + codes +} + + +/***/ }), + +/***/ 78969: +/***/ ((module) => { + +"use strict"; + + +/* + This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at + + https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js + + Don't try to replace with the original file and keep it up to date with the upstream file. +*/ +module.exports = { + ArrayIsArray(self) { + return Array.isArray(self) + }, + ArrayPrototypeIncludes(self, el) { + return self.includes(el) + }, + ArrayPrototypeIndexOf(self, el) { + return self.indexOf(el) + }, + ArrayPrototypeJoin(self, sep) { + return self.join(sep) + }, + ArrayPrototypeMap(self, fn) { + return self.map(fn) + }, + ArrayPrototypePop(self, el) { + return self.pop(el) + }, + ArrayPrototypePush(self, el) { + return self.push(el) + }, + ArrayPrototypeSlice(self, start, end) { + return self.slice(start, end) + }, + Error, + FunctionPrototypeCall(fn, thisArgs, ...args) { + return fn.call(thisArgs, ...args) + }, + FunctionPrototypeSymbolHasInstance(self, instance) { + return Function.prototype[Symbol.hasInstance].call(self, instance) + }, + MathFloor: Math.floor, + Number, + NumberIsInteger: Number.isInteger, + NumberIsNaN: Number.isNaN, + NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, + NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, + NumberParseInt: Number.parseInt, + ObjectDefineProperties(self, props) { + return Object.defineProperties(self, props) + }, + ObjectDefineProperty(self, name, prop) { + return Object.defineProperty(self, name, prop) + }, + ObjectGetOwnPropertyDescriptor(self, name) { + return Object.getOwnPropertyDescriptor(self, name) + }, + ObjectKeys(obj) { + return Object.keys(obj) + }, + ObjectSetPrototypeOf(target, proto) { + return Object.setPrototypeOf(target, proto) + }, + Promise, + PromisePrototypeCatch(self, fn) { + return self.catch(fn) + }, + PromisePrototypeThen(self, thenFn, catchFn) { + return self.then(thenFn, catchFn) + }, + PromiseReject(err) { + return Promise.reject(err) + }, + ReflectApply: Reflect.apply, + RegExpPrototypeTest(self, value) { + return self.test(value) + }, + SafeSet: Set, + String, + StringPrototypeSlice(self, start, end) { + return self.slice(start, end) + }, + StringPrototypeToLowerCase(self) { + return self.toLowerCase() + }, + StringPrototypeToUpperCase(self) { + return self.toUpperCase() + }, + StringPrototypeTrim(self) { + return self.trim() + }, + Symbol, + SymbolFor: Symbol.for, + SymbolAsyncIterator: Symbol.asyncIterator, + SymbolHasInstance: Symbol.hasInstance, + SymbolIterator: Symbol.iterator, + TypedArrayPrototypeSet(self, buf, len) { + return self.set(buf, len) + }, + Uint8Array +} + + +/***/ }), + +/***/ 64083: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const bufferModule = __webpack_require__(2486) +const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor +const Blob = globalThis.Blob || bufferModule.Blob +/* eslint-disable indent */ +const isBlob = + typeof Blob !== 'undefined' + ? function isBlob(b) { + // eslint-disable-next-line indent + return b instanceof Blob + } + : function isBlob(b) { + return false } - }, - isBlob - } - module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') - - - /***/ }), - - /***/ 95808: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const { Buffer } = __webpack_require__(2486) - - /* replacement end */ - // 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') - const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(78969) - const { - promisify: { custom: customPromisify } - } = __webpack_require__(64083) - const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(69057) - const { - codes: { ERR_ILLEGAL_CONSTRUCTOR } - } = __webpack_require__(57186) - const compose = __webpack_require__(80150) - const { pipeline } = __webpack_require__(93002) - const { destroyer } = __webpack_require__(79638) - const eos = __webpack_require__(28425) - const internalBuffer = {} - const promises = __webpack_require__(73428) - const utils = __webpack_require__(19654) - const Stream = (module.exports = __webpack_require__(94965).Stream) - Stream.isDisturbed = utils.isDisturbed - Stream.isErrored = utils.isErrored - Stream.isReadable = utils.isReadable - Stream.Readable = __webpack_require__(69293) - for (const key of ObjectKeys(streamReturningOperators)) { - const op = streamReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return Stream.Readable.from(ReflectApply(op, this, args)) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) - } - for (const key of ObjectKeys(promiseReturningOperators)) { - const op = promiseReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() +/* eslint-enable indent */ + +// This is a simplified version of AggregateError +class AggregateError extends Error { + constructor(errors) { + if (!Array.isArray(errors)) { + throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) + } + let message = '' + for (let i = 0; i < errors.length; i++) { + message += ` ${errors[i].stack}\n` + } + super(message) + this.name = 'AggregateError' + this.errors = errors + } +} +module.exports = { + AggregateError, + kEmptyObject: Object.freeze({}), + once(callback) { + let called = false + return function (...args) { + if (called) { + return } - return ReflectApply(op, this, args) + called = true + callback.apply(this, args) } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name + }, + createDeferredPromise: function () { + let resolve + let reject + + // eslint-disable-next-line promise/param-names + const promise = new Promise((res, rej) => { + resolve = res + reject = rej }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length + return { + promise, + resolve, + reject + } + }, + promisify(fn) { + return new Promise((resolve, reject) => { + fn((err, ...args) => { + if (err) { + return reject(err) + } + return resolve(...args) + }) }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true + }, + debuglog() { + return function () {} + }, + format(format, ...args) { + // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args + return format.replace(/%([sdifj])/g, function (...[_unused, type]) { + const replacement = args.shift() + if (type === 'f') { + return replacement.toFixed(6) + } else if (type === 'j') { + return JSON.stringify(replacement) + } else if (type === 's' && typeof replacement === 'object') { + const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' + return `${ctor} {}`.trim() + } else { + return replacement.toString() + } }) - } - Stream.Writable = __webpack_require__(7282) - Stream.Duplex = __webpack_require__(56725) - Stream.Transform = __webpack_require__(51314) - Stream.PassThrough = __webpack_require__(92817) - Stream.pipeline = pipeline - const { addAbortSignal } = __webpack_require__(7445) - Stream.addAbortSignal = addAbortSignal - Stream.finished = eos - Stream.destroy = destroyer - Stream.compose = compose - ObjectDefineProperty(Stream, 'promises', { - __proto__: null, - configurable: true, - enumerable: true, - get() { - return promises + }, + inspect(value) { + // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options + switch (typeof value) { + case 'string': + if (value.includes("'")) { + if (!value.includes('"')) { + return `"${value}"` + } else if (!value.includes('`') && !value.includes('${')) { + return `\`${value}\`` + } + } + return `'${value}'` + case 'number': + if (isNaN(value)) { + return 'NaN' + } else if (Object.is(value, -0)) { + return String(value) + } + return value + case 'bigint': + return `${String(value)}n` + case 'boolean': + case 'undefined': + return String(value) + case 'object': + return '{}' + } + }, + types: { + isAsyncFunction(fn) { + return fn instanceof AsyncFunction + }, + isArrayBufferView(arr) { + return ArrayBuffer.isView(arr) } + }, + isBlob +} +module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') + + +/***/ }), + +/***/ 95808: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const { Buffer } = __webpack_require__(2486) + +/* replacement end */ +// 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') +const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(78969) +const { + promisify: { custom: customPromisify } +} = __webpack_require__(64083) +const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(69057) +const { + codes: { ERR_ILLEGAL_CONSTRUCTOR } +} = __webpack_require__(57186) +const compose = __webpack_require__(80150) +const { pipeline } = __webpack_require__(93002) +const { destroyer } = __webpack_require__(79638) +const eos = __webpack_require__(28425) +const internalBuffer = {} +const promises = __webpack_require__(73428) +const utils = __webpack_require__(19654) +const Stream = (module.exports = __webpack_require__(94965).Stream) +Stream.isDisturbed = utils.isDisturbed +Stream.isErrored = utils.isErrored +Stream.isReadable = utils.isReadable +Stream.Readable = __webpack_require__(69293) +for (const key of ObjectKeys(streamReturningOperators)) { + const op = streamReturningOperators[key] + function fn(...args) { + if (new.target) { + throw ERR_ILLEGAL_CONSTRUCTOR() + } + return Stream.Readable.from(ReflectApply(op, this, args)) + } + ObjectDefineProperty(fn, 'name', { + __proto__: null, + value: op.name }) - ObjectDefineProperty(pipeline, customPromisify, { + ObjectDefineProperty(fn, 'length', { __proto__: null, - enumerable: true, - get() { - return promises.pipeline - } + value: op.length }) - ObjectDefineProperty(eos, customPromisify, { + ObjectDefineProperty(Stream.Readable.prototype, key, { __proto__: null, - enumerable: true, - get() { - return promises.finished - } + value: fn, + enumerable: false, + configurable: true, + writable: true }) - - // Backwards-compat with node 0.4.x - Stream.Stream = Stream - Stream._isUint8Array = function isUint8Array(value) { - return value instanceof Uint8Array - } - Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - } - - - /***/ }), - - /***/ 73428: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { ArrayPrototypePop, Promise } = __webpack_require__(78969) - const { isIterable, isNodeStream, isWebStream } = __webpack_require__(19654) - const { pipelineImpl: pl } = __webpack_require__(93002) - const { finished } = __webpack_require__(28425) - __webpack_require__(95808) - function pipeline(...streams) { - return new Promise((resolve, reject) => { - let signal - let end - const lastArg = streams[streams.length - 1] - if ( - lastArg && - typeof lastArg === 'object' && - !isNodeStream(lastArg) && - !isIterable(lastArg) && - !isWebStream(lastArg) - ) { - const options = ArrayPrototypePop(streams) - signal = options.signal - end = options.end - } - pl( - streams, - (err, value) => { - if (err) { - reject(err) - } else { - resolve(value) - } - }, - { - signal, - end - } - ) - }) - } - module.exports = { - finished, - pipeline - } - - - /***/ }), - - /***/ 10113: - /***/ ((module) => { - - var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; - var XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string'; - - function Generator(options) { - this._options = options = options || {}; - - var prefixes = options.prefixes || {}; - this._prefixByIri = {}; - var prefixIris = []; - for (var prefix in prefixes) { - var iri = prefixes[prefix]; - if (isString(iri)) { - this._prefixByIri[iri] = prefix; - prefixIris.push(iri); - } - } - var iriList = prefixIris.join('|').replace(/[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); - this._prefixRegex = new RegExp('^(' + iriList + ')([a-zA-Z][\\-_a-zA-Z0-9]*)$'); - this._usedPrefixes = {}; - this._sparqlStar = options.sparqlStar; - this._indent = isString(options.indent) ? options.indent : ' '; - this._newline = isString(options.newline) ? options.newline : '\n'; - this._explicitDatatype = Boolean(options.explicitDatatype); - } - - // Converts the parsed query object into a SPARQL query - Generator.prototype.toQuery = function (q) { - var query = ''; - - if (q.queryType) - query += q.queryType.toUpperCase() + ' '; - if (q.reduced) - query += 'REDUCED '; - if (q.distinct) - query += 'DISTINCT '; - - if (q.variables){ - query += mapJoin(q.variables, undefined, function (variable) { - return isTerm(variable) ? this.toEntity(variable) : - '(' + this.toExpression(variable.expression) + ' AS ' + variableToString(variable.variable) + ')'; - }, this) + ' '; - } - else if (q.template) - query += this.group(q.template, true) + this._newline; - - if (q.from) - query += this.graphs('FROM ', q.from.default) + this.graphs('FROM NAMED ', q.from.named); - if (q.where) - query += 'WHERE ' + this.group(q.where, true) + this._newline; - - if (q.updates) - query += mapJoin(q.updates, ';' + this._newline, this.toUpdate, this); - - if (q.group) - query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { - var result = isTerm(it.expression) - ? this.toEntity(it.expression) - : '(' + this.toExpression(it.expression) + ')'; - return it.variable ? '(' + result + ' AS ' + variableToString(it.variable) + ')' : result; - }, this) + this._newline; - if (q.having) - query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; - if (q.order) - query += 'ORDER BY ' + mapJoin(q.order, undefined, function (it) { - var expr = '(' + this.toExpression(it.expression) + ')'; - return !it.descending ? expr : 'DESC ' + expr; - }, this) + this._newline; - - if (q.offset) - query += 'OFFSET ' + q.offset + this._newline; - if (q.limit) - query += 'LIMIT ' + q.limit + this._newline; - - if (q.values) - query += this.values(q); - - // stringify prefixes at the end to mark used ones - query = this.baseAndPrefixes(q) + query; - return query.trim(); - }; - - Generator.prototype.baseAndPrefixes = function (q) { - var base = q.base ? ('BASE <' + q.base + '>' + this._newline) : ''; - var prefixes = ''; - for (var key in q.prefixes) { - if (this._options.allPrefixes || this._usedPrefixes[key]) - prefixes += 'PREFIX ' + key + ': <' + q.prefixes[key] + '>' + this._newline; - } - return base + prefixes; - }; - - // Converts the parsed SPARQL pattern into a SPARQL pattern - Generator.prototype.toPattern = function (pattern) { - var type = pattern.type || (pattern instanceof Array) && 'array' || - (pattern.subject && pattern.predicate && pattern.object ? 'triple' : ''); - if (!(type in this)) - throw new Error('Unknown entry type: ' + type); - return this[type](pattern); - }; - - Generator.prototype.triple = function (t) { - return this.toEntity(t.subject) + ' ' + this.toEntity(t.predicate) + ' ' + this.toEntity(t.object) + '.'; - }; - - Generator.prototype.array = function (items) { - return mapJoin(items, this._newline, this.toPattern, this); - }; - - Generator.prototype.bgp = function (bgp) { - return this.encodeTriples(bgp.triples); - }; - - Generator.prototype.encodeTriples = function (triples) { - if (!triples.length) - return ''; - - var parts = [], subject = undefined, predicate = undefined; - for (var i = 0; i < triples.length; i++) { - var triple = triples[i]; - // Triple with different subject - if (!equalTerms(triple.subject, subject)) { - // Terminate previous triple - if (subject) - parts.push('.' + this._newline); - subject = triple.subject; - predicate = triple.predicate; - parts.push(this.toEntity(subject), ' ', this.toEntity(predicate)); - } - // Triple with same subject but different predicate - else if (!equalTerms(triple.predicate, predicate)) { - predicate = triple.predicate; - parts.push(';' + this._newline, this._indent, this.toEntity(predicate)); - } - // Triple with same subject and predicate - else { - parts.push(','); - } - parts.push(' ', this.toEntity(triple.object)); +} +for (const key of ObjectKeys(promiseReturningOperators)) { + const op = promiseReturningOperators[key] + function fn(...args) { + if (new.target) { + throw ERR_ILLEGAL_CONSTRUCTOR() } - parts.push('.'); - - return parts.join(''); + return ReflectApply(op, this, args) } - - Generator.prototype.graph = function (graph) { - return 'GRAPH ' + this.toEntity(graph.name) + ' ' + this.group(graph); - }; - - Generator.prototype.graphs = function (keyword, graphs) { - return !graphs || graphs.length === 0 ? '' : - mapJoin(graphs, '', function (g) { return keyword + this.toEntity(g) + this._newline; }, this) - } - - Generator.prototype.group = function (group, inline) { - group = inline !== true ? this.array(group.patterns || group.triples) - : this.toPattern(group.type !== 'group' ? group : group.patterns); - return group.indexOf(this._newline) === -1 ? '{ ' + group + ' }' : '{' + this._newline + this.indent(group) + this._newline + '}'; - }; - - Generator.prototype.query = function (query) { - return this.toQuery(query); - }; - - Generator.prototype.filter = function (filter) { - return 'FILTER(' + this.toExpression(filter.expression) + ')'; - }; - - Generator.prototype.bind = function (bind) { - return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + variableToString(bind.variable) + ')'; - }; - - Generator.prototype.optional = function (optional) { - return 'OPTIONAL ' + this.group(optional); - }; - - Generator.prototype.union = function (union) { - return mapJoin(union.patterns, this._newline + 'UNION' + this._newline, function (p) { return this.group(p, true); }, this); - }; - - Generator.prototype.minus = function (minus) { - return 'MINUS ' + this.group(minus); - }; - - Generator.prototype.values = function (valuesList) { - // Gather unique keys - var keys = Object.keys(valuesList.values.reduce(function (keyHash, values) { - for (var key in values) keyHash[key] = true; - return keyHash; - }, {})); - // Check whether simple syntax can be used - var lparen, rparen; - if (keys.length === 1) { - lparen = rparen = ''; - } else { - lparen = '('; - rparen = ')'; - } - // Create value rows - return 'VALUES ' + lparen + keys.join(' ') + rparen + ' {' + this._newline + - mapJoin(valuesList.values, this._newline, function (values) { - return ' ' + lparen + mapJoin(keys, undefined, function (key) { - return values[key] ? this.toEntity(values[key]) : 'UNDEF'; - }, this) + rparen; - }, this) + this._newline + '}'; - }; - - Generator.prototype.service = function (service) { - return 'SERVICE ' + (service.silent ? 'SILENT ' : '') + this.toEntity(service.name) + ' ' + - this.group(service); - }; - - // Converts the parsed expression object into a SPARQL expression - Generator.prototype.toExpression = function (expr) { - if (isTerm(expr)) { - return this.toEntity(expr); - } - switch (expr.type.toLowerCase()) { - case 'aggregate': - return expr.aggregation.toUpperCase() + - '(' + (expr.distinct ? 'DISTINCT ' : '') + this.toExpression(expr.expression) + - (typeof expr.separator === 'string' ? '; SEPARATOR = ' + '"' + expr.separator.replace(escape, escapeReplacer) + '"' : '') + ')'; - case 'functioncall': - return this.toEntity(expr.function) + '(' + mapJoin(expr.args, ', ', this.toExpression, this) + ')'; - case 'operation': - var operator = expr.operator.toUpperCase(), args = expr.args || []; - switch (expr.operator.toLowerCase()) { - // Infix operators - case '<': - case '>': - case '>=': - case '<=': - case '&&': - case '||': - case '=': - case '!=': - case '+': - case '-': - case '*': - case '/': - return (isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + - ' ' + operator + ' ' + - (isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); - // Unary operators - case '!': - return '!(' + this.toExpression(args[0]) + ')'; - case 'uplus': - return '+(' + this.toExpression(args[0]) + ')'; - case 'uminus': - return '-(' + this.toExpression(args[0]) + ')'; - // IN and NOT IN - case 'notin': - operator = 'NOT IN'; - case 'in': - return this.toExpression(args[0]) + ' ' + operator + - '(' + (isString(args[1]) ? args[1] : mapJoin(args[1], ', ', this.toExpression, this)) + ')'; - // EXISTS and NOT EXISTS - case 'notexists': - operator = 'NOT EXISTS'; - case 'exists': - return operator + ' ' + this.group(args[0], true); - // Other expressions - default: - return operator + '(' + mapJoin(args, ', ', this.toExpression, this) + ')'; - } - default: - throw new Error('Unknown expression type: ' + expr.type); + ObjectDefineProperty(fn, 'name', { + __proto__: null, + value: op.name + }) + ObjectDefineProperty(fn, 'length', { + __proto__: null, + value: op.length + }) + ObjectDefineProperty(Stream.Readable.prototype, key, { + __proto__: null, + value: fn, + enumerable: false, + configurable: true, + writable: true + }) +} +Stream.Writable = __webpack_require__(7282) +Stream.Duplex = __webpack_require__(56725) +Stream.Transform = __webpack_require__(51314) +Stream.PassThrough = __webpack_require__(92817) +Stream.pipeline = pipeline +const { addAbortSignal } = __webpack_require__(7445) +Stream.addAbortSignal = addAbortSignal +Stream.finished = eos +Stream.destroy = destroyer +Stream.compose = compose +ObjectDefineProperty(Stream, 'promises', { + __proto__: null, + configurable: true, + enumerable: true, + get() { + return promises + } +}) +ObjectDefineProperty(pipeline, customPromisify, { + __proto__: null, + enumerable: true, + get() { + return promises.pipeline + } +}) +ObjectDefineProperty(eos, customPromisify, { + __proto__: null, + enumerable: true, + get() { + return promises.finished + } +}) + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream +Stream._isUint8Array = function isUint8Array(value) { + return value instanceof Uint8Array +} +Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) +} + + +/***/ }), + +/***/ 73428: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { ArrayPrototypePop, Promise } = __webpack_require__(78969) +const { isIterable, isNodeStream, isWebStream } = __webpack_require__(19654) +const { pipelineImpl: pl } = __webpack_require__(93002) +const { finished } = __webpack_require__(28425) +__webpack_require__(95808) +function pipeline(...streams) { + return new Promise((resolve, reject) => { + let signal + let end + const lastArg = streams[streams.length - 1] + if ( + lastArg && + typeof lastArg === 'object' && + !isNodeStream(lastArg) && + !isIterable(lastArg) && + !isWebStream(lastArg) + ) { + const options = ArrayPrototypePop(streams) + signal = options.signal + end = options.end } - }; - - // Converts the parsed entity (or property path) into a SPARQL entity - Generator.prototype.toEntity = function (value) { - if (isTerm(value)) { - switch (value.termType) { - // variable, * selector, or blank node - case 'Wildcard': - return '*'; - case 'Variable': - return variableToString(value); - case 'BlankNode': - return '_:' + value.value; - // literal - case 'Literal': - var lexical = value.value || '', language = value.language || '', datatype = value.datatype; - value = '"' + lexical.replace(escape, escapeReplacer) + '"'; - if (language){ - value += '@' + language; - } else if (datatype) { - // Abbreviate literals when possible - if (!this._explicitDatatype) { - switch (datatype.value) { - case XSD_STRING: - return value; - case XSD_INTEGER: - if (/^\d+$/.test(lexical)) - // Add space to avoid confusion with decimals in broken parsers - return lexical + ' '; - } - } - value += '^^' + this.encodeIRI(datatype.value); + pl( + streams, + (err, value) => { + if (err) { + reject(err) + } else { + resolve(value) } - return value; - case 'Quad': - if (!this._sparqlStar) - throw new Error('SPARQL* support is not enabled'); - - if (value.graph && value.graph.termType !== "DefaultGraph") { - return '<< GRAPH ' + - this.toEntity(value.graph) + - ' { ' + - this.toEntity(value.subject) + ' ' + - this.toEntity(value.predicate) + ' ' + - this.toEntity(value.object) + - ' } ' + - ' >>' - } - else { - return ( - '<< ' + - this.toEntity(value.subject) + ' ' + - this.toEntity(value.predicate) + ' ' + - this.toEntity(value.object) + - ' >>' - ); - } - // IRI - default: - return this.encodeIRI(value.value); + }, + { + signal, + end } - } - // property path + ) + }) +} +module.exports = { + finished, + pipeline +} + + +/***/ }), + +/***/ 10113: +/***/ ((module) => { + +var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; +var XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string'; + +function Generator(options) { + this._options = options = options || {}; + + var prefixes = options.prefixes || {}; + this._prefixByIri = {}; + var prefixIris = []; + for (var prefix in prefixes) { + var iri = prefixes[prefix]; + if (isString(iri)) { + this._prefixByIri[iri] = prefix; + prefixIris.push(iri); + } + } + var iriList = prefixIris.join('|').replace(/[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); + this._prefixRegex = new RegExp('^(' + iriList + ')([a-zA-Z][\\-_a-zA-Z0-9]*)$'); + this._usedPrefixes = {}; + this._sparqlStar = options.sparqlStar; + this._indent = isString(options.indent) ? options.indent : ' '; + this._newline = isString(options.newline) ? options.newline : '\n'; + this._explicitDatatype = Boolean(options.explicitDatatype); +} + +// Converts the parsed query object into a SPARQL query +Generator.prototype.toQuery = function (q) { + var query = ''; + + if (q.queryType) + query += q.queryType.toUpperCase() + ' '; + if (q.reduced) + query += 'REDUCED '; + if (q.distinct) + query += 'DISTINCT '; + + if (q.variables){ + query += mapJoin(q.variables, undefined, function (variable) { + return isTerm(variable) ? this.toEntity(variable) : + '(' + this.toExpression(variable.expression) + ' AS ' + variableToString(variable.variable) + ')'; + }, this) + ' '; + } + else if (q.template) + query += this.group(q.template, true) + this._newline; + + if (q.from) + query += this.graphs('FROM ', q.from.default) + this.graphs('FROM NAMED ', q.from.named); + if (q.where) + query += 'WHERE ' + this.group(q.where, true) + this._newline; + + if (q.updates) + query += mapJoin(q.updates, ';' + this._newline, this.toUpdate, this); + + if (q.group) + query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { + var result = isTerm(it.expression) + ? this.toEntity(it.expression) + : '(' + this.toExpression(it.expression) + ')'; + return it.variable ? '(' + result + ' AS ' + variableToString(it.variable) + ')' : result; + }, this) + this._newline; + if (q.having) + query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; + if (q.order) + query += 'ORDER BY ' + mapJoin(q.order, undefined, function (it) { + var expr = '(' + this.toExpression(it.expression) + ')'; + return !it.descending ? expr : 'DESC ' + expr; + }, this) + this._newline; + + if (q.offset) + query += 'OFFSET ' + q.offset + this._newline; + if (q.limit) + query += 'LIMIT ' + q.limit + this._newline; + + if (q.values) + query += this.values(q); + + // stringify prefixes at the end to mark used ones + query = this.baseAndPrefixes(q) + query; + return query.trim(); +}; + +Generator.prototype.baseAndPrefixes = function (q) { + var base = q.base ? ('BASE <' + q.base + '>' + this._newline) : ''; + var prefixes = ''; + for (var key in q.prefixes) { + if (this._options.allPrefixes || this._usedPrefixes[key]) + prefixes += 'PREFIX ' + key + ': <' + q.prefixes[key] + '>' + this._newline; + } + return base + prefixes; +}; + +// Converts the parsed SPARQL pattern into a SPARQL pattern +Generator.prototype.toPattern = function (pattern) { + var type = pattern.type || (pattern instanceof Array) && 'array' || + (pattern.subject && pattern.predicate && pattern.object ? 'triple' : ''); + if (!(type in this)) + throw new Error('Unknown entry type: ' + type); + return this[type](pattern); +}; + +Generator.prototype.triple = function (t) { + return this.toEntity(t.subject) + ' ' + this.toEntity(t.predicate) + ' ' + this.toEntity(t.object) + '.'; +}; + +Generator.prototype.array = function (items) { + return mapJoin(items, this._newline, this.toPattern, this); +}; + +Generator.prototype.bgp = function (bgp) { + return this.encodeTriples(bgp.triples); +}; + +Generator.prototype.encodeTriples = function (triples) { + if (!triples.length) + return ''; + + var parts = [], subject = undefined, predicate = undefined; + for (var i = 0; i < triples.length; i++) { + var triple = triples[i]; + // Triple with different subject + if (!equalTerms(triple.subject, subject)) { + // Terminate previous triple + if (subject) + parts.push('.' + this._newline); + subject = triple.subject; + predicate = triple.predicate; + parts.push(this.toEntity(subject), ' ', this.toEntity(predicate)); + } + // Triple with same subject but different predicate + else if (!equalTerms(triple.predicate, predicate)) { + predicate = triple.predicate; + parts.push(';' + this._newline, this._indent, this.toEntity(predicate)); + } + // Triple with same subject and predicate else { - var items = value.items.map(this.toEntity, this), path = value.pathType; - switch (path) { - // prefix operator - case '^': - case '!': - return path + items[0]; - // postfix operator - case '*': + parts.push(','); + } + parts.push(' ', this.toEntity(triple.object)); + } + parts.push('.'); + + return parts.join(''); +} + +Generator.prototype.graph = function (graph) { + return 'GRAPH ' + this.toEntity(graph.name) + ' ' + this.group(graph); +}; + +Generator.prototype.graphs = function (keyword, graphs) { + return !graphs || graphs.length === 0 ? '' : + mapJoin(graphs, '', function (g) { return keyword + this.toEntity(g) + this._newline; }, this) +} + +Generator.prototype.group = function (group, inline) { + group = inline !== true ? this.array(group.patterns || group.triples) + : this.toPattern(group.type !== 'group' ? group : group.patterns); + return group.indexOf(this._newline) === -1 ? '{ ' + group + ' }' : '{' + this._newline + this.indent(group) + this._newline + '}'; +}; + +Generator.prototype.query = function (query) { + return this.toQuery(query); +}; + +Generator.prototype.filter = function (filter) { + return 'FILTER(' + this.toExpression(filter.expression) + ')'; +}; + +Generator.prototype.bind = function (bind) { + return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + variableToString(bind.variable) + ')'; +}; + +Generator.prototype.optional = function (optional) { + return 'OPTIONAL ' + this.group(optional); +}; + +Generator.prototype.union = function (union) { + return mapJoin(union.patterns, this._newline + 'UNION' + this._newline, function (p) { return this.group(p, true); }, this); +}; + +Generator.prototype.minus = function (minus) { + return 'MINUS ' + this.group(minus); +}; + +Generator.prototype.values = function (valuesList) { + // Gather unique keys + var keys = Object.keys(valuesList.values.reduce(function (keyHash, values) { + for (var key in values) keyHash[key] = true; + return keyHash; + }, {})); + // Check whether simple syntax can be used + var lparen, rparen; + if (keys.length === 1) { + lparen = rparen = ''; + } else { + lparen = '('; + rparen = ')'; + } + // Create value rows + return 'VALUES ' + lparen + keys.join(' ') + rparen + ' {' + this._newline + + mapJoin(valuesList.values, this._newline, function (values) { + return ' ' + lparen + mapJoin(keys, undefined, function (key) { + return values[key] ? this.toEntity(values[key]) : 'UNDEF'; + }, this) + rparen; + }, this) + this._newline + '}'; +}; + +Generator.prototype.service = function (service) { + return 'SERVICE ' + (service.silent ? 'SILENT ' : '') + this.toEntity(service.name) + ' ' + + this.group(service); +}; + +// Converts the parsed expression object into a SPARQL expression +Generator.prototype.toExpression = function (expr) { + if (isTerm(expr)) { + return this.toEntity(expr); + } + switch (expr.type.toLowerCase()) { + case 'aggregate': + return expr.aggregation.toUpperCase() + + '(' + (expr.distinct ? 'DISTINCT ' : '') + this.toExpression(expr.expression) + + (typeof expr.separator === 'string' ? '; SEPARATOR = ' + '"' + expr.separator.replace(escape, escapeReplacer) + '"' : '') + ')'; + case 'functioncall': + return this.toEntity(expr.function) + '(' + mapJoin(expr.args, ', ', this.toExpression, this) + ')'; + case 'operation': + var operator = expr.operator.toUpperCase(), args = expr.args || []; + switch (expr.operator.toLowerCase()) { + // Infix operators + case '<': + case '>': + case '>=': + case '<=': + case '&&': + case '||': + case '=': + case '!=': case '+': - case '?': - return '(' + items[0] + path + ')'; - // infix operator + case '-': + case '*': + case '/': + return (isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + + ' ' + operator + ' ' + + (isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); + // Unary operators + case '!': + return '!(' + this.toExpression(args[0]) + ')'; + case 'uplus': + return '+(' + this.toExpression(args[0]) + ')'; + case 'uminus': + return '-(' + this.toExpression(args[0]) + ')'; + // IN and NOT IN + case 'notin': + operator = 'NOT IN'; + case 'in': + return this.toExpression(args[0]) + ' ' + operator + + '(' + (isString(args[1]) ? args[1] : mapJoin(args[1], ', ', this.toExpression, this)) + ')'; + // EXISTS and NOT EXISTS + case 'notexists': + operator = 'NOT EXISTS'; + case 'exists': + return operator + ' ' + this.group(args[0], true); + // Other expressions default: - return '(' + items.join(path) + ')'; + return operator + '(' + mapJoin(args, ', ', this.toExpression, this) + ')'; } - } - }; - var escape = /["\\\t\n\r\b\f]/g, - escapeReplacer = function (c) { return escapeReplacements[c]; }, - escapeReplacements = { '\\': '\\\\', '"': '\\"', '\t': '\\t', - '\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f' }; - - // Represent the IRI, as a prefixed name when possible - Generator.prototype.encodeIRI = function (iri) { - var prefixMatch = this._prefixRegex.exec(iri); - if (prefixMatch) { - var prefix = this._prefixByIri[prefixMatch[1]]; - this._usedPrefixes[prefix] = true; - return prefix + ':' + prefixMatch[2]; - } - return '<' + iri + '>'; - }; - - // Converts the parsed update object into a SPARQL update clause - Generator.prototype.toUpdate = function (update) { - switch (update.type || update.updateType) { - case 'load': - return 'LOAD' + (update.source ? ' ' + this.toEntity(update.source) : '') + - (update.destination ? ' INTO GRAPH ' + this.toEntity(update.destination) : ''); - case 'insert': - return 'INSERT DATA ' + this.group(update.insert, true); - case 'delete': - return 'DELETE DATA ' + this.group(update.delete, true); - case 'deletewhere': - return 'DELETE WHERE ' + this.group(update.delete, true); - case 'insertdelete': - return (update.graph ? 'WITH ' + this.toEntity(update.graph) + this._newline : '') + - (update.delete.length ? 'DELETE ' + this.group(update.delete, true) + this._newline : '') + - (update.insert.length ? 'INSERT ' + this.group(update.insert, true) + this._newline : '') + - (update.using ? this.graphs('USING ', update.using.default) : '') + - (update.using ? this.graphs('USING NAMED ', update.using.named) : '') + - 'WHERE ' + this.group(update.where, true); - case 'add': - case 'copy': - case 'move': - return update.type.toUpperCase()+ ' ' + (update.silent ? 'SILENT ' : '') + (update.source.default ? 'DEFAULT' : this.toEntity(update.source.name)) + - ' TO ' + this.toEntity(update.destination.name); - case 'create': - case 'clear': - case 'drop': - return update.type.toUpperCase() + (update.silent ? ' SILENT ' : ' ') + ( - update.graph.default ? 'DEFAULT' : - update.graph.named ? 'NAMED' : - update.graph.all ? 'ALL' : - ('GRAPH ' + this.toEntity(update.graph.name)) - ); default: - throw new Error('Unknown update query type: ' + update.type); - } - }; - - // Indents each line of the string - Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._indent); } - - function variableToString(variable){ - return '?' + variable.value; - } - - // Checks whether the object is a string - function isString(object) { return typeof object === 'string'; } - - // Checks whether the object is a Term - function isTerm(object) { - return typeof object.termType === 'string'; - } - - // Checks whether term1 and term2 are equivalent without `.equals()` prototype method - function equalTerms(term1, term2) { - if (!term1 || !isTerm(term1)) { return false; } - if (!term2 || !isTerm(term2)) { return false; } - if (term1.termType !== term2.termType) { return false; } - switch (term1.termType) { - case 'Literal': - return term1.value === term2.value - && term1.language === term2.language - && equalTerms(term1.datatype, term2.datatype); - case 'Quad': - return equalTerms(term1.subject, term2.subject) - && equalTerms(term1.predicate, term2.predicate) - && equalTerms(term1.object, term2.object) - && equalTerms(term1.graph, term2.graph); - default: - return term1.value === term2.value; + throw new Error('Unknown expression type: ' + expr.type); + } +}; + +// Converts the parsed entity (or property path) into a SPARQL entity +Generator.prototype.toEntity = function (value) { + if (isTerm(value)) { + switch (value.termType) { + // variable, * selector, or blank node + case 'Wildcard': + return '*'; + case 'Variable': + return variableToString(value); + case 'BlankNode': + return '_:' + value.value; + // literal + case 'Literal': + var lexical = value.value || '', language = value.language || '', datatype = value.datatype; + value = '"' + lexical.replace(escape, escapeReplacer) + '"'; + if (language){ + value += '@' + language; + } else if (datatype) { + // Abbreviate literals when possible + if (!this._explicitDatatype) { + switch (datatype.value) { + case XSD_STRING: + return value; + case XSD_INTEGER: + if (/^\d+$/.test(lexical)) + // Add space to avoid confusion with decimals in broken parsers + return lexical + ' '; + } + } + value += '^^' + this.encodeIRI(datatype.value); + } + return value; + case 'Quad': + if (!this._sparqlStar) + throw new Error('SPARQL* support is not enabled'); + + if (value.graph && value.graph.termType !== "DefaultGraph") { + return '<< GRAPH ' + + this.toEntity(value.graph) + + ' { ' + + this.toEntity(value.subject) + ' ' + + this.toEntity(value.predicate) + ' ' + + this.toEntity(value.object) + + ' } ' + + ' >>' + } + else { + return ( + '<< ' + + this.toEntity(value.subject) + ' ' + + this.toEntity(value.predicate) + ' ' + + this.toEntity(value.object) + + ' >>' + ); + } + // IRI + default: + return this.encodeIRI(value.value); + } + } + // property path + else { + var items = value.items.map(this.toEntity, this), path = value.pathType; + switch (path) { + // prefix operator + case '^': + case '!': + return path + items[0]; + // postfix operator + case '*': + case '+': + case '?': + return '(' + items[0] + path + ')'; + // infix operator + default: + return '(' + items.join(path) + ')'; } } - - // Maps the array with the given function, and joins the results using the separator - function mapJoin(array, sep, func, self) { - return array.map(func, self).join(isString(sep) ? sep : ' '); +}; +var escape = /["\\\t\n\r\b\f]/g, + escapeReplacer = function (c) { return escapeReplacements[c]; }, + escapeReplacements = { '\\': '\\\\', '"': '\\"', '\t': '\\t', + '\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f' }; + +// Represent the IRI, as a prefixed name when possible +Generator.prototype.encodeIRI = function (iri) { + var prefixMatch = this._prefixRegex.exec(iri); + if (prefixMatch) { + var prefix = this._prefixByIri[prefixMatch[1]]; + this._usedPrefixes[prefix] = true; + return prefix + ':' + prefixMatch[2]; + } + return '<' + iri + '>'; +}; + +// Converts the parsed update object into a SPARQL update clause +Generator.prototype.toUpdate = function (update) { + switch (update.type || update.updateType) { + case 'load': + return 'LOAD' + (update.source ? ' ' + this.toEntity(update.source) : '') + + (update.destination ? ' INTO GRAPH ' + this.toEntity(update.destination) : ''); + case 'insert': + return 'INSERT DATA ' + this.group(update.insert, true); + case 'delete': + return 'DELETE DATA ' + this.group(update.delete, true); + case 'deletewhere': + return 'DELETE WHERE ' + this.group(update.delete, true); + case 'insertdelete': + return (update.graph ? 'WITH ' + this.toEntity(update.graph) + this._newline : '') + + (update.delete.length ? 'DELETE ' + this.group(update.delete, true) + this._newline : '') + + (update.insert.length ? 'INSERT ' + this.group(update.insert, true) + this._newline : '') + + (update.using ? this.graphs('USING ', update.using.default) : '') + + (update.using ? this.graphs('USING NAMED ', update.using.named) : '') + + 'WHERE ' + this.group(update.where, true); + case 'add': + case 'copy': + case 'move': + return update.type.toUpperCase()+ ' ' + (update.silent ? 'SILENT ' : '') + (update.source.default ? 'DEFAULT' : this.toEntity(update.source.name)) + + ' TO ' + this.toEntity(update.destination.name); + case 'create': + case 'clear': + case 'drop': + return update.type.toUpperCase() + (update.silent ? ' SILENT ' : ' ') + ( + update.graph.default ? 'DEFAULT' : + update.graph.named ? 'NAMED' : + update.graph.all ? 'ALL' : + ('GRAPH ' + this.toEntity(update.graph.name)) + ); + default: + throw new Error('Unknown update query type: ' + update.type); } - - /** - * @param options { - * allPrefixes: boolean, - * indentation: string, - * newline: string - * } - */ - module.exports = function SparqlGenerator(options = {}) { - return { - stringify: function (query) { - var currentOptions = Object.create(options); - currentOptions.prefixes = query.prefixes; - return new Generator(currentOptions).toQuery(query); - }, - createGenerator: function() { return new Generator(options); } - }; - }; - - - /***/ }), - - /***/ 89516: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* provided dependency */ var console = __webpack_require__(80292); - /* parser generated by jison 0.4.18 */ - /* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) +}; + +// Indents each line of the string +Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._indent); } + +function variableToString(variable){ + return '?' + variable.value; +} + +// Checks whether the object is a string +function isString(object) { return typeof object === 'string'; } + +// Checks whether the object is a Term +function isTerm(object) { + return typeof object.termType === 'string'; +} + +// Checks whether term1 and term2 are equivalent without `.equals()` prototype method +function equalTerms(term1, term2) { + if (!term1 || !isTerm(term1)) { return false; } + if (!term2 || !isTerm(term2)) { return false; } + if (term1.termType !== term2.termType) { return false; } + switch (term1.termType) { + case 'Literal': + return term1.value === term2.value + && term1.language === term2.language + && equalTerms(term1.datatype, term2.datatype); + case 'Quad': + return equalTerms(term1.subject, term2.subject) + && equalTerms(term1.predicate, term2.predicate) + && equalTerms(term1.object, term2.object) + && equalTerms(term1.graph, term2.graph); + default: + return term1.value === term2.value; + } +} + +// Maps the array with the given function, and joins the results using the separator +function mapJoin(array, sep, func, self) { + return array.map(func, self).join(isString(sep) ? sep : ' '); +} + +/** + * @param options { + * allPrefixes: boolean, + * indentation: string, + * newline: string + * } + */ +module.exports = function SparqlGenerator(options = {}) { + return { + stringify: function (query) { + var currentOptions = Object.create(options); + currentOptions.prefixes = query.prefixes; + return new Generator(currentOptions).toQuery(query); + }, + createGenerator: function() { return new Generator(options); } + }; +}; + + +/***/ }), + +/***/ 89516: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var console = __webpack_require__(80292); +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, } - */ - var SparqlParser = (function(){ - var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,13,15,16,28,35,41,50,55,107,117,120,122,123,132,133,138,195,219,224,312,322,323,324,325,326],$V1=[2,211],$V2=[107,117,120,122,123,132,133,138,322,323,324,325,326],$V3=[2,389],$V4=[1,22],$V5=[1,31],$V6=[13,16,35,195,219,224,312],$V7=[6,90],$V8=[45,46,58],$V9=[45,58],$Va=[1,62],$Vb=[1,64],$Vc=[1,60],$Vd=[1,63],$Ve=[1,69],$Vf=[1,70],$Vg=[26,34,35],$Vh=[13,16,35,195,219,312],$Vi=[13,16,312],$Vj=[119,141,320,327],$Vk=[13,16,119,141,312],$Vl=[1,96],$Vm=[1,100],$Vn=[1,102],$Vo=[119,141,320,321,327],$Vp=[13,16,119,141,312,321],$Vq=[1,108],$Vr=[2,253],$Vs=[1,107],$Vt=[13,16,34,35,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vu=[6,45,46,58,68,75,78,86,88,90],$Vv=[6,13,16,34,45,46,58,68,75,78,86,88,90,312],$Vw=[6,13,16,26,34,35,37,38,45,46,48,58,68,75,78,86,87,88,90,93,100,116,119,132,133,135,140,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,330,331,333,334,335,336,337,338,339],$Vx=[34,35,45,46,58],$Vy=[1,139],$Vz=[1,140],$VA=[1,151],$VB=[1,131],$VC=[1,125],$VD=[1,130],$VE=[1,132],$VF=[1,142],$VG=[1,143],$VH=[1,144],$VI=[1,145],$VJ=[1,147],$VK=[1,148],$VL=[2,461],$VM=[1,157],$VN=[1,158],$VO=[1,159],$VP=[1,152],$VQ=[1,153],$VR=[1,156],$VS=[1,166],$VT=[1,167],$VU=[1,168],$VV=[1,169],$VW=[1,170],$VX=[1,171],$VY=[1,172],$VZ=[1,173],$V_=[1,174],$V$=[1,175],$V01=[1,165],$V11=[1,160],$V21=[1,161],$V31=[1,162],$V41=[1,163],$V51=[1,164],$V61=[6,13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$V71=[2,312],$V81=[1,199],$V91=[1,197],$Va1=[6,191],$Vb1=[2,329],$Vc1=[2,317],$Vd1=[45,135],$Ve1=[6,48,78,86,88,90],$Vf1=[2,257],$Vg1=[1,213],$Vh1=[1,215],$Vi1=[6,48,75,78,86,88,90],$Vj1=[2,255],$Vk1=[1,221],$Vl1=[1,233],$Vm1=[1,231],$Vn1=[1,239],$Vo1=[1,232],$Vp1=[1,237],$Vq1=[1,238],$Vr1=[6,68,75,78,86,88,90],$Vs1=[37,38,191,250,278],$Vt1=[37,38,191,250,254,278],$Vu1=[37,38,191,250,254,258,271,273,278,295,306,307,308,309,310,311,334,335,336,337,338,339],$Vv1=[26,37,38,191,250,254,258,271,273,278,295,306,307,308,309,310,311,331,334,335,336,337,338,339],$Vw1=[1,267],$Vx1=[1,266],$Vy1=[6,13,16,26,34,35,37,38,46,48,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339,340,341,342,343,344],$Vz1=[1,275],$VA1=[1,274],$VB1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339],$VC1=[35,93],$VD1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339],$VE1=[13,16,48,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VF1=[48,93],$VG1=[34,38],$VH1=[6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330,331],$VI1=[6,13,16,26,34,35,38,87,93,226,231,245,246,271,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330,331,333],$VJ1=[1,299],$VK1=[1,300],$VL1=[6,116,191],$VM1=[48,119],$VN1=[6,48,86,88,90],$VO1=[2,341],$VP1=[2,333],$VQ1=[1,340],$VR1=[1,342],$VS1=[48,119,328],$VT1=[13,16,34,195,312],$VU1=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$VV1=[13,16,34,35,87,219,271,273,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,339,340,341,342,343,344],$VW1=[1,374],$VX1=[1,375],$VY1=[13,16,26,34,35,87,219,271,273,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,339,340,341,342,343,344],$VZ1=[1,398],$V_1=[1,399],$V$1=[13,16,38,195,224,312],$V02=[1,416],$V12=[6,48,90],$V22=[6,13,16,35,48,78,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$V32=[6,13,16,34,35,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,226,231,245,246,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,339,340,341,342,343,344],$V42=[46,48,90,119,167,168,170,173,174],$V52=[1,435],$V62=[1,436],$V72=[1,442],$V82=[1,441],$V92=[48,119,191,227,328],$Va2=[13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vb2=[13,16,34,35,38,48,87,93,119,191,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vc2=[13,16,38,48,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vd2=[35,48],$Ve2=[2,332],$Vf2=[1,497],$Vg2=[1,494],$Vh2=[1,495],$Vi2=[6,13,16,26,34,35,37,38,46,48,68,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,329,331,334,335,336,337,338,339,340,341,342,343,344],$Vj2=[1,515],$Vk2=[46,48,90,119,167,168,170,173,174,328],$Vl2=[13,16,34,35,195,219,224,312],$Vm2=[6,13,16,34,35,48,75,78,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$Vn2=[13,16,34,35,38,48,87,93,119,191,195,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vo2=[6,13,16,34,35,48,81,83,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$Vp2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vq2=[13,16,34,312],$Vr2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vs2=[2,344],$Vt2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vu2=[13,16,34,35,37,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vv2=[2,339],$Vw2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vx2=[13,16,38,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vy2=[46,48,90,119,167,168,170,173,174,191,227,328],$Vz2=[13,16,34,38,48,87,100,195,231,235,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VA2=[13,16,34,35,48,87,93,119,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VB2=[2,327]; - var parser = {trace: function trace () { }, - yy: {}, - symbols_: {"error":2,"QueryOrUpdate":3,"Prologue":4,"QueryOrUpdate_group0":5,"EOF":6,"Prologue_repetition0":7,"Query":8,"Query_group0":9,"Query_option0":10,"BaseDecl":11,"BASE":12,"IRIREF":13,"PrefixDecl":14,"PREFIX":15,"PNAME_NS":16,"SelectQuery":17,"SelectClauseWildcard":18,"SelectQuery_repetition0":19,"WhereClause":20,"SolutionModifierNoGroup":21,"SelectClauseVars":22,"SelectQuery_repetition1":23,"SolutionModifier":24,"SelectClauseBase":25,"*":26,"SelectClauseVars_repetition_plus0":27,"SELECT":28,"SelectClauseBase_option0":29,"SubSelect":30,"SubSelect_option0":31,"SubSelect_option1":32,"SelectClauseItem":33,"VAR":34,"(":35,"Expression":36,"AS":37,")":38,"VarTriple":39,"ConstructQuery":40,"CONSTRUCT":41,"ConstructTemplate":42,"ConstructQuery_repetition0":43,"ConstructQuery_repetition1":44,"WHERE":45,"{":46,"ConstructQuery_option0":47,"}":48,"DescribeQuery":49,"DESCRIBE":50,"DescribeQuery_group0":51,"DescribeQuery_repetition0":52,"DescribeQuery_option0":53,"AskQuery":54,"ASK":55,"AskQuery_repetition0":56,"DatasetClause":57,"FROM":58,"DatasetClause_option0":59,"iri":60,"WhereClause_option0":61,"GroupGraphPattern":62,"SolutionModifier_option0":63,"SolutionModifierNoGroup_option0":64,"SolutionModifierNoGroup_option1":65,"SolutionModifierNoGroup_option2":66,"GroupClause":67,"GROUP":68,"BY":69,"GroupClause_repetition_plus0":70,"GroupCondition":71,"BuiltInCall":72,"FunctionCall":73,"HavingClause":74,"HAVING":75,"HavingClause_repetition_plus0":76,"OrderClause":77,"ORDER":78,"OrderClause_repetition_plus0":79,"OrderCondition":80,"ASC":81,"BrackettedExpression":82,"DESC":83,"Constraint":84,"LimitOffsetClauses":85,"LIMIT":86,"INTEGER":87,"OFFSET":88,"ValuesClause":89,"VALUES":90,"InlineData":91,"InlineData_repetition0":92,"NIL":93,"InlineData_repetition1":94,"InlineData_repetition_plus2":95,"InlineData_repetition3":96,"DataBlockValue":97,"Literal":98,"ConstTriple":99,"UNDEF":100,"DataBlockValueList":101,"DataBlockValueList_repetition_plus0":102,"Update":103,"Update_repetition0":104,"Update1":105,"Update_option0":106,"LOAD":107,"Update1_option0":108,"Update1_option1":109,"Update1_group0":110,"Update1_option2":111,"GraphRefAll":112,"Update1_group1":113,"Update1_option3":114,"GraphOrDefault":115,"TO":116,"CREATE":117,"Update1_option4":118,"GRAPH":119,"INSERTDATA":120,"QuadPattern":121,"DELETEDATA":122,"DELETEWHERE":123,"Update1_option5":124,"InsertClause":125,"Update1_option6":126,"Update1_repetition0":127,"Update1_option7":128,"DeleteClause":129,"Update1_option8":130,"Update1_repetition1":131,"DELETE":132,"INSERT":133,"UsingClause":134,"USING":135,"UsingClause_option0":136,"WithClause":137,"WITH":138,"IntoGraphClause":139,"INTO":140,"DEFAULT":141,"GraphOrDefault_option0":142,"GraphRefAll_group0":143,"QuadPattern_option0":144,"QuadPattern_repetition0":145,"QuadsNotTriples":146,"QuadsNotTriples_group0":147,"QuadsNotTriples_option0":148,"QuadsNotTriples_option1":149,"QuadsNotTriples_option2":150,"TriplesTemplate":151,"TriplesTemplate_repetition0":152,"TriplesSameSubject":153,"TriplesTemplate_option0":154,"GroupGraphPatternSub":155,"GroupGraphPatternSub_option0":156,"GroupGraphPatternSub_repetition0":157,"GroupGraphPatternSubTail":158,"GraphPatternNotTriples":159,"GroupGraphPatternSubTail_option0":160,"GroupGraphPatternSubTail_option1":161,"TriplesBlock":162,"TriplesBlock_repetition0":163,"TriplesSameSubjectPath":164,"TriplesBlock_option0":165,"GraphPatternNotTriples_repetition0":166,"OPTIONAL":167,"MINUS":168,"GraphPatternNotTriples_group0":169,"SERVICE":170,"GraphPatternNotTriples_option0":171,"GraphPatternNotTriples_group1":172,"FILTER":173,"BIND":174,"FunctionCall_option0":175,"FunctionCall_repetition0":176,"ExpressionList":177,"ExpressionList_repetition0":178,"ConstructTemplate_option0":179,"ConstructTriples":180,"ConstructTriples_repetition0":181,"ConstructTriples_option0":182,"TriplesSameSubject_group0":183,"PropertyListNotEmpty":184,"TriplesNode":185,"PropertyList":186,"PropertyList_option0":187,"VerbObjectList":188,"PropertyListNotEmpty_repetition0":189,"SemiOptionalVerbObjectList":190,";":191,"SemiOptionalVerbObjectList_option0":192,"Verb":193,"ObjectList":194,"a":195,"ObjectList_repetition0":196,"GraphNode":197,"ObjectListPath":198,"ObjectListPath_repetition0":199,"GraphNodePath":200,"TriplesSameSubjectPath_group0":201,"PropertyListPathNotEmpty":202,"TriplesNodePath":203,"TriplesSameSubjectPath_option0":204,"PropertyListPathNotEmpty_group0":205,"PropertyListPathNotEmpty_repetition0":206,"PropertyListPathNotEmpty_repetition1":207,"PropertyListPathNotEmptyTail":208,"PropertyListPathNotEmptyTail_group0":209,"Path":210,"Path_repetition0":211,"PathSequence":212,"PathSequence_repetition0":213,"PathEltOrInverse":214,"PathElt":215,"PathPrimary":216,"PathElt_option0":217,"PathEltOrInverse_option0":218,"!":219,"PathNegatedPropertySet":220,"PathOneInPropertySet":221,"PathNegatedPropertySet_repetition0":222,"PathNegatedPropertySet_option0":223,"^":224,"TriplesNode_repetition_plus0":225,"[":226,"]":227,"TriplesNodePath_repetition_plus0":228,"GraphNode_group0":229,"GraphNodePath_group0":230,"<<":231,"VarTriple_group0":232,"VarTriple_group1":233,"VarTriple_group2":234,">>":235,"VarTriple_group3":236,"VarTriple_group4":237,"ConstTriple_group0":238,"ConstTriple_group1":239,"ConstTriple_group2":240,"ConstTriple_group3":241,"ConstTriple_group4":242,"VarOrTerm":243,"Term":244,"BLANK_NODE_LABEL":245,"ANON":246,"ConditionalAndExpression":247,"Expression_repetition0":248,"ExpressionTail":249,"||":250,"RelationalExpression":251,"ConditionalAndExpression_repetition0":252,"ConditionalAndExpressionTail":253,"&&":254,"AdditiveExpression":255,"RelationalExpression_group0":256,"RelationalExpression_option0":257,"IN":258,"MultiplicativeExpression":259,"AdditiveExpression_repetition0":260,"AdditiveExpressionTail":261,"AdditiveExpressionTail_group0":262,"NumericLiteralPositive":263,"AdditiveExpressionTail_repetition0":264,"NumericLiteralNegative":265,"AdditiveExpressionTail_repetition1":266,"UnaryExpression":267,"MultiplicativeExpression_repetition0":268,"MultiplicativeExpressionTail":269,"MultiplicativeExpressionTail_group0":270,"+":271,"PrimaryExpression":272,"-":273,"Aggregate":274,"FUNC_ARITY0":275,"FUNC_ARITY1":276,"FUNC_ARITY2":277,",":278,"IF":279,"BuiltInCall_group0":280,"BOUND":281,"BNODE":282,"BuiltInCall_option0":283,"EXISTS":284,"COUNT":285,"Aggregate_option0":286,"Aggregate_group0":287,"FUNC_AGGREGATE":288,"Aggregate_option1":289,"GROUP_CONCAT":290,"Aggregate_option2":291,"Aggregate_option3":292,"GroupConcatSeparator":293,"SEPARATOR":294,"=":295,"String":296,"LANGTAG":297,"^^":298,"DECIMAL":299,"DOUBLE":300,"BOOLEAN":301,"STRING_LITERAL1":302,"STRING_LITERAL2":303,"STRING_LITERAL_LONG1":304,"STRING_LITERAL_LONG2":305,"INTEGER_POSITIVE":306,"DECIMAL_POSITIVE":307,"DOUBLE_POSITIVE":308,"INTEGER_NEGATIVE":309,"DECIMAL_NEGATIVE":310,"DOUBLE_NEGATIVE":311,"PNAME_LN":312,"QueryOrUpdate_group0_option0":313,"Prologue_repetition0_group0":314,"SelectClauseBase_option0_group0":315,"DISTINCT":316,"REDUCED":317,"DescribeQuery_group0_repetition_plus0_group0":318,"DescribeQuery_group0_repetition_plus0":319,"NAMED":320,"SILENT":321,"CLEAR":322,"DROP":323,"ADD":324,"MOVE":325,"COPY":326,"ALL":327,".":328,"UNION":329,"|":330,"/":331,"PathElt_option0_group0":332,"?":333,"!=":334,"<":335,">":336,"<=":337,">=":338,"NOT":339,"CONCAT":340,"COALESCE":341,"SUBSTR":342,"REGEX":343,"REPLACE":344,"$accept":0,"$end":1}, - terminals_: {2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",26:"*",28:"SELECT",34:"VAR",35:"(",37:"AS",38:")",41:"CONSTRUCT",45:"WHERE",46:"{",48:"}",50:"DESCRIBE",55:"ASK",58:"FROM",68:"GROUP",69:"BY",75:"HAVING",78:"ORDER",81:"ASC",83:"DESC",86:"LIMIT",87:"INTEGER",88:"OFFSET",90:"VALUES",93:"NIL",100:"UNDEF",107:"LOAD",116:"TO",117:"CREATE",119:"GRAPH",120:"INSERTDATA",122:"DELETEDATA",123:"DELETEWHERE",132:"DELETE",133:"INSERT",135:"USING",138:"WITH",140:"INTO",141:"DEFAULT",167:"OPTIONAL",168:"MINUS",170:"SERVICE",173:"FILTER",174:"BIND",191:";",195:"a",219:"!",224:"^",226:"[",227:"]",231:"<<",235:">>",245:"BLANK_NODE_LABEL",246:"ANON",250:"||",254:"&&",258:"IN",271:"+",273:"-",275:"FUNC_ARITY0",276:"FUNC_ARITY1",277:"FUNC_ARITY2",278:",",279:"IF",281:"BOUND",282:"BNODE",284:"EXISTS",285:"COUNT",288:"FUNC_AGGREGATE",290:"GROUP_CONCAT",294:"SEPARATOR",295:"=",297:"LANGTAG",298:"^^",299:"DECIMAL",300:"DOUBLE",301:"BOOLEAN",302:"STRING_LITERAL1",303:"STRING_LITERAL2",304:"STRING_LITERAL_LONG1",305:"STRING_LITERAL_LONG2",306:"INTEGER_POSITIVE",307:"DECIMAL_POSITIVE",308:"DOUBLE_POSITIVE",309:"INTEGER_NEGATIVE",310:"DECIMAL_NEGATIVE",311:"DOUBLE_NEGATIVE",312:"PNAME_LN",316:"DISTINCT",317:"REDUCED",320:"NAMED",321:"SILENT",322:"CLEAR",323:"DROP",324:"ADD",325:"MOVE",326:"COPY",327:"ALL",328:".",329:"UNION",330:"|",331:"/",333:"?",334:"!=",335:"<",336:">",337:"<=",338:">=",339:"NOT",340:"CONCAT",341:"COALESCE",342:"SUBSTR",343:"REGEX",344:"REPLACE"}, - productions_: [0,[3,3],[4,1],[8,2],[11,2],[14,3],[17,4],[17,4],[18,2],[22,2],[25,2],[30,4],[30,4],[33,1],[33,5],[33,5],[40,5],[40,7],[49,5],[54,4],[57,3],[20,2],[24,2],[21,3],[67,3],[71,1],[71,1],[71,3],[71,5],[71,1],[74,2],[77,3],[80,2],[80,2],[80,1],[80,1],[85,2],[85,2],[85,4],[85,4],[89,2],[91,4],[91,4],[91,6],[97,1],[97,1],[97,1],[97,1],[101,3],[103,3],[105,4],[105,3],[105,5],[105,4],[105,2],[105,2],[105,2],[105,6],[105,6],[129,2],[125,2],[134,3],[137,2],[139,3],[115,1],[115,2],[112,2],[112,1],[121,4],[146,7],[151,3],[62,3],[62,3],[155,2],[158,3],[162,3],[159,2],[159,2],[159,2],[159,3],[159,4],[159,2],[159,6],[159,6],[159,1],[84,1],[84,1],[84,1],[73,2],[73,6],[177,1],[177,4],[42,3],[180,3],[153,2],[153,2],[186,1],[184,2],[190,2],[188,2],[193,1],[193,1],[193,1],[194,2],[198,2],[164,2],[164,2],[202,4],[208,1],[208,3],[210,2],[212,2],[215,2],[214,2],[216,1],[216,1],[216,2],[216,3],[220,1],[220,1],[220,4],[221,1],[221,1],[221,2],[221,2],[185,3],[185,3],[203,3],[203,3],[197,1],[197,1],[200,1],[200,1],[39,9],[39,5],[99,9],[99,5],[243,1],[243,1],[244,1],[244,1],[244,1],[244,1],[244,1],[36,2],[249,2],[247,2],[253,2],[251,1],[251,3],[251,4],[255,2],[261,2],[261,2],[261,2],[259,2],[269,2],[267,2],[267,2],[267,2],[267,1],[272,1],[272,1],[272,1],[272,1],[272,1],[272,1],[82,3],[72,1],[72,2],[72,4],[72,6],[72,8],[72,2],[72,4],[72,2],[72,4],[72,3],[274,5],[274,5],[274,6],[293,4],[98,1],[98,2],[98,3],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[296,1],[296,1],[296,1],[296,1],[263,1],[263,1],[263,1],[265,1],[265,1],[265,1],[60,1],[60,1],[60,1],[313,0],[313,1],[5,1],[5,1],[5,1],[314,1],[314,1],[7,0],[7,2],[9,1],[9,1],[9,1],[9,1],[10,0],[10,1],[19,0],[19,2],[23,0],[23,2],[27,1],[27,2],[315,1],[315,1],[29,0],[29,1],[31,0],[31,1],[32,0],[32,1],[43,0],[43,2],[44,0],[44,2],[47,0],[47,1],[318,1],[318,1],[319,1],[319,2],[51,1],[51,1],[52,0],[52,2],[53,0],[53,1],[56,0],[56,2],[59,0],[59,1],[61,0],[61,1],[63,0],[63,1],[64,0],[64,1],[65,0],[65,1],[66,0],[66,1],[70,1],[70,2],[76,1],[76,2],[79,1],[79,2],[92,0],[92,2],[94,0],[94,2],[95,1],[95,2],[96,0],[96,2],[102,1],[102,2],[104,0],[104,4],[106,0],[106,2],[108,0],[108,1],[109,0],[109,1],[110,1],[110,1],[111,0],[111,1],[113,1],[113,1],[113,1],[114,0],[114,1],[118,0],[118,1],[124,0],[124,1],[126,0],[126,1],[127,0],[127,2],[128,0],[128,1],[130,0],[130,1],[131,0],[131,2],[136,0],[136,1],[142,0],[142,1],[143,1],[143,1],[143,1],[144,0],[144,1],[145,0],[145,2],[147,1],[147,1],[148,0],[148,1],[149,0],[149,1],[150,0],[150,1],[152,0],[152,3],[154,0],[154,1],[156,0],[156,1],[157,0],[157,2],[160,0],[160,1],[161,0],[161,1],[163,0],[163,3],[165,0],[165,1],[166,0],[166,3],[169,1],[169,1],[171,0],[171,1],[172,1],[172,1],[175,0],[175,1],[176,0],[176,3],[178,0],[178,3],[179,0],[179,1],[181,0],[181,3],[182,0],[182,1],[183,1],[183,1],[187,0],[187,1],[189,0],[189,2],[192,0],[192,1],[196,0],[196,3],[199,0],[199,3],[201,1],[201,1],[204,0],[204,1],[205,1],[205,1],[206,0],[206,3],[207,0],[207,2],[209,1],[209,1],[211,0],[211,3],[213,0],[213,3],[332,1],[332,1],[332,1],[217,0],[217,1],[218,0],[218,1],[222,0],[222,3],[223,0],[223,1],[225,1],[225,2],[228,1],[228,2],[229,1],[229,1],[230,1],[230,1],[232,1],[232,1],[233,1],[233,1],[234,1],[234,1],[236,1],[236,1],[237,1],[237,1],[238,1],[238,1],[239,1],[239,1],[240,1],[240,1],[241,1],[241,1],[242,1],[242,1],[248,0],[248,2],[252,0],[252,2],[256,1],[256,1],[256,1],[256,1],[256,1],[256,1],[257,0],[257,1],[260,0],[260,2],[262,1],[262,1],[264,0],[264,2],[266,0],[266,2],[268,0],[268,2],[270,1],[270,1],[280,1],[280,1],[280,1],[280,1],[280,1],[283,0],[283,1],[286,0],[286,1],[287,1],[287,1],[289,0],[289,1],[291,0],[291,1],[292,0],[292,1]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { - /* this == yyval */ - - var $0 = $$.length - 1; - switch (yystate) { - case 1: - - // Set parser options - $$[$0-1] = $$[$0-1] || {}; - if (Parser.base) - $$[$0-1].base = Parser.base; - Parser.base = ''; - $$[$0-1].prefixes = Parser.prefixes; - Parser.prefixes = null; - - if (Parser.pathOnly) { - if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { - return $$[$0-1] - } - throw new Error('Received full SPARQL query in path only mode'); - } else if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { - throw new Error('Received only path in full SPARQL mode'); - } - - // Ensure that blank nodes are not used across INSERT DATA clauses - if ($$[$0-1].type === 'update') { - const insertBnodesAll = {}; - for (const update of $$[$0-1].updates) { - if (update.updateType === 'insert') { - // Collect bnodes for current insert clause - const insertBnodes = {}; - for (const operation of update.insert) { - if (operation.type === 'bgp' || operation.type === 'graph') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'BlankNode') - insertBnodes[triple.subject.value] = true; - if (triple.predicate.termType === 'BlankNode') - insertBnodes[triple.predicate.value] = true; - if (triple.object.termType === 'BlankNode') - insertBnodes[triple.object.value] = true; - } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var SparqlParser = (function(){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,13,15,16,28,35,41,50,55,107,117,120,122,123,132,133,138,195,219,224,312,322,323,324,325,326],$V1=[2,211],$V2=[107,117,120,122,123,132,133,138,322,323,324,325,326],$V3=[2,389],$V4=[1,22],$V5=[1,31],$V6=[13,16,35,195,219,224,312],$V7=[6,90],$V8=[45,46,58],$V9=[45,58],$Va=[1,62],$Vb=[1,64],$Vc=[1,60],$Vd=[1,63],$Ve=[1,69],$Vf=[1,70],$Vg=[26,34,35],$Vh=[13,16,35,195,219,312],$Vi=[13,16,312],$Vj=[119,141,320,327],$Vk=[13,16,119,141,312],$Vl=[1,96],$Vm=[1,100],$Vn=[1,102],$Vo=[119,141,320,321,327],$Vp=[13,16,119,141,312,321],$Vq=[1,108],$Vr=[2,253],$Vs=[1,107],$Vt=[13,16,34,35,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vu=[6,45,46,58,68,75,78,86,88,90],$Vv=[6,13,16,34,45,46,58,68,75,78,86,88,90,312],$Vw=[6,13,16,26,34,35,37,38,45,46,48,58,68,75,78,86,87,88,90,93,100,116,119,132,133,135,140,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,330,331,333,334,335,336,337,338,339],$Vx=[34,35,45,46,58],$Vy=[1,139],$Vz=[1,140],$VA=[1,151],$VB=[1,131],$VC=[1,125],$VD=[1,130],$VE=[1,132],$VF=[1,142],$VG=[1,143],$VH=[1,144],$VI=[1,145],$VJ=[1,147],$VK=[1,148],$VL=[2,461],$VM=[1,157],$VN=[1,158],$VO=[1,159],$VP=[1,152],$VQ=[1,153],$VR=[1,156],$VS=[1,166],$VT=[1,167],$VU=[1,168],$VV=[1,169],$VW=[1,170],$VX=[1,171],$VY=[1,172],$VZ=[1,173],$V_=[1,174],$V$=[1,175],$V01=[1,165],$V11=[1,160],$V21=[1,161],$V31=[1,162],$V41=[1,163],$V51=[1,164],$V61=[6,13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$V71=[2,312],$V81=[1,199],$V91=[1,197],$Va1=[6,191],$Vb1=[2,329],$Vc1=[2,317],$Vd1=[45,135],$Ve1=[6,48,78,86,88,90],$Vf1=[2,257],$Vg1=[1,213],$Vh1=[1,215],$Vi1=[6,48,75,78,86,88,90],$Vj1=[2,255],$Vk1=[1,221],$Vl1=[1,233],$Vm1=[1,231],$Vn1=[1,239],$Vo1=[1,232],$Vp1=[1,237],$Vq1=[1,238],$Vr1=[6,68,75,78,86,88,90],$Vs1=[37,38,191,250,278],$Vt1=[37,38,191,250,254,278],$Vu1=[37,38,191,250,254,258,271,273,278,295,306,307,308,309,310,311,334,335,336,337,338,339],$Vv1=[26,37,38,191,250,254,258,271,273,278,295,306,307,308,309,310,311,331,334,335,336,337,338,339],$Vw1=[1,267],$Vx1=[1,266],$Vy1=[6,13,16,26,34,35,37,38,46,48,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339,340,341,342,343,344],$Vz1=[1,275],$VA1=[1,274],$VB1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339],$VC1=[35,93],$VD1=[13,16,26,34,35,37,38,46,48,87,90,93,100,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,250,254,258,271,273,278,295,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339],$VE1=[13,16,48,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VF1=[48,93],$VG1=[34,38],$VH1=[6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330,331],$VI1=[6,13,16,26,34,35,38,87,93,226,231,245,246,271,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330,331,333],$VJ1=[1,299],$VK1=[1,300],$VL1=[6,116,191],$VM1=[48,119],$VN1=[6,48,86,88,90],$VO1=[2,341],$VP1=[2,333],$VQ1=[1,340],$VR1=[1,342],$VS1=[48,119,328],$VT1=[13,16,34,195,312],$VU1=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$VV1=[13,16,34,35,87,219,271,273,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,339,340,341,342,343,344],$VW1=[1,374],$VX1=[1,375],$VY1=[13,16,26,34,35,87,219,271,273,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,339,340,341,342,343,344],$VZ1=[1,398],$V_1=[1,399],$V$1=[13,16,38,195,224,312],$V02=[1,416],$V12=[6,48,90],$V22=[6,13,16,35,48,78,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$V32=[6,13,16,34,35,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,226,231,245,246,275,276,277,279,281,282,284,285,288,290,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,339,340,341,342,343,344],$V42=[46,48,90,119,167,168,170,173,174],$V52=[1,435],$V62=[1,436],$V72=[1,442],$V82=[1,441],$V92=[48,119,191,227,328],$Va2=[13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vb2=[13,16,34,35,38,48,87,93,119,191,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vc2=[13,16,38,48,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vd2=[35,48],$Ve2=[2,332],$Vf2=[1,497],$Vg2=[1,494],$Vh2=[1,495],$Vi2=[6,13,16,26,34,35,37,38,46,48,68,75,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,329,331,334,335,336,337,338,339,340,341,342,343,344],$Vj2=[1,515],$Vk2=[46,48,90,119,167,168,170,173,174,328],$Vl2=[13,16,34,35,195,219,224,312],$Vm2=[6,13,16,34,35,48,75,78,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$Vn2=[13,16,34,35,38,48,87,93,119,191,195,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vo2=[6,13,16,34,35,48,81,83,86,88,90,275,276,277,279,281,282,284,285,288,290,312,339,340,341,342,343,344],$Vp2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vq2=[13,16,34,312],$Vr2=[13,16,34,35,46,48,87,90,93,119,167,168,170,173,174,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vs2=[2,344],$Vt2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vu2=[13,16,34,35,37,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,235,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vv2=[2,339],$Vw2=[13,16,34,35,38,46,48,87,90,93,119,167,168,170,173,174,191,195,219,224,226,227,231,245,246,278,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328],$Vx2=[13,16,38,87,100,231,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$Vy2=[46,48,90,119,167,168,170,173,174,191,227,328],$Vz2=[13,16,34,38,48,87,100,195,231,235,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VA2=[13,16,34,35,48,87,93,119,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],$VB2=[2,327]; +var parser = {trace: function trace () { }, +yy: {}, +symbols_: {"error":2,"QueryOrUpdate":3,"Prologue":4,"QueryOrUpdate_group0":5,"EOF":6,"Prologue_repetition0":7,"Query":8,"Query_group0":9,"Query_option0":10,"BaseDecl":11,"BASE":12,"IRIREF":13,"PrefixDecl":14,"PREFIX":15,"PNAME_NS":16,"SelectQuery":17,"SelectClauseWildcard":18,"SelectQuery_repetition0":19,"WhereClause":20,"SolutionModifierNoGroup":21,"SelectClauseVars":22,"SelectQuery_repetition1":23,"SolutionModifier":24,"SelectClauseBase":25,"*":26,"SelectClauseVars_repetition_plus0":27,"SELECT":28,"SelectClauseBase_option0":29,"SubSelect":30,"SubSelect_option0":31,"SubSelect_option1":32,"SelectClauseItem":33,"VAR":34,"(":35,"Expression":36,"AS":37,")":38,"VarTriple":39,"ConstructQuery":40,"CONSTRUCT":41,"ConstructTemplate":42,"ConstructQuery_repetition0":43,"ConstructQuery_repetition1":44,"WHERE":45,"{":46,"ConstructQuery_option0":47,"}":48,"DescribeQuery":49,"DESCRIBE":50,"DescribeQuery_group0":51,"DescribeQuery_repetition0":52,"DescribeQuery_option0":53,"AskQuery":54,"ASK":55,"AskQuery_repetition0":56,"DatasetClause":57,"FROM":58,"DatasetClause_option0":59,"iri":60,"WhereClause_option0":61,"GroupGraphPattern":62,"SolutionModifier_option0":63,"SolutionModifierNoGroup_option0":64,"SolutionModifierNoGroup_option1":65,"SolutionModifierNoGroup_option2":66,"GroupClause":67,"GROUP":68,"BY":69,"GroupClause_repetition_plus0":70,"GroupCondition":71,"BuiltInCall":72,"FunctionCall":73,"HavingClause":74,"HAVING":75,"HavingClause_repetition_plus0":76,"OrderClause":77,"ORDER":78,"OrderClause_repetition_plus0":79,"OrderCondition":80,"ASC":81,"BrackettedExpression":82,"DESC":83,"Constraint":84,"LimitOffsetClauses":85,"LIMIT":86,"INTEGER":87,"OFFSET":88,"ValuesClause":89,"VALUES":90,"InlineData":91,"InlineData_repetition0":92,"NIL":93,"InlineData_repetition1":94,"InlineData_repetition_plus2":95,"InlineData_repetition3":96,"DataBlockValue":97,"Literal":98,"ConstTriple":99,"UNDEF":100,"DataBlockValueList":101,"DataBlockValueList_repetition_plus0":102,"Update":103,"Update_repetition0":104,"Update1":105,"Update_option0":106,"LOAD":107,"Update1_option0":108,"Update1_option1":109,"Update1_group0":110,"Update1_option2":111,"GraphRefAll":112,"Update1_group1":113,"Update1_option3":114,"GraphOrDefault":115,"TO":116,"CREATE":117,"Update1_option4":118,"GRAPH":119,"INSERTDATA":120,"QuadPattern":121,"DELETEDATA":122,"DELETEWHERE":123,"Update1_option5":124,"InsertClause":125,"Update1_option6":126,"Update1_repetition0":127,"Update1_option7":128,"DeleteClause":129,"Update1_option8":130,"Update1_repetition1":131,"DELETE":132,"INSERT":133,"UsingClause":134,"USING":135,"UsingClause_option0":136,"WithClause":137,"WITH":138,"IntoGraphClause":139,"INTO":140,"DEFAULT":141,"GraphOrDefault_option0":142,"GraphRefAll_group0":143,"QuadPattern_option0":144,"QuadPattern_repetition0":145,"QuadsNotTriples":146,"QuadsNotTriples_group0":147,"QuadsNotTriples_option0":148,"QuadsNotTriples_option1":149,"QuadsNotTriples_option2":150,"TriplesTemplate":151,"TriplesTemplate_repetition0":152,"TriplesSameSubject":153,"TriplesTemplate_option0":154,"GroupGraphPatternSub":155,"GroupGraphPatternSub_option0":156,"GroupGraphPatternSub_repetition0":157,"GroupGraphPatternSubTail":158,"GraphPatternNotTriples":159,"GroupGraphPatternSubTail_option0":160,"GroupGraphPatternSubTail_option1":161,"TriplesBlock":162,"TriplesBlock_repetition0":163,"TriplesSameSubjectPath":164,"TriplesBlock_option0":165,"GraphPatternNotTriples_repetition0":166,"OPTIONAL":167,"MINUS":168,"GraphPatternNotTriples_group0":169,"SERVICE":170,"GraphPatternNotTriples_option0":171,"GraphPatternNotTriples_group1":172,"FILTER":173,"BIND":174,"FunctionCall_option0":175,"FunctionCall_repetition0":176,"ExpressionList":177,"ExpressionList_repetition0":178,"ConstructTemplate_option0":179,"ConstructTriples":180,"ConstructTriples_repetition0":181,"ConstructTriples_option0":182,"TriplesSameSubject_group0":183,"PropertyListNotEmpty":184,"TriplesNode":185,"PropertyList":186,"PropertyList_option0":187,"VerbObjectList":188,"PropertyListNotEmpty_repetition0":189,"SemiOptionalVerbObjectList":190,";":191,"SemiOptionalVerbObjectList_option0":192,"Verb":193,"ObjectList":194,"a":195,"ObjectList_repetition0":196,"GraphNode":197,"ObjectListPath":198,"ObjectListPath_repetition0":199,"GraphNodePath":200,"TriplesSameSubjectPath_group0":201,"PropertyListPathNotEmpty":202,"TriplesNodePath":203,"TriplesSameSubjectPath_option0":204,"PropertyListPathNotEmpty_group0":205,"PropertyListPathNotEmpty_repetition0":206,"PropertyListPathNotEmpty_repetition1":207,"PropertyListPathNotEmptyTail":208,"PropertyListPathNotEmptyTail_group0":209,"Path":210,"Path_repetition0":211,"PathSequence":212,"PathSequence_repetition0":213,"PathEltOrInverse":214,"PathElt":215,"PathPrimary":216,"PathElt_option0":217,"PathEltOrInverse_option0":218,"!":219,"PathNegatedPropertySet":220,"PathOneInPropertySet":221,"PathNegatedPropertySet_repetition0":222,"PathNegatedPropertySet_option0":223,"^":224,"TriplesNode_repetition_plus0":225,"[":226,"]":227,"TriplesNodePath_repetition_plus0":228,"GraphNode_group0":229,"GraphNodePath_group0":230,"<<":231,"VarTriple_group0":232,"VarTriple_group1":233,"VarTriple_group2":234,">>":235,"VarTriple_group3":236,"VarTriple_group4":237,"ConstTriple_group0":238,"ConstTriple_group1":239,"ConstTriple_group2":240,"ConstTriple_group3":241,"ConstTriple_group4":242,"VarOrTerm":243,"Term":244,"BLANK_NODE_LABEL":245,"ANON":246,"ConditionalAndExpression":247,"Expression_repetition0":248,"ExpressionTail":249,"||":250,"RelationalExpression":251,"ConditionalAndExpression_repetition0":252,"ConditionalAndExpressionTail":253,"&&":254,"AdditiveExpression":255,"RelationalExpression_group0":256,"RelationalExpression_option0":257,"IN":258,"MultiplicativeExpression":259,"AdditiveExpression_repetition0":260,"AdditiveExpressionTail":261,"AdditiveExpressionTail_group0":262,"NumericLiteralPositive":263,"AdditiveExpressionTail_repetition0":264,"NumericLiteralNegative":265,"AdditiveExpressionTail_repetition1":266,"UnaryExpression":267,"MultiplicativeExpression_repetition0":268,"MultiplicativeExpressionTail":269,"MultiplicativeExpressionTail_group0":270,"+":271,"PrimaryExpression":272,"-":273,"Aggregate":274,"FUNC_ARITY0":275,"FUNC_ARITY1":276,"FUNC_ARITY2":277,",":278,"IF":279,"BuiltInCall_group0":280,"BOUND":281,"BNODE":282,"BuiltInCall_option0":283,"EXISTS":284,"COUNT":285,"Aggregate_option0":286,"Aggregate_group0":287,"FUNC_AGGREGATE":288,"Aggregate_option1":289,"GROUP_CONCAT":290,"Aggregate_option2":291,"Aggregate_option3":292,"GroupConcatSeparator":293,"SEPARATOR":294,"=":295,"String":296,"LANGTAG":297,"^^":298,"DECIMAL":299,"DOUBLE":300,"BOOLEAN":301,"STRING_LITERAL1":302,"STRING_LITERAL2":303,"STRING_LITERAL_LONG1":304,"STRING_LITERAL_LONG2":305,"INTEGER_POSITIVE":306,"DECIMAL_POSITIVE":307,"DOUBLE_POSITIVE":308,"INTEGER_NEGATIVE":309,"DECIMAL_NEGATIVE":310,"DOUBLE_NEGATIVE":311,"PNAME_LN":312,"QueryOrUpdate_group0_option0":313,"Prologue_repetition0_group0":314,"SelectClauseBase_option0_group0":315,"DISTINCT":316,"REDUCED":317,"DescribeQuery_group0_repetition_plus0_group0":318,"DescribeQuery_group0_repetition_plus0":319,"NAMED":320,"SILENT":321,"CLEAR":322,"DROP":323,"ADD":324,"MOVE":325,"COPY":326,"ALL":327,".":328,"UNION":329,"|":330,"/":331,"PathElt_option0_group0":332,"?":333,"!=":334,"<":335,">":336,"<=":337,">=":338,"NOT":339,"CONCAT":340,"COALESCE":341,"SUBSTR":342,"REGEX":343,"REPLACE":344,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",26:"*",28:"SELECT",34:"VAR",35:"(",37:"AS",38:")",41:"CONSTRUCT",45:"WHERE",46:"{",48:"}",50:"DESCRIBE",55:"ASK",58:"FROM",68:"GROUP",69:"BY",75:"HAVING",78:"ORDER",81:"ASC",83:"DESC",86:"LIMIT",87:"INTEGER",88:"OFFSET",90:"VALUES",93:"NIL",100:"UNDEF",107:"LOAD",116:"TO",117:"CREATE",119:"GRAPH",120:"INSERTDATA",122:"DELETEDATA",123:"DELETEWHERE",132:"DELETE",133:"INSERT",135:"USING",138:"WITH",140:"INTO",141:"DEFAULT",167:"OPTIONAL",168:"MINUS",170:"SERVICE",173:"FILTER",174:"BIND",191:";",195:"a",219:"!",224:"^",226:"[",227:"]",231:"<<",235:">>",245:"BLANK_NODE_LABEL",246:"ANON",250:"||",254:"&&",258:"IN",271:"+",273:"-",275:"FUNC_ARITY0",276:"FUNC_ARITY1",277:"FUNC_ARITY2",278:",",279:"IF",281:"BOUND",282:"BNODE",284:"EXISTS",285:"COUNT",288:"FUNC_AGGREGATE",290:"GROUP_CONCAT",294:"SEPARATOR",295:"=",297:"LANGTAG",298:"^^",299:"DECIMAL",300:"DOUBLE",301:"BOOLEAN",302:"STRING_LITERAL1",303:"STRING_LITERAL2",304:"STRING_LITERAL_LONG1",305:"STRING_LITERAL_LONG2",306:"INTEGER_POSITIVE",307:"DECIMAL_POSITIVE",308:"DOUBLE_POSITIVE",309:"INTEGER_NEGATIVE",310:"DECIMAL_NEGATIVE",311:"DOUBLE_NEGATIVE",312:"PNAME_LN",316:"DISTINCT",317:"REDUCED",320:"NAMED",321:"SILENT",322:"CLEAR",323:"DROP",324:"ADD",325:"MOVE",326:"COPY",327:"ALL",328:".",329:"UNION",330:"|",331:"/",333:"?",334:"!=",335:"<",336:">",337:"<=",338:">=",339:"NOT",340:"CONCAT",341:"COALESCE",342:"SUBSTR",343:"REGEX",344:"REPLACE"}, +productions_: [0,[3,3],[4,1],[8,2],[11,2],[14,3],[17,4],[17,4],[18,2],[22,2],[25,2],[30,4],[30,4],[33,1],[33,5],[33,5],[40,5],[40,7],[49,5],[54,4],[57,3],[20,2],[24,2],[21,3],[67,3],[71,1],[71,1],[71,3],[71,5],[71,1],[74,2],[77,3],[80,2],[80,2],[80,1],[80,1],[85,2],[85,2],[85,4],[85,4],[89,2],[91,4],[91,4],[91,6],[97,1],[97,1],[97,1],[97,1],[101,3],[103,3],[105,4],[105,3],[105,5],[105,4],[105,2],[105,2],[105,2],[105,6],[105,6],[129,2],[125,2],[134,3],[137,2],[139,3],[115,1],[115,2],[112,2],[112,1],[121,4],[146,7],[151,3],[62,3],[62,3],[155,2],[158,3],[162,3],[159,2],[159,2],[159,2],[159,3],[159,4],[159,2],[159,6],[159,6],[159,1],[84,1],[84,1],[84,1],[73,2],[73,6],[177,1],[177,4],[42,3],[180,3],[153,2],[153,2],[186,1],[184,2],[190,2],[188,2],[193,1],[193,1],[193,1],[194,2],[198,2],[164,2],[164,2],[202,4],[208,1],[208,3],[210,2],[212,2],[215,2],[214,2],[216,1],[216,1],[216,2],[216,3],[220,1],[220,1],[220,4],[221,1],[221,1],[221,2],[221,2],[185,3],[185,3],[203,3],[203,3],[197,1],[197,1],[200,1],[200,1],[39,9],[39,5],[99,9],[99,5],[243,1],[243,1],[244,1],[244,1],[244,1],[244,1],[244,1],[36,2],[249,2],[247,2],[253,2],[251,1],[251,3],[251,4],[255,2],[261,2],[261,2],[261,2],[259,2],[269,2],[267,2],[267,2],[267,2],[267,1],[272,1],[272,1],[272,1],[272,1],[272,1],[272,1],[82,3],[72,1],[72,2],[72,4],[72,6],[72,8],[72,2],[72,4],[72,2],[72,4],[72,3],[274,5],[274,5],[274,6],[293,4],[98,1],[98,2],[98,3],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[296,1],[296,1],[296,1],[296,1],[263,1],[263,1],[263,1],[265,1],[265,1],[265,1],[60,1],[60,1],[60,1],[313,0],[313,1],[5,1],[5,1],[5,1],[314,1],[314,1],[7,0],[7,2],[9,1],[9,1],[9,1],[9,1],[10,0],[10,1],[19,0],[19,2],[23,0],[23,2],[27,1],[27,2],[315,1],[315,1],[29,0],[29,1],[31,0],[31,1],[32,0],[32,1],[43,0],[43,2],[44,0],[44,2],[47,0],[47,1],[318,1],[318,1],[319,1],[319,2],[51,1],[51,1],[52,0],[52,2],[53,0],[53,1],[56,0],[56,2],[59,0],[59,1],[61,0],[61,1],[63,0],[63,1],[64,0],[64,1],[65,0],[65,1],[66,0],[66,1],[70,1],[70,2],[76,1],[76,2],[79,1],[79,2],[92,0],[92,2],[94,0],[94,2],[95,1],[95,2],[96,0],[96,2],[102,1],[102,2],[104,0],[104,4],[106,0],[106,2],[108,0],[108,1],[109,0],[109,1],[110,1],[110,1],[111,0],[111,1],[113,1],[113,1],[113,1],[114,0],[114,1],[118,0],[118,1],[124,0],[124,1],[126,0],[126,1],[127,0],[127,2],[128,0],[128,1],[130,0],[130,1],[131,0],[131,2],[136,0],[136,1],[142,0],[142,1],[143,1],[143,1],[143,1],[144,0],[144,1],[145,0],[145,2],[147,1],[147,1],[148,0],[148,1],[149,0],[149,1],[150,0],[150,1],[152,0],[152,3],[154,0],[154,1],[156,0],[156,1],[157,0],[157,2],[160,0],[160,1],[161,0],[161,1],[163,0],[163,3],[165,0],[165,1],[166,0],[166,3],[169,1],[169,1],[171,0],[171,1],[172,1],[172,1],[175,0],[175,1],[176,0],[176,3],[178,0],[178,3],[179,0],[179,1],[181,0],[181,3],[182,0],[182,1],[183,1],[183,1],[187,0],[187,1],[189,0],[189,2],[192,0],[192,1],[196,0],[196,3],[199,0],[199,3],[201,1],[201,1],[204,0],[204,1],[205,1],[205,1],[206,0],[206,3],[207,0],[207,2],[209,1],[209,1],[211,0],[211,3],[213,0],[213,3],[332,1],[332,1],[332,1],[217,0],[217,1],[218,0],[218,1],[222,0],[222,3],[223,0],[223,1],[225,1],[225,2],[228,1],[228,2],[229,1],[229,1],[230,1],[230,1],[232,1],[232,1],[233,1],[233,1],[234,1],[234,1],[236,1],[236,1],[237,1],[237,1],[238,1],[238,1],[239,1],[239,1],[240,1],[240,1],[241,1],[241,1],[242,1],[242,1],[248,0],[248,2],[252,0],[252,2],[256,1],[256,1],[256,1],[256,1],[256,1],[256,1],[257,0],[257,1],[260,0],[260,2],[262,1],[262,1],[264,0],[264,2],[266,0],[266,2],[268,0],[268,2],[270,1],[270,1],[280,1],[280,1],[280,1],[280,1],[280,1],[283,0],[283,1],[286,0],[286,1],[287,1],[287,1],[289,0],[289,1],[291,0],[291,1],[292,0],[292,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: + + // Set parser options + $$[$0-1] = $$[$0-1] || {}; + if (Parser.base) + $$[$0-1].base = Parser.base; + Parser.base = ''; + $$[$0-1].prefixes = Parser.prefixes; + Parser.prefixes = null; + + if (Parser.pathOnly) { + if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { + return $$[$0-1] + } + throw new Error('Received full SPARQL query in path only mode'); + } else if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { + throw new Error('Received only path in full SPARQL mode'); + } + + // Ensure that blank nodes are not used across INSERT DATA clauses + if ($$[$0-1].type === 'update') { + const insertBnodesAll = {}; + for (const update of $$[$0-1].updates) { + if (update.updateType === 'insert') { + // Collect bnodes for current insert clause + const insertBnodes = {}; + for (const operation of update.insert) { + if (operation.type === 'bgp' || operation.type === 'graph') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'BlankNode') + insertBnodes[triple.subject.value] = true; + if (triple.predicate.termType === 'BlankNode') + insertBnodes[triple.predicate.value] = true; + if (triple.object.termType === 'BlankNode') + insertBnodes[triple.object.value] = true; } } - - // Check if the inserting bnodes don't clash with bnodes from a previous insert clause - for (const bnode of Object.keys(insertBnodes)) { - if (insertBnodesAll[bnode]) { - throw new Error('Detected reuse blank node across different INSERT DATA clauses'); - } - insertBnodesAll[bnode] = true; + } + + // Check if the inserting bnodes don't clash with bnodes from a previous insert clause + for (const bnode of Object.keys(insertBnodes)) { + if (insertBnodesAll[bnode]) { + throw new Error('Detected reuse blank node across different INSERT DATA clauses'); } + insertBnodesAll[bnode] = true; } } } - return $$[$0-1]; - - break; - case 3: - this.$ = extend($$[$0-1], $$[$0], { type: 'query' }); - break; - case 4: - - Parser.base = resolveIRI($$[$0]) - - break; - case 5: - - if (!Parser.prefixes) Parser.prefixes = {}; - $$[$0-1] = $$[$0-1].substr(0, $$[$0-1].length - 1); - $$[$0] = resolveIRI($$[$0]); - Parser.prefixes[$$[$0-1]] = $$[$0]; - - break; - case 6: - this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 7: - - // Check for projection of ungrouped variable - if (!Parser.skipValidation) { - const counts = flatten($$[$0-3].variables.map(vars => getAggregatesOfExpression(vars.expression))) - .some(agg => agg.aggregation === "count" && !(agg.expression instanceof Wildcard)); - if (counts || $$[$0].group) { - for (const selectVar of $$[$0-3].variables) { - if (selectVar.termType === "Variable") { - if (!$$[$0].group || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(selectVar))) { - throw Error("Projection of ungrouped variable (?" + getExpressionId(selectVar) + ")"); - } - } else if (getAggregatesOfExpression(selectVar.expression).length === 0) { - const usedVars = getVariablesFromExpression(selectVar.expression); - for (const usedVar of usedVars) { - if (!$$[$0].group || !$$[$0].group.map || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(usedVar))) { - throw Error("Use of ungrouped variable in projection of operation (?" + getExpressionId(usedVar) + ")"); - } + } + return $$[$0-1]; + +break; +case 3: +this.$ = extend($$[$0-1], $$[$0], { type: 'query' }); +break; +case 4: + + Parser.base = resolveIRI($$[$0]) + +break; +case 5: + + if (!Parser.prefixes) Parser.prefixes = {}; + $$[$0-1] = $$[$0-1].substr(0, $$[$0-1].length - 1); + $$[$0] = resolveIRI($$[$0]); + Parser.prefixes[$$[$0-1]] = $$[$0]; + +break; +case 6: +this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 7: + + // Check for projection of ungrouped variable + if (!Parser.skipValidation) { + const counts = flatten($$[$0-3].variables.map(vars => getAggregatesOfExpression(vars.expression))) + .some(agg => agg.aggregation === "count" && !(agg.expression instanceof Wildcard)); + if (counts || $$[$0].group) { + for (const selectVar of $$[$0-3].variables) { + if (selectVar.termType === "Variable") { + if (!$$[$0].group || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(selectVar))) { + throw Error("Projection of ungrouped variable (?" + getExpressionId(selectVar) + ")"); + } + } else if (getAggregatesOfExpression(selectVar.expression).length === 0) { + const usedVars = getVariablesFromExpression(selectVar.expression); + for (const usedVar of usedVars) { + if (!$$[$0].group || !$$[$0].group.map || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(usedVar))) { + throw Error("Use of ungrouped variable in projection of operation (?" + getExpressionId(usedVar) + ")"); } } } } } - // Check if id of each AS-selected column is not yet bound by subquery - const subqueries = $$[$0-1].where.filter(w => w.type === "query"); - if (subqueries.length > 0) { - const selectedVarIds = $$[$0-3].variables.filter(v => v.variable && v.variable.value).map(v => v.variable.value); - const subqueryIds = flatten(subqueries.map(sub => sub.variables)).map(v => v.value || v.variable.value); - for (const selectedVarId of selectedVarIds) { - if (subqueryIds.indexOf(selectedVarId) >= 0) { - throw Error("Target id of 'AS' (?" + selectedVarId + ") already used in subquery"); - } - } - } - this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]) - - break; - case 8: - this.$ = extend($$[$0-1], {variables: [new Wildcard()]}); - break; - case 9: - - // Check if id of each selected column is different - const selectedVarIds = $$[$0].map(v => v.value || v.variable.value); - const duplicates = getDuplicatesInArray(selectedVarIds); - if (duplicates.length > 0) { - throw Error("Two or more of the resulting columns have the same name (?" + duplicates[0] + ")"); - } - - this.$ = extend($$[$0-1], { variables: $$[$0] }) - - break; - case 10: - this.$ = extend({ queryType: 'SELECT'}, $$[$0] && ($$[$0-1] = lowercase($$[$0]), $$[$0] = {}, $$[$0][$$[$0-1]] = true, $$[$0])); - break; - case 11: case 12: - this.$ = extend($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], { type: 'query' }); - break; - case 13: case 100: case 137: case 166: - this.$ = toVar($$[$0]); - break; - case 14: case 28: - this.$ = expression($$[$0-3], { variable: toVar($$[$0-1]) }); - break; - case 15: - this.$ = ensureSparqlStar(expression($$[$0-3], { variable: toVar($$[$0-1]) })); - break; - case 16: - this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 17: - this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-2] = ($$[$0-2] ? $$[$0-2].triples : []) }, groupDatasets($$[$0-5]), { where: [ { type: 'bgp', triples: appendAllTo([], $$[$0-2]) } ] }, $$[$0]); - break; - case 18: - this.$ = extend({ queryType: 'DESCRIBE', variables: $$[$0-3] === '*' ? [new Wildcard()] : $$[$0-3].map(toVar) }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 19: - this.$ = extend({ queryType: 'ASK' }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 20: case 61: - this.$ = { iri: $$[$0], named: !!$$[$0-1] }; - break; - case 21: - this.$ = { where: $$[$0].patterns }; - break; - case 22: - this.$ = extend($$[$0-1], $$[$0]); - break; - case 23: - this.$ = extend($$[$0-2], $$[$0-1], $$[$0]); - break; - case 24: - this.$ = { group: $$[$0] }; - break; - case 25: case 26: case 32: case 34: - this.$ = expression($$[$0]); - break; - case 27: - this.$ = expression($$[$0-1]); - break; - case 29: case 35: - this.$ = expression(toVar($$[$0])); - break; - case 30: - this.$ = { having: $$[$0] }; - break; - case 31: - this.$ = { order: $$[$0] }; - break; - case 33: - this.$ = expression($$[$0], { descending: true }); - break; - case 36: - this.$ = { limit: toInt($$[$0]) }; - break; - case 37: - this.$ = { offset: toInt($$[$0]) }; - break; - case 38: - this.$ = { limit: toInt($$[$0-2]), offset: toInt($$[$0]) }; - break; - case 39: - this.$ = { limit: toInt($$[$0]), offset: toInt($$[$0-2]) }; - break; - case 40: - this.$ = { type: 'values', values: $$[$0] }; - break; - case 41: - - this.$ = $$[$0-1].map(function(v) { var o = {}; o[$$[$0-3]] = v; return o; }) - - break; - case 42: - - this.$ = $$[$0-1].map(function() { return {}; }) - - break; - case 43: - - var length = $$[$0-4].length; - $$[$0-4] = $$[$0-4].map(toVar); - this.$ = $$[$0-1].map(function (values) { - if (values.length !== length) - throw Error('Inconsistent VALUES length'); - var valuesObject = {}; - for(var i = 0; i el.type === "bind")) { - const index = $$[$0-1].indexOf(binding); - const boundVars = new Set(); - //Collect all bounded variables before the binding - for (const el of $$[$0-1].slice(0, index)) { - if (el.type === "group" || el.type === "bgp") { - getBoundVarsFromGroupGraphPattern(el).forEach(boundVar => boundVars.add(boundVar)); - } - } - // If binding with a non-free variable, throw error - if (boundVars.has(binding.variable.value)) { - throw Error("Variable used to bind is already bound (?" + binding.variable.value + ")"); - } - } - this.$ = { type: 'group', patterns: $$[$0-1] } - - break; - case 73: - this.$ = $$[$0-1] ? unionAll([$$[$0-1]], $$[$0]) : unionAll($$[$0]); - break; - case 74: - this.$ = $$[$0] ? [$$[$0-2], $$[$0]] : $$[$0-2]; - break; - case 76: - - if ($$[$0-1].length) - this.$ = { type: 'union', patterns: unionAll($$[$0-1].map(degroupSingle), [degroupSingle($$[$0])]) }; - else - this.$ = $$[$0]; - - break; - case 77: - this.$ = extend($$[$0], { type: 'optional' }); - break; - case 78: - this.$ = extend($$[$0], { type: 'minus' }); - break; - case 79: - this.$ = extend($$[$0], { type: 'graph', name: toVar($$[$0-1]) }); - break; - case 80: - this.$ = extend($$[$0], { type: 'service', name: toVar($$[$0-1]), silent: !!$$[$0-2] }); - break; - case 81: - this.$ = { type: 'filter', expression: $$[$0] }; - break; - case 82: - this.$ = { type: 'bind', variable: toVar($$[$0-1]), expression: $$[$0-3] }; - break; - case 83: - this.$ = ensureSparqlStar({ type: 'bind', variable: toVar($$[$0-1]), expression: $$[$0-3] }); - break; - case 88: - this.$ = { type: 'functionCall', function: $$[$0-1], args: [] }; - break; - case 89: - this.$ = { type: 'functionCall', function: $$[$0-5], args: appendTo($$[$0-2], $$[$0-1]), distinct: !!$$[$0-3] }; - break; - case 90: case 108: case 119: case 211: case 219: case 221: case 233: case 235: case 245: case 249: case 269: case 271: case 275: case 279: case 302: case 308: case 319: case 329: case 335: case 341: case 345: case 355: case 357: case 361: case 369: case 373: case 375: case 383: case 385: case 389: case 391: case 400: case 432: case 434: case 444: case 448: case 450: case 452: - this.$ = []; - break; - case 91: - this.$ = appendTo($$[$0-2], $$[$0-1]); - break; - case 93: - this.$ = unionAll($$[$0-2], [$$[$0-1]]); - break; - case 94: case 105: - this.$ = $$[$0].map(function (t) { return extend(triple($$[$0-1]), t); }); - break; - case 95: - this.$ = appendAllTo($$[$0].map(function (t) { return extend(triple($$[$0-1].entity), t); }), $$[$0-1].triples) /* the subject is a blank node, possibly with more triples */; - break; - case 97: - this.$ = unionAll([$$[$0-1]], $$[$0]); - break; - case 98: - this.$ = unionAll($$[$0]); - break; - case 99: - this.$ = objectListToTriples($$[$0-1], $$[$0]); - break; - case 102: case 115: case 122: - this.$ = Parser.factory.namedNode(RDF_TYPE); - break; - case 103: case 104: - this.$ = appendTo($$[$0-1], $$[$0]); - break; - case 106: - this.$ = !$$[$0] ? $$[$0-1].triples : appendAllTo($$[$0].map(function (t) { return extend(triple($$[$0-1].entity), t); }), $$[$0-1].triples) /* the subject is a blank node, possibly with more triples */; - break; - case 107: - this.$ = objectListToTriples(toVar($$[$0-3]), appendTo($$[$0-2], $$[$0-1]), $$[$0]); - break; - case 109: - this.$ = objectListToTriples(toVar($$[$0-1]), $$[$0]); - break; - case 110: - this.$ = $$[$0-1].length ? path('|',appendTo($$[$0-1], $$[$0])) : $$[$0]; - break; - case 111: - this.$ = $$[$0-1].length ? path('/', appendTo($$[$0-1], $$[$0])) : $$[$0]; - break; - case 112: - this.$ = $$[$0] ? path($$[$0], [$$[$0-1]]) : $$[$0-1]; - break; - case 113: - this.$ = $$[$0-1] ? path($$[$0-1], [$$[$0]]) : $$[$0];; - break; - case 116: case 123: - this.$ = path($$[$0-1], [$$[$0]]); - break; - case 120: - this.$ = path('|', appendTo($$[$0-2], $$[$0-1])); - break; - case 124: - this.$ = path($$[$0-1], [Parser.factory.namedNode(RDF_TYPE)]); - break; - case 125: case 127: - this.$ = createList($$[$0-1]); - break; - case 126: case 128: - this.$ = createAnonymousObject($$[$0-1]); - break; - case 129: - this.$ = { entity: $$[$0], triples: [] } /* for consistency with TriplesNode */; - break; - case 131: - this.$ = { entity: $$[$0], triples: [] } /* for consistency with TriplesNodePath */; - break; - case 133: case 135: - this.$ = ensureSparqlStar(Parser.factory.quad($$[$0-4], $$[$0-3], $$[$0-2], toVar($$[$0-6]))); - break; - case 134: case 136: - this.$ = ensureSparqlStar(Parser.factory.quad($$[$0-3], $$[$0-2], $$[$0-1])); - break; - case 141: - this.$ = blank($$[$0].replace(/^(_:)/,''));; - break; - case 142: - this.$ = blank(); - break; - case 143: - this.$ = Parser.factory.namedNode(RDF_NIL); - break; - case 144: case 146: case 151: case 155: - this.$ = createOperationTree($$[$0-1], $$[$0]); - break; - case 145: - this.$ = ['||', $$[$0]]; - break; - case 147: - this.$ = ['&&', $$[$0]]; - break; - case 149: - this.$ = operation($$[$0-1], [$$[$0-2], $$[$0]]); - break; - case 150: - this.$ = operation($$[$0-2] ? 'notin' : 'in', [$$[$0-3], $$[$0]]); - break; - case 152: case 156: - this.$ = [$$[$0-1], $$[$0]]; - break; - case 153: - this.$ = ['+', createOperationTree($$[$0-1], $$[$0])]; - break; - case 154: - - var negatedLiteral = createTypedLiteral($$[$0-1].value.replace('-', ''), $$[$0-1].datatype); - this.$ = ['-', createOperationTree(negatedLiteral, $$[$0])]; - - break; - case 157: - this.$ = operation('UPLUS', [$$[$0]]); - break; - case 158: - this.$ = operation($$[$0-1], [$$[$0]]); - break; - case 159: - this.$ = operation('UMINUS', [$$[$0]]); - break; - case 169: - this.$ = operation(lowercase($$[$0-1])); - break; - case 170: - this.$ = operation(lowercase($$[$0-3]), [$$[$0-1]]); - break; - case 171: - this.$ = operation(lowercase($$[$0-5]), [$$[$0-3], $$[$0-1]]); - break; - case 172: - this.$ = operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]]); - break; - case 173: - this.$ = operation(lowercase($$[$0-1]), $$[$0]); - break; - case 174: - this.$ = operation('bound', [toVar($$[$0-1])]); - break; - case 175: - this.$ = operation($$[$0-1], []); - break; - case 176: - this.$ = operation($$[$0-3], [$$[$0-1]]); - break; - case 177: - this.$ = operation($$[$0-2] ? 'notexists' :'exists', [degroupSingle($$[$0])]); - break; - case 178: case 179: - this.$ = expression($$[$0-1], { type: 'aggregate', aggregation: lowercase($$[$0-4]), distinct: !!$$[$0-2] }); - break; - case 180: - this.$ = expression($$[$0-2], { type: 'aggregate', aggregation: lowercase($$[$0-5]), distinct: !!$$[$0-3], separator: typeof $$[$0-1] === 'string' ? $$[$0-1] : ' ' }); - break; - case 182: - this.$ = createTypedLiteral($$[$0]); - break; - case 183: - this.$ = createLangLiteral($$[$0-1], lowercase($$[$0].substr(1))); - break; - case 184: - this.$ = createTypedLiteral($$[$0-2], $$[$0]); - break; - case 185: case 198: - this.$ = createTypedLiteral($$[$0], XSD_INTEGER); - break; - case 186: case 199: - this.$ = createTypedLiteral($$[$0], XSD_DECIMAL); - break; - case 187: case 200: - this.$ = createTypedLiteral(lowercase($$[$0]), XSD_DOUBLE); - break; - case 190: - this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_BOOLEAN); - break; - case 191: case 192: - this.$ = unescapeString($$[$0], 1); - break; - case 193: case 194: - this.$ = unescapeString($$[$0], 3); - break; - case 195: - this.$ = createTypedLiteral($$[$0].substr(1), XSD_INTEGER); - break; - case 196: - this.$ = createTypedLiteral($$[$0].substr(1), XSD_DECIMAL); - break; - case 197: - this.$ = createTypedLiteral($$[$0].substr(1).toLowerCase(), XSD_DOUBLE); - break; - case 201: - this.$ = Parser.factory.namedNode(resolveIRI($$[$0])); - break; - case 202: - - var namePos = $$[$0].indexOf(':'), - prefix = $$[$0].substr(0, namePos), - expansion = Parser.prefixes[prefix]; - if (!expansion) throw new Error('Unknown prefix: ' + prefix); - var uriString = resolveIRI(expansion + $$[$0].substr(namePos + 1)); - this.$ = Parser.factory.namedNode(uriString); - - break; - case 203: - - $$[$0] = $$[$0].substr(0, $$[$0].length - 1); - if (!($$[$0] in Parser.prefixes)) throw new Error('Unknown prefix: ' + $$[$0]); - var uriString = resolveIRI(Parser.prefixes[$$[$0]]); - this.$ = Parser.factory.namedNode(uriString); - - break; - case 212: case 220: case 222: case 224: case 234: case 236: case 242: case 246: case 250: case 264: case 266: case 268: case 270: case 272: case 274: case 276: case 278: case 303: case 309: case 320: case 336: case 370: case 386: case 405: case 407: case 433: case 435: case 445: case 449: case 451: case 453: - $$[$0-1].push($$[$0]); - break; - case 223: case 241: case 263: case 265: case 267: case 273: case 277: case 404: case 406: - this.$ = [$$[$0]]; - break; - case 280: - $$[$0-3].push($$[$0-2]); - break; - case 330: case 342: case 346: case 356: case 358: case 362: case 374: case 376: case 384: case 390: case 392: case 401: - $$[$0-2].push($$[$0-1]); - break; - } - }, - table: [o($V0,$V1,{3:1,4:2,7:3}),{1:[3]},o($V2,[2,279],{5:4,8:5,313:6,210:7,9:8,103:9,211:10,17:11,40:12,49:13,54:14,104:15,18:16,22:17,25:21,6:[2,204],13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,28:$V4,41:[1,18],50:[1,19],55:[1,20]}),o([6,13,16,28,35,41,50,55,107,117,120,122,123,132,133,138,195,219,224,312,322,323,324,325,326],[2,2],{314:23,11:24,14:25,12:[1,26],15:[1,27]}),{6:[1,28]},{6:[2,206]},{6:[2,207]},{6:[2,208]},{6:[2,217],10:29,89:30,90:$V5},{6:[2,205]},o($V6,[2,391],{212:32,213:33}),o($V7,[2,213]),o($V7,[2,214]),o($V7,[2,215]),o($V7,[2,216]),{105:34,107:[1,35],110:36,113:37,117:[1,38],120:[1,39],122:[1,40],123:[1,41],124:42,128:43,132:[2,304],133:[2,298],137:49,138:[1,50],322:[1,44],323:[1,45],324:[1,46],325:[1,47],326:[1,48]},o($V8,[2,219],{19:51}),o($V8,[2,221],{23:52}),o($V9,[2,235],{42:53,44:54,46:[1,55]}),{13:$Va,16:$Vb,26:[1,58],34:$Vc,51:56,60:61,312:$Vd,318:59,319:57},o($V8,[2,249],{56:65}),{26:[1,66],27:67,33:68,34:$Ve,35:$Vf},o($Vg,[2,227],{29:71,315:72,316:[1,73],317:[1,74]}),o($V0,[2,212]),o($V0,[2,209]),o($V0,[2,210]),{13:[1,75]},{16:[1,76]},{1:[2,1]},{6:[2,3]},{6:[2,218]},{34:[1,78],35:[1,80],91:77,93:[1,79]},o([6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],[2,110],{330:[1,81]}),o($Vh,[2,398],{214:82,218:83,224:[1,84]}),{6:[2,281],106:85,191:[1,86]},o($Vi,[2,283],{108:87,321:[1,88]}),o($Vj,[2,289],{111:89,321:[1,90]}),o($Vk,[2,294],{114:91,321:[1,92]}),{118:93,119:[2,296],321:[1,94]},{46:$Vl,121:95},{46:$Vl,121:97},{46:$Vl,121:98},{125:99,133:$Vm},{129:101,132:$Vn},o($Vo,[2,287]),o($Vo,[2,288]),o($Vp,[2,291]),o($Vp,[2,292]),o($Vp,[2,293]),{132:[2,305],133:[2,299]},{13:$Va,16:$Vb,60:103,312:$Vd},{20:104,45:$Vq,46:$Vr,57:105,58:$Vs,61:106},{20:109,45:$Vq,46:$Vr,57:110,58:$Vs,61:106},o($V8,[2,233],{43:111}),{45:[1,112],57:113,58:$Vs},o($Vt,[2,361],{179:114,180:115,181:116,48:[2,359]}),o($Vu,[2,245],{52:117}),o($Vu,[2,243],{60:61,318:118,13:$Va,16:$Vb,34:$Vc,312:$Vd}),o($Vu,[2,244]),o($Vv,[2,241]),o($Vv,[2,239]),o($Vv,[2,240]),o($Vw,[2,201]),o($Vw,[2,202]),o($Vw,[2,203]),{20:119,45:$Vq,46:$Vr,57:120,58:$Vs,61:106},o($V8,[2,8]),o($V8,[2,9],{33:121,34:$Ve,35:$Vf}),o($Vx,[2,223]),o($Vx,[2,13]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:122,39:123,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,231:$VC,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vg,[2,10]),o($Vg,[2,228]),o($Vg,[2,225]),o($Vg,[2,226]),o($V0,[2,4]),{13:[1,176]},o($V61,[2,40]),{46:[1,177]},{46:[1,178]},{34:[1,180],95:179},o($V6,[2,390]),o([6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330],[2,111],{331:[1,181]}),{13:$Va,16:$Vb,35:[1,187],60:184,195:[1,185],215:182,216:183,219:[1,186],312:$Vd},o($Vh,[2,399]),{6:[2,49]},o($V0,$V1,{7:3,4:188}),{13:$Va,16:$Vb,60:189,312:$Vd},o($Vi,[2,284]),{112:190,119:[1,191],141:[1,193],143:192,320:[1,194],327:[1,195]},o($Vj,[2,290]),o($Vi,$V71,{115:196,142:198,119:$V81,141:$V91}),o($Vk,[2,295]),{119:[1,200]},{119:[2,297]},o($Va1,[2,54]),o($Vt,$Vb1,{144:201,151:202,152:203,48:$Vc1,119:$Vc1}),o($Va1,[2,55]),o($Va1,[2,56]),o($Vd1,[2,300],{126:204,129:205,132:$Vn}),{46:$Vl,121:206},o($Vd1,[2,306],{130:207,125:208,133:$Vm}),{46:$Vl,121:209},o([132,133],[2,62]),o($Ve1,$Vf1,{21:210,64:211,74:212,75:$Vg1}),o($V8,[2,220]),{46:$Vh1,62:214},o($Vi,[2,251],{59:216,320:[1,217]}),{46:[2,254]},o($Vi1,$Vj1,{24:218,63:219,67:220,68:$Vk1}),o($V8,[2,222]),{20:222,45:$Vq,46:$Vr,57:223,58:$Vs,61:106},{46:[1,224]},o($V9,[2,236]),{48:[1,225]},{48:[2,360]},{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:230,60:235,87:$VA,93:$Vn1,98:236,153:226,183:227,185:228,226:$Vo1,231:$VC,243:229,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vr1,[2,247],{61:106,53:240,57:241,20:242,45:$Vq,46:$Vr,58:$Vs}),o($Vv,[2,242]),o($Vi1,$Vj1,{63:219,67:220,24:243,68:$Vk1}),o($V8,[2,250]),o($Vx,[2,224]),{37:[1,244]},{37:[1,245]},o($Vs1,[2,432],{248:246}),{13:$Va,16:$Vb,34:$Vl1,39:249,60:235,87:$VA,93:$Vn1,98:236,119:[1,247],231:$VC,236:248,243:250,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt1,[2,434],{252:251}),o($Vt1,[2,148],{256:252,257:253,258:[2,442],295:[1,254],334:[1,255],335:[1,256],336:[1,257],337:[1,258],338:[1,259],339:[1,260]}),o($Vu1,[2,444],{260:261}),o($Vv1,[2,452],{268:262}),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:263,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:264,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:265,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vv1,[2,160]),o($Vv1,[2,161]),o($Vv1,[2,162]),o($Vv1,[2,163],{35:$Vw1,93:$Vx1}),o($Vv1,[2,164]),o($Vv1,[2,165]),o($Vv1,[2,166]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:268,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,168]),{93:[1,269]},{35:[1,270]},{35:[1,271]},{35:[1,272]},{35:$Vz1,93:$VA1,177:273},{35:[1,276]},{35:[1,278],93:[1,277]},{284:[1,279]},o($VB1,[2,182],{297:[1,280],298:[1,281]}),o($VB1,[2,185]),o($VB1,[2,186]),o($VB1,[2,187]),o($VB1,[2,188]),o($VB1,[2,189]),o($VB1,[2,190]),{35:[1,282]},{35:[1,283]},{35:[1,284]},o($VC1,[2,456]),o($VC1,[2,457]),o($VC1,[2,458]),o($VC1,[2,459]),o($VC1,[2,460]),{284:[2,462]},o($VD1,[2,191]),o($VD1,[2,192]),o($VD1,[2,193]),o($VD1,[2,194]),o($VB1,[2,195]),o($VB1,[2,196]),o($VB1,[2,197]),o($VB1,[2,198]),o($VB1,[2,199]),o($VB1,[2,200]),o($V0,[2,5]),o($VE1,[2,269],{92:285}),o($VF1,[2,271],{94:286}),{34:[1,288],38:[1,287]},o($VG1,[2,273]),o($V6,[2,392]),o($VH1,[2,113]),o($VH1,[2,396],{217:289,332:290,26:[1,292],271:[1,293],333:[1,291]}),o($VI1,[2,114]),o($VI1,[2,115]),{13:$Va,16:$Vb,35:[1,297],60:298,93:[1,296],195:$VJ1,220:294,221:295,224:$VK1,312:$Vd},o($V6,$V3,{211:10,210:301}),o($V2,[2,280],{6:[2,282]}),o($Va1,[2,285],{109:302,139:303,140:[1,304]}),o($Va1,[2,51]),{13:$Va,16:$Vb,60:305,312:$Vd},o($Va1,[2,67]),o($Va1,[2,314]),o($Va1,[2,315]),o($Va1,[2,316]),{116:[1,306]},o($VL1,[2,64]),{13:$Va,16:$Vb,60:307,312:$Vd},o($Vi,[2,313]),{13:$Va,16:$Vb,60:308,312:$Vd},o($VM1,[2,319],{145:309}),o($VM1,[2,318]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:230,60:235,87:$VA,93:$Vn1,98:236,153:310,183:227,185:228,226:$Vo1,231:$VC,243:229,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vd1,[2,302],{127:311}),o($Vd1,[2,301]),o([45,132,135],[2,60]),o($Vd1,[2,308],{131:312}),o($Vd1,[2,307]),o([45,133,135],[2,59]),o($V7,[2,6]),o($VN1,[2,259],{65:313,77:314,78:[1,315]}),o($Ve1,[2,258]),{13:$Va,16:$Vb,35:$Vz,60:321,72:319,73:320,76:316,82:318,84:317,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o([6,48,68,75,78,86,88,90],[2,21]),o($Vt,$VO1,{25:21,30:322,155:323,18:324,22:325,156:326,162:327,163:328,28:$V4,46:$VP1,48:$VP1,90:$VP1,119:$VP1,167:$VP1,168:$VP1,170:$VP1,173:$VP1,174:$VP1}),{13:$Va,16:$Vb,60:329,312:$Vd},o($Vi,[2,252]),o($V7,[2,7]),o($Ve1,$Vf1,{64:211,74:212,21:330,75:$Vg1}),o($Vi1,[2,256]),{69:[1,331]},o($Vi1,$Vj1,{63:219,67:220,24:332,68:$Vk1}),o($V8,[2,234]),o($Vt,$Vb1,{152:203,47:333,151:334,48:[2,237]}),o($V8,[2,92]),{48:[2,363],182:335,328:[1,336]},{13:$Va,16:$Vb,34:$VQ1,60:341,184:337,188:338,193:339,195:$VR1,312:$Vd},o($VS1,[2,367],{188:338,193:339,60:341,186:343,187:344,184:345,13:$Va,16:$Vb,34:$VQ1,195:$VR1,312:$Vd}),o($VT1,[2,365]),o($VT1,[2,366]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:347,225:346,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,184:352,188:338,193:339,195:$VR1,312:$Vd},o($VU1,[2,137]),o($VU1,[2,138]),o($VU1,[2,139]),o($VU1,[2,140]),o($VU1,[2,141]),o($VU1,[2,142]),o($VU1,[2,143]),o($Vi1,$Vj1,{63:219,67:220,24:353,68:$Vk1}),o($Vu,[2,246]),o($Vr1,[2,248]),o($V7,[2,19]),{34:[1,354]},{34:[1,355]},o([37,38,191,278],[2,144],{249:356,250:[1,357]}),{13:$Va,16:$Vb,34:[1,359],60:360,232:358,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,193:361,195:$VR1,312:$Vd},o($VT1,[2,418]),o($VT1,[2,419]),o($Vs1,[2,146],{253:362,254:[1,363]}),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,255:364,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{258:[1,365]},o($VV1,[2,436]),o($VV1,[2,437]),o($VV1,[2,438]),o($VV1,[2,439]),o($VV1,[2,440]),o($VV1,[2,441]),{258:[2,443]},o([37,38,191,250,254,258,278,295,334,335,336,337,338,339],[2,151],{261:366,262:367,263:368,265:369,271:[1,370],273:[1,371],306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$}),o($Vu1,[2,155],{269:372,270:373,26:$VW1,331:$VX1}),o($Vv1,[2,157]),o($Vv1,[2,158]),o($Vv1,[2,159]),o($Vy1,[2,88]),o($VV1,[2,353],{175:376,316:[1,377]}),{38:[1,378]},o($Vy1,[2,169]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:379,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:380,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:381,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,173]),o($Vy1,[2,90]),o($VV1,[2,357],{178:382}),{34:[1,383]},o($Vy1,[2,175]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:384,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{46:$Vh1,62:385},o($VB1,[2,183]),{13:$Va,16:$Vb,60:386,312:$Vd},o($VY1,[2,463],{286:387,316:[1,388]}),o($VV1,[2,467],{289:389,316:[1,390]}),o($VV1,[2,469],{291:391,316:[1,392]}),{13:$Va,16:$Vb,48:[1,393],60:395,87:$VA,97:394,98:396,99:397,100:$VZ1,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{48:[1,400],93:[1,401]},{46:[1,402]},o($VG1,[2,274]),o($VH1,[2,112]),o($VH1,[2,397]),o($VH1,[2,393]),o($VH1,[2,394]),o($VH1,[2,395]),o($VI1,[2,116]),o($VI1,[2,118]),o($VI1,[2,119]),o($V$1,[2,400],{222:403}),o($VI1,[2,121]),o($VI1,[2,122]),{13:$Va,16:$Vb,60:404,195:[1,405],312:$Vd},{38:[1,406]},o($Va1,[2,50]),o($Va1,[2,286]),{119:[1,407]},o($Va1,[2,66]),o($Vi,$V71,{142:198,115:408,119:$V81,141:$V91}),o($VL1,[2,65]),o($Va1,[2,53]),{48:[1,409],119:[1,411],146:410},o($VM1,[2,331],{154:412,328:[1,413]}),{45:[1,414],134:415,135:$V02},{45:[1,417],134:418,135:$V02},o($V12,[2,261],{66:419,85:420,86:[1,421],88:[1,422]}),o($VN1,[2,260]),{69:[1,423]},o($Ve1,[2,30],{274:141,280:146,283:149,82:318,72:319,73:320,60:321,84:424,13:$Va,16:$Vb,35:$Vz,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($V22,[2,265]),o($V32,[2,85]),o($V32,[2,86]),o($V32,[2,87]),{35:$Vw1,93:$Vx1},{48:[1,425]},{48:[1,426]},{20:427,45:$Vq,46:$Vr,61:106},{20:428,45:$Vq,46:$Vr,61:106},o($V42,[2,335],{157:429}),o($V42,[2,334]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:434,60:235,87:$VA,93:$Vn1,98:236,164:430,201:431,203:432,226:$V62,231:$VC,243:433,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vu,[2,20]),o($V12,[2,22]),{13:$Va,16:$Vb,34:$V72,35:$V82,60:321,70:437,71:438,72:439,73:440,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($V7,[2,16]),{48:[1,443]},{48:[2,238]},{48:[2,93]},o($Vt,[2,362],{48:[2,364]}),o($VS1,[2,94]),o($V92,[2,369],{189:444}),o($Vt,[2,373],{194:445,196:446}),o($Vt,[2,100]),o($Vt,[2,101]),o($Vt,[2,102]),o($VS1,[2,95]),o($VS1,[2,96]),o($VS1,[2,368]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,38:[1,447],39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:448,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Va2,[2,404]),o($Vb2,[2,129]),o($Vb2,[2,130]),o($Vb2,[2,408]),o($Vb2,[2,409]),{227:[1,449]},o($V7,[2,18]),{38:[1,450]},{38:[1,451]},o($Vs1,[2,433]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:452,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{46:[1,453]},{46:[2,412]},{46:[2,413]},{13:$Va,16:$Vb,34:$Vl1,39:455,60:235,87:$VA,93:$Vn1,98:236,231:$VC,237:454,243:456,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt1,[2,435]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,251:457,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vt1,[2,149]),{35:$Vz1,93:$VA1,177:458},o($Vu1,[2,445]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,259:459,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vv1,[2,448],{264:460}),o($Vv1,[2,450],{266:461}),o($VV1,[2,446]),o($VV1,[2,447]),o($Vv1,[2,453]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,263:154,265:155,267:462,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,454]),o($VV1,[2,455]),o($VV1,[2,355],{176:463}),o($VV1,[2,354]),o([6,13,16,26,34,35,37,38,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339,340,341,342,343,344],[2,167]),{38:[1,464]},{278:[1,465]},{278:[1,466]},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:467,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{38:[1,468]},{38:[1,469]},o($Vy1,[2,177]),o($VB1,[2,184]),{13:$Va,16:$Vb,26:[1,471],34:$Vy,35:$Vz,36:472,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,287:470,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VY1,[2,464]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:473,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,468]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:474,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,470]),o($V61,[2,41]),o($VE1,[2,270]),o($Vc2,[2,44]),o($Vc2,[2,45]),o($Vc2,[2,46]),o($Vc2,[2,47]),{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:477,119:[1,475],231:$V_1,241:476,244:478,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V61,[2,42]),o($VF1,[2,272]),o($Vd2,[2,275],{96:479}),{13:$Va,16:$Vb,38:[2,402],60:298,195:$VJ1,221:481,223:480,224:$VK1,312:$Vd},o($VI1,[2,123]),o($VI1,[2,124]),o($VI1,[2,117]),{13:$Va,16:$Vb,60:482,312:$Vd},o($Va1,[2,52]),o([6,45,132,133,135,191],[2,68]),o($VM1,[2,320]),{13:$Va,16:$Vb,34:[1,484],60:485,147:483,312:$Vd},o($VM1,[2,70]),o($Vt,[2,330],{48:$Ve2,119:$Ve2}),{46:$Vh1,62:486},o($Vd1,[2,303]),o($Vi,[2,310],{136:487,320:[1,488]}),{46:$Vh1,62:489},o($Vd1,[2,309]),o($V12,[2,23]),o($V12,[2,262]),{87:[1,490]},{87:[1,491]},{13:$Va,16:$Vb,34:$Vf2,35:$Vz,60:321,72:319,73:320,79:492,80:493,81:$Vg2,82:318,83:$Vh2,84:496,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($V22,[2,266]),o($Vi2,[2,71]),o($Vi2,[2,72]),o($Ve1,$Vf1,{64:211,74:212,21:498,75:$Vg1}),o($Vi1,$Vj1,{63:219,67:220,24:499,68:$Vk1}),{46:[2,345],48:[2,73],89:509,90:$V5,119:[1,505],158:500,159:501,166:502,167:[1,503],168:[1,504],170:[1,506],173:[1,507],174:[1,508]},o($V42,[2,343],{165:510,328:[1,511]}),o($V6,$V3,{211:10,202:512,205:513,210:514,34:$Vj2}),o($Vk2,[2,379],{211:10,205:513,210:514,204:516,202:517,13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,34:$Vj2}),o($Vl2,[2,377]),o($Vl2,[2,378]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:519,203:521,226:$V62,228:518,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V6,$V3,{211:10,205:513,210:514,202:524,34:$Vj2}),o($Vi1,[2,24],{274:141,280:146,283:149,60:321,72:439,73:440,71:525,13:$Va,16:$Vb,34:$V72,35:$V82,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($Vm2,[2,263]),o($Vm2,[2,25]),o($Vm2,[2,26]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:526,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vm2,[2,29]),o($Vi1,$Vj1,{63:219,67:220,24:527,68:$Vk1}),o([48,119,227,328],[2,97],{190:528,191:[1,529]}),o($V92,[2,99]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:530,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vn2,[2,125]),o($Va2,[2,405]),o($Vn2,[2,126]),o($Vx,[2,14]),o($Vx,[2,15]),o($Vs1,[2,145]),{13:$Va,16:$Vb,34:$Vl1,39:532,60:235,87:$VA,93:$Vn1,98:236,231:$VC,233:531,243:533,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{235:[1,534]},{235:[2,420]},{235:[2,421]},o($Vt1,[2,147]),o($Vt1,[2,150]),o($Vu1,[2,152]),o($Vu1,[2,153],{270:373,269:535,26:$VW1,331:$VX1}),o($Vu1,[2,154],{270:373,269:536,26:$VW1,331:$VX1}),o($Vv1,[2,156]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:537,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,170]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:538,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:539,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{38:[1,540],278:[1,541]},o($Vy1,[2,174]),o($Vy1,[2,176]),{38:[1,542]},{38:[2,465]},{38:[2,466]},{38:[1,543]},{38:[2,471],191:[1,546],292:544,293:545},{13:$Va,16:$Vb,34:[1,548],60:549,238:547,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,193:550,195:$VR1,312:$Vd},o($VT1,[2,428]),o($VT1,[2,429]),{35:[1,553],48:[1,551],101:552},{38:[1,554]},{38:[2,403],330:[1,555]},o($Va1,[2,63]),{46:[1,556]},{46:[2,321]},{46:[2,322]},o($Va1,[2,57]),{13:$Va,16:$Vb,60:557,312:$Vd},o($Vi,[2,311]),o($Va1,[2,58]),o($V12,[2,36],{88:[1,558]}),o($V12,[2,37],{86:[1,559]}),o($VN1,[2,31],{274:141,280:146,283:149,82:318,72:319,73:320,60:321,84:496,80:560,13:$Va,16:$Vb,34:$Vf2,35:$Vz,81:$Vg2,83:$Vh2,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($Vo2,[2,267]),{35:$Vz,82:561},{35:$Vz,82:562},o($Vo2,[2,34]),o($Vo2,[2,35]),{31:563,48:[2,229],89:564,90:$V5},{32:565,48:[2,231],89:566,90:$V5},o($V42,[2,336]),o($Vp2,[2,337],{160:567,328:[1,568]}),{46:$Vh1,62:569},{46:$Vh1,62:570},{46:$Vh1,62:571},{13:$Va,16:$Vb,34:[1,573],60:574,169:572,312:$Vd},o($Vq2,[2,349],{171:575,321:[1,576]}),{13:$Va,16:$Vb,35:$Vz,60:321,72:319,73:320,82:318,84:577,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{35:[1,578]},o($Vr2,[2,84]),o($V42,[2,75]),o($Vt,[2,342],{46:$Vs2,48:$Vs2,90:$Vs2,119:$Vs2,167:$Vs2,168:$Vs2,170:$Vs2,173:$Vs2,174:$Vs2}),o($Vk2,[2,105]),o($Vt,[2,383],{206:579}),o($Vt,[2,381]),o($Vt,[2,382]),o($Vk2,[2,106]),o($Vk2,[2,380]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,38:[1,580],39:523,60:235,87:$VA,93:$Vn1,98:236,200:581,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Va2,[2,406]),o($Vt2,[2,131]),o($Vt2,[2,132]),o($Vt2,[2,410]),o($Vt2,[2,411]),{227:[1,582]},o($Vm2,[2,264]),{37:[1,584],38:[1,583]},o($V7,[2,17]),o($V92,[2,370]),o($V92,[2,371],{193:339,60:341,192:585,188:586,13:$Va,16:$Vb,34:$VQ1,195:$VR1,312:$Vd}),o($V92,[2,103],{278:[1,587]}),{13:$Va,16:$Vb,34:$VQ1,60:341,193:588,195:$VR1,312:$Vd},o($VT1,[2,414]),o($VT1,[2,415]),o($Vu2,[2,134]),o($Vv1,[2,449]),o($Vv1,[2,451]),{38:[1,589],278:[1,590]},{38:[1,591]},{278:[1,592]},o($Vy1,[2,91]),o($VV1,[2,358]),o($Vy1,[2,178]),o($Vy1,[2,179]),{38:[1,593]},{38:[2,472]},{294:[1,594]},{46:[1,595]},{46:[2,422]},{46:[2,423]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:597,231:$V_1,242:596,244:598,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V61,[2,43]),o($Vd2,[2,276]),{13:$Va,16:$Vb,60:395,87:$VA,97:600,98:396,99:397,100:$VZ1,102:599,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($VI1,[2,120]),o($V$1,[2,401]),o($Vt,$Vb1,{152:203,148:601,151:602,48:[2,323]}),o($Vd1,[2,61]),{87:[1,603]},{87:[1,604]},o($Vo2,[2,268]),o($Vo2,[2,32]),o($Vo2,[2,33]),{48:[2,11]},{48:[2,230]},{48:[2,12]},{48:[2,232]},o($Vt,$VO1,{163:328,161:605,162:606,46:$Vv2,48:$Vv2,90:$Vv2,119:$Vv2,167:$Vv2,168:$Vv2,170:$Vv2,173:$Vv2,174:$Vv2}),o($Vp2,[2,338]),o($Vr2,[2,76],{329:[1,607]}),o($Vr2,[2,77]),o($Vr2,[2,78]),{46:$Vh1,62:608},{46:[2,347]},{46:[2,348]},{13:$Va,16:$Vb,34:[1,610],60:611,172:609,312:$Vd},o($Vq2,[2,350]),o($Vr2,[2,81]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:612,39:613,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,231:$VC,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:614,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vw2,[2,127]),o($Va2,[2,407]),o($Vw2,[2,128]),o($Vm2,[2,27]),{34:[1,615]},o($V92,[2,98]),o($V92,[2,372]),o($Vt,[2,374]),{13:$Va,16:$Vb,34:$Vl1,39:617,60:235,87:$VA,93:$Vn1,98:236,231:$VC,234:616,243:618,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vy1,[2,89]),o($VV1,[2,356]),o($Vy1,[2,171]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:619,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,180]),{295:[1,620]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:622,231:$V_1,239:621,244:623,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{235:[1,624]},{235:[2,430]},{235:[2,431]},{13:$Va,16:$Vb,38:[1,625],60:395,87:$VA,97:626,98:396,99:397,100:$VZ1,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vx2,[2,277]),{48:[1,627]},{48:[2,324]},o($V12,[2,38]),o($V12,[2,39]),o($V42,[2,74]),o($V42,[2,340]),{46:[2,346]},o($Vr2,[2,79]),{46:$Vh1,62:628},{46:[2,351]},{46:[2,352]},{37:[1,629]},{37:[1,630]},o($Vy2,[2,385],{207:631,278:[1,632]}),{38:[1,633]},{48:[1,634]},{48:[2,416]},{48:[2,417]},{38:[1,635]},{296:636,302:$VS,303:$VT,304:$VU,305:$VV},{13:$Va,16:$Vb,34:$VQ1,60:341,193:637,195:$VR1,312:$Vd},o($VT1,[2,424]),o($VT1,[2,425]),o($Vz2,[2,136]),o($Vd2,[2,48]),o($Vx2,[2,278]),o($VA2,[2,325],{149:638,328:[1,639]}),o($Vr2,[2,80]),{34:[1,640]},{34:[1,641]},o([46,48,90,119,167,168,170,173,174,227,328],[2,107],{208:642,191:[1,643]}),o($Vt,[2,384]),o($Vm2,[2,28]),{235:[1,644]},o($Vy1,[2,172]),{38:[2,181]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:646,231:$V_1,240:645,244:647,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt,$Vb1,{152:203,150:648,151:649,48:$VB2,119:$VB2}),o($VA2,[2,326]),{38:[1,650]},{38:[1,651]},o($Vy2,[2,386]),o($Vy2,[2,108],{211:10,209:652,210:653,13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,34:[1,654]}),o($Vu2,[2,133]),{48:[1,655]},{48:[2,426]},{48:[2,427]},o($VM1,[2,69]),o($VM1,[2,328]),o($Vr2,[2,82]),o($Vr2,[2,83]),o($Vt,[2,375],{198:656,199:657}),o($Vt,[2,387]),o($Vt,[2,388]),{235:[1,658]},o($Vy2,[2,109]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:659,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vz2,[2,135]),o($Vy2,[2,104],{278:[1,660]}),o($Vt,[2,376])], - defaultActions: {5:[2,206],6:[2,207],7:[2,208],9:[2,205],28:[2,1],29:[2,3],30:[2,218],85:[2,49],94:[2,297],108:[2,254],115:[2,360],165:[2,462],260:[2,443],334:[2,238],335:[2,93],359:[2,412],360:[2,413],455:[2,420],456:[2,421],471:[2,465],472:[2,466],484:[2,321],485:[2,322],545:[2,472],548:[2,422],549:[2,423],563:[2,11],564:[2,230],565:[2,12],566:[2,232],573:[2,347],574:[2,348],597:[2,430],598:[2,431],602:[2,324],607:[2,346],610:[2,351],611:[2,352],617:[2,416],618:[2,417],636:[2,181],646:[2,426],647:[2,427]}, - parseError: function parseError (str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - var error = new Error(str); - error.hash = hash; - throw error; - } - }, - parse: function parse(input) { - var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } } - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - _token_stack: - var lex = function () { - var token; - token = lexer.lex() || EOF; - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - }; - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - sharedState.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; + // Check if id of each AS-selected column is not yet bound by subquery + const subqueries = $$[$0-1].where.filter(w => w.type === "query"); + if (subqueries.length > 0) { + const selectedVarIds = $$[$0-3].variables.filter(v => v.variable && v.variable.value).map(v => v.variable.value); + const subqueryIds = flatten(subqueries.map(sub => sub.variables)).map(v => v.value || v.variable.value); + for (const selectedVarId of selectedVarIds) { + if (subqueryIds.indexOf(selectedVarId) >= 0) { + throw Error("Target id of 'AS' (?" + selectedVarId + ") already used in subquery"); } + } } - return true; - }}; - - /* - SPARQL parser in the Jison parser generator format. - */ - - var Wildcard = (__webpack_require__(87735)/* .Wildcard */ .R); - - // Common namespaces and entities - var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - RDF_TYPE = RDF + 'type', - RDF_FIRST = RDF + 'first', - RDF_REST = RDF + 'rest', - RDF_NIL = RDF + 'nil', - XSD = 'http://www.w3.org/2001/XMLSchema#', - XSD_INTEGER = XSD + 'integer', - XSD_DECIMAL = XSD + 'decimal', - XSD_DOUBLE = XSD + 'double', - XSD_BOOLEAN = XSD + 'boolean'; - - var base = '', basePath = '', baseRoot = ''; - - // Returns a lowercase version of the given string - function lowercase(string) { - return string.toLowerCase(); - } - - // Appends the item to the array and returns the array - function appendTo(array, item) { - return array.push(item), array; - } - - // Appends the items to the array and returns the array - function appendAllTo(array, items) { - return array.push.apply(array, items), array; - } - - // Extends a base object with properties of other objects - function extend(base) { - if (!base) base = {}; - for (var i = 1, l = arguments.length, arg; i < l && (arg = arguments[i] || {}); i++) - for (var name in arg) - base[name] = arg[name]; - return base; - } - - // Creates an array that contains all items of the given arrays - function unionAll() { - var union = []; - for (var i = 0, l = arguments.length; i < l; i++) - union = union.concat.apply(union, arguments[i]); - return union; - } - - // Resolves an IRI against a base path - function resolveIRI(iri) { - // Strip off possible angular brackets - if (iri[0] === '<') - iri = iri.substring(1, iri.length - 1); - // Return absolute IRIs unmodified - if (/^[a-z]+:/i.test(iri)) - return iri; - if (!Parser.base) - throw new Error('Cannot resolve relative IRI ' + iri + ' because no base IRI was set.'); - if (base !== Parser.base) { - base = Parser.base; - basePath = base.replace(/[^\/:]*$/, ''); - baseRoot = base.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]; - } - switch (iri[0]) { - // An empty relative IRI indicates the base IRI - case undefined: - return base; - // Resolve relative fragment IRIs against the base IRI - case '#': - return base + iri; - // Resolve relative query string IRIs by replacing the query string - case '?': - return base.replace(/(?:\?.*)?$/, iri); - // Resolve root relative IRIs at the root of the base IRI - case '/': - return baseRoot + iri; - // Resolve all other IRIs at the base IRI's path - default: - return basePath + iri; - } - } - - // If the item is a variable, ensures it starts with a question mark - function toVar(variable) { - if (variable) { - var first = variable[0]; - if (first === '?' || first === '$') return Parser.factory.variable(variable.substr(1)); - } - return variable; - } - - // Creates an operation with the given name and arguments - function operation(operatorName, args) { - return { type: 'operation', operator: operatorName, args: args || [] }; - } - - // Creates an expression with the given type and attributes - function expression(expr, attr) { - var expression = { expression: expr === '*'? new Wildcard() : expr }; - if (attr) - for (var a in attr) - expression[a] = attr[a]; - return expression; - } - - // Creates a path with the given type and items - function path(type, items) { - return { type: 'path', pathType: type, items: items }; - } - - // Transforms a list of operations types and arguments into a tree of operations - function createOperationTree(initialExpression, operationList) { - for (var i = 0, l = operationList.length, item; i < l && (item = operationList[i]); i++) - initialExpression = operation(item[0], [initialExpression, item[1]]); - return initialExpression; - } - - // Group datasets by default and named - function groupDatasets(fromClauses, groupName) { - var defaults = [], named = [], l = fromClauses.length, fromClause, group = {}; - if (!l) - return null; - for (var i = 0; i < l && (fromClause = fromClauses[i]); i++) - (fromClause.named ? named : defaults).push(fromClause.iri); - group[groupName || 'from'] = { default: defaults, named: named }; - return group; - } - - // Converts the string to a number - function toInt(string) { - return parseInt(string, 10); - } - - // Transforms a possibly single group into its patterns - function degroupSingle(group) { - return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group; - } - - // Creates a literal with the given value and type - function createTypedLiteral(value, type) { - if (type && type.termType !== 'NamedNode'){ - type = Parser.factory.namedNode(type); - } - return Parser.factory.literal(value, type); - } - - // Creates a literal with the given value and language - function createLangLiteral(value, lang) { - return Parser.factory.literal(value, lang); - } - - // Creates a triple with the given subject, predicate, and object - function triple(subject, predicate, object) { - var triple = {}; - if (subject != null) triple.subject = subject; - if (predicate != null) triple.predicate = predicate; - if (object != null) triple.object = object; - return triple; - } - - // Creates a new blank node - function blank(name) { - if (typeof name === 'string') { // Only use name if a name is given - if (name.startsWith('e_')) return Parser.factory.blankNode(name); - return Parser.factory.blankNode('e_' + name); - } - return Parser.factory.blankNode('g_' + blankId++); - }; - var blankId = 0; - Parser._resetBlanks = function () { blankId = 0; } - - // Regular expression and replacement strings to escape strings - var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g, - escapeReplacements = { '\\': '\\', "'": "'", '"': '"', - 't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' }, - partialSurrogatesWithoutEndpoint = /[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/, - fromCharCode = String.fromCharCode; - - // Translates escape codes in the string into their textual equivalent - function unescapeString(string, trimLength) { - string = string.substring(trimLength, string.length - trimLength); - try { - string = string.replace(escapeSequence, function (sequence, unicode4, unicode8, escapedChar) { - var charCode; - if (unicode4) { - charCode = parseInt(unicode4, 16); - if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance - return fromCharCode(charCode); - } - else if (unicode8) { - charCode = parseInt(unicode8, 16); - if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance - if (charCode < 0xFFFF) return fromCharCode(charCode); - return fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF)); - } - else { - var replacement = escapeReplacements[escapedChar]; - if (!replacement) throw new Error(); - return replacement; - } - }); + this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]) + +break; +case 8: +this.$ = extend($$[$0-1], {variables: [new Wildcard()]}); +break; +case 9: + + // Check if id of each selected column is different + const selectedVarIds = $$[$0].map(v => v.value || v.variable.value); + const duplicates = getDuplicatesInArray(selectedVarIds); + if (duplicates.length > 0) { + throw Error("Two or more of the resulting columns have the same name (?" + duplicates[0] + ")"); } - catch (error) { return ''; } - - // Test for invalid unicode surrogate pairs - if (partialSurrogatesWithoutEndpoint.exec(string)) { - throw new Error('Invalid unicode codepoint of surrogate pair without corresponding codepoint in ' + string); - } - - return string; - } - - // Creates a list, collecting its (possibly blank) items and triples associated with those items - function createList(objects) { - var list = blank(), head = list, listItems = [], listTriples, triples = []; - objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); }); - - // Build an RDF list out of the items - for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) - listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]), - listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)); - - // Return the list's identifier, its triples, and the triples associated with its items - return { entity: list, triples: appendAllTo(listTriples, triples) }; - } - - // Creates a blank node identifier, collecting triples with that blank node as subject - function createAnonymousObject(propertyList) { - var entity = blank(); - return { - entity: entity, - triples: propertyList.map(function (t) { return extend(triple(entity), t); }) - }; - } - - // Collects all (possibly blank) objects, and triples that have them as subject - function objectListToTriples(predicate, objectList, otherTriples) { - var objects = [], triples = []; - objectList.forEach(function (l) { - objects.push(triple(null, predicate, l.entity)); - appendAllTo(triples, l.triples); + + this.$ = extend($$[$0-1], { variables: $$[$0] }) + +break; +case 10: +this.$ = extend({ queryType: 'SELECT'}, $$[$0] && ($$[$0-1] = lowercase($$[$0]), $$[$0] = {}, $$[$0][$$[$0-1]] = true, $$[$0])); +break; +case 11: case 12: +this.$ = extend($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], { type: 'query' }); +break; +case 13: case 100: case 137: case 166: +this.$ = toVar($$[$0]); +break; +case 14: case 28: +this.$ = expression($$[$0-3], { variable: toVar($$[$0-1]) }); +break; +case 15: +this.$ = ensureSparqlStar(expression($$[$0-3], { variable: toVar($$[$0-1]) })); +break; +case 16: +this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 17: +this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-2] = ($$[$0-2] ? $$[$0-2].triples : []) }, groupDatasets($$[$0-5]), { where: [ { type: 'bgp', triples: appendAllTo([], $$[$0-2]) } ] }, $$[$0]); +break; +case 18: +this.$ = extend({ queryType: 'DESCRIBE', variables: $$[$0-3] === '*' ? [new Wildcard()] : $$[$0-3].map(toVar) }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 19: +this.$ = extend({ queryType: 'ASK' }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 20: case 61: +this.$ = { iri: $$[$0], named: !!$$[$0-1] }; +break; +case 21: +this.$ = { where: $$[$0].patterns }; +break; +case 22: +this.$ = extend($$[$0-1], $$[$0]); +break; +case 23: +this.$ = extend($$[$0-2], $$[$0-1], $$[$0]); +break; +case 24: +this.$ = { group: $$[$0] }; +break; +case 25: case 26: case 32: case 34: +this.$ = expression($$[$0]); +break; +case 27: +this.$ = expression($$[$0-1]); +break; +case 29: case 35: +this.$ = expression(toVar($$[$0])); +break; +case 30: +this.$ = { having: $$[$0] }; +break; +case 31: +this.$ = { order: $$[$0] }; +break; +case 33: +this.$ = expression($$[$0], { descending: true }); +break; +case 36: +this.$ = { limit: toInt($$[$0]) }; +break; +case 37: +this.$ = { offset: toInt($$[$0]) }; +break; +case 38: +this.$ = { limit: toInt($$[$0-2]), offset: toInt($$[$0]) }; +break; +case 39: +this.$ = { limit: toInt($$[$0]), offset: toInt($$[$0-2]) }; +break; +case 40: +this.$ = { type: 'values', values: $$[$0] }; +break; +case 41: + + this.$ = $$[$0-1].map(function(v) { var o = {}; o[$$[$0-3]] = v; return o; }) + +break; +case 42: + + this.$ = $$[$0-1].map(function() { return {}; }) + +break; +case 43: + + var length = $$[$0-4].length; + $$[$0-4] = $$[$0-4].map(toVar); + this.$ = $$[$0-1].map(function (values) { + if (values.length !== length) + throw Error('Inconsistent VALUES length'); + var valuesObject = {}; + for(var i = 0; i el.type === "bind")) { + const index = $$[$0-1].indexOf(binding); + const boundVars = new Set(); + //Collect all bounded variables before the binding + for (const el of $$[$0-1].slice(0, index)) { + if (el.type === "group" || el.type === "bgp") { + getBoundVarsFromGroupGraphPattern(el).forEach(boundVar => boundVars.add(boundVar)); + } + } + // If binding with a non-free variable, throw error + if (boundVars.has(binding.variable.value)) { + throw Error("Variable used to bind is already bound (?" + binding.variable.value + ")"); + } + } + this.$ = { type: 'group', patterns: $$[$0-1] } + +break; +case 73: +this.$ = $$[$0-1] ? unionAll([$$[$0-1]], $$[$0]) : unionAll($$[$0]); +break; +case 74: +this.$ = $$[$0] ? [$$[$0-2], $$[$0]] : $$[$0-2]; +break; +case 76: + + if ($$[$0-1].length) + this.$ = { type: 'union', patterns: unionAll($$[$0-1].map(degroupSingle), [degroupSingle($$[$0])]) }; + else + this.$ = $$[$0]; + +break; +case 77: +this.$ = extend($$[$0], { type: 'optional' }); +break; +case 78: +this.$ = extend($$[$0], { type: 'minus' }); +break; +case 79: +this.$ = extend($$[$0], { type: 'graph', name: toVar($$[$0-1]) }); +break; +case 80: +this.$ = extend($$[$0], { type: 'service', name: toVar($$[$0-1]), silent: !!$$[$0-2] }); +break; +case 81: +this.$ = { type: 'filter', expression: $$[$0] }; +break; +case 82: +this.$ = { type: 'bind', variable: toVar($$[$0-1]), expression: $$[$0-3] }; +break; +case 83: +this.$ = ensureSparqlStar({ type: 'bind', variable: toVar($$[$0-1]), expression: $$[$0-3] }); +break; +case 88: +this.$ = { type: 'functionCall', function: $$[$0-1], args: [] }; +break; +case 89: +this.$ = { type: 'functionCall', function: $$[$0-5], args: appendTo($$[$0-2], $$[$0-1]), distinct: !!$$[$0-3] }; +break; +case 90: case 108: case 119: case 211: case 219: case 221: case 233: case 235: case 245: case 249: case 269: case 271: case 275: case 279: case 302: case 308: case 319: case 329: case 335: case 341: case 345: case 355: case 357: case 361: case 369: case 373: case 375: case 383: case 385: case 389: case 391: case 400: case 432: case 434: case 444: case 448: case 450: case 452: +this.$ = []; +break; +case 91: +this.$ = appendTo($$[$0-2], $$[$0-1]); +break; +case 93: +this.$ = unionAll($$[$0-2], [$$[$0-1]]); +break; +case 94: case 105: +this.$ = $$[$0].map(function (t) { return extend(triple($$[$0-1]), t); }); +break; +case 95: +this.$ = appendAllTo($$[$0].map(function (t) { return extend(triple($$[$0-1].entity), t); }), $$[$0-1].triples) /* the subject is a blank node, possibly with more triples */; +break; +case 97: +this.$ = unionAll([$$[$0-1]], $$[$0]); +break; +case 98: +this.$ = unionAll($$[$0]); +break; +case 99: +this.$ = objectListToTriples($$[$0-1], $$[$0]); +break; +case 102: case 115: case 122: +this.$ = Parser.factory.namedNode(RDF_TYPE); +break; +case 103: case 104: +this.$ = appendTo($$[$0-1], $$[$0]); +break; +case 106: +this.$ = !$$[$0] ? $$[$0-1].triples : appendAllTo($$[$0].map(function (t) { return extend(triple($$[$0-1].entity), t); }), $$[$0-1].triples) /* the subject is a blank node, possibly with more triples */; +break; +case 107: +this.$ = objectListToTriples(toVar($$[$0-3]), appendTo($$[$0-2], $$[$0-1]), $$[$0]); +break; +case 109: +this.$ = objectListToTriples(toVar($$[$0-1]), $$[$0]); +break; +case 110: +this.$ = $$[$0-1].length ? path('|',appendTo($$[$0-1], $$[$0])) : $$[$0]; +break; +case 111: +this.$ = $$[$0-1].length ? path('/', appendTo($$[$0-1], $$[$0])) : $$[$0]; +break; +case 112: +this.$ = $$[$0] ? path($$[$0], [$$[$0-1]]) : $$[$0-1]; +break; +case 113: +this.$ = $$[$0-1] ? path($$[$0-1], [$$[$0]]) : $$[$0];; +break; +case 116: case 123: +this.$ = path($$[$0-1], [$$[$0]]); +break; +case 120: +this.$ = path('|', appendTo($$[$0-2], $$[$0-1])); +break; +case 124: +this.$ = path($$[$0-1], [Parser.factory.namedNode(RDF_TYPE)]); +break; +case 125: case 127: +this.$ = createList($$[$0-1]); +break; +case 126: case 128: +this.$ = createAnonymousObject($$[$0-1]); +break; +case 129: +this.$ = { entity: $$[$0], triples: [] } /* for consistency with TriplesNode */; +break; +case 131: +this.$ = { entity: $$[$0], triples: [] } /* for consistency with TriplesNodePath */; +break; +case 133: case 135: +this.$ = ensureSparqlStar(Parser.factory.quad($$[$0-4], $$[$0-3], $$[$0-2], toVar($$[$0-6]))); +break; +case 134: case 136: +this.$ = ensureSparqlStar(Parser.factory.quad($$[$0-3], $$[$0-2], $$[$0-1])); +break; +case 141: +this.$ = blank($$[$0].replace(/^(_:)/,''));; +break; +case 142: +this.$ = blank(); +break; +case 143: +this.$ = Parser.factory.namedNode(RDF_NIL); +break; +case 144: case 146: case 151: case 155: +this.$ = createOperationTree($$[$0-1], $$[$0]); +break; +case 145: +this.$ = ['||', $$[$0]]; +break; +case 147: +this.$ = ['&&', $$[$0]]; +break; +case 149: +this.$ = operation($$[$0-1], [$$[$0-2], $$[$0]]); +break; +case 150: +this.$ = operation($$[$0-2] ? 'notin' : 'in', [$$[$0-3], $$[$0]]); +break; +case 152: case 156: +this.$ = [$$[$0-1], $$[$0]]; +break; +case 153: +this.$ = ['+', createOperationTree($$[$0-1], $$[$0])]; +break; +case 154: + + var negatedLiteral = createTypedLiteral($$[$0-1].value.replace('-', ''), $$[$0-1].datatype); + this.$ = ['-', createOperationTree(negatedLiteral, $$[$0])]; + +break; +case 157: +this.$ = operation('UPLUS', [$$[$0]]); +break; +case 158: +this.$ = operation($$[$0-1], [$$[$0]]); +break; +case 159: +this.$ = operation('UMINUS', [$$[$0]]); +break; +case 169: +this.$ = operation(lowercase($$[$0-1])); +break; +case 170: +this.$ = operation(lowercase($$[$0-3]), [$$[$0-1]]); +break; +case 171: +this.$ = operation(lowercase($$[$0-5]), [$$[$0-3], $$[$0-1]]); +break; +case 172: +this.$ = operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]]); +break; +case 173: +this.$ = operation(lowercase($$[$0-1]), $$[$0]); +break; +case 174: +this.$ = operation('bound', [toVar($$[$0-1])]); +break; +case 175: +this.$ = operation($$[$0-1], []); +break; +case 176: +this.$ = operation($$[$0-3], [$$[$0-1]]); +break; +case 177: +this.$ = operation($$[$0-2] ? 'notexists' :'exists', [degroupSingle($$[$0])]); +break; +case 178: case 179: +this.$ = expression($$[$0-1], { type: 'aggregate', aggregation: lowercase($$[$0-4]), distinct: !!$$[$0-2] }); +break; +case 180: +this.$ = expression($$[$0-2], { type: 'aggregate', aggregation: lowercase($$[$0-5]), distinct: !!$$[$0-3], separator: typeof $$[$0-1] === 'string' ? $$[$0-1] : ' ' }); +break; +case 182: +this.$ = createTypedLiteral($$[$0]); +break; +case 183: +this.$ = createLangLiteral($$[$0-1], lowercase($$[$0].substr(1))); +break; +case 184: +this.$ = createTypedLiteral($$[$0-2], $$[$0]); +break; +case 185: case 198: +this.$ = createTypedLiteral($$[$0], XSD_INTEGER); +break; +case 186: case 199: +this.$ = createTypedLiteral($$[$0], XSD_DECIMAL); +break; +case 187: case 200: +this.$ = createTypedLiteral(lowercase($$[$0]), XSD_DOUBLE); +break; +case 190: +this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_BOOLEAN); +break; +case 191: case 192: +this.$ = unescapeString($$[$0], 1); +break; +case 193: case 194: +this.$ = unescapeString($$[$0], 3); +break; +case 195: +this.$ = createTypedLiteral($$[$0].substr(1), XSD_INTEGER); +break; +case 196: +this.$ = createTypedLiteral($$[$0].substr(1), XSD_DECIMAL); +break; +case 197: +this.$ = createTypedLiteral($$[$0].substr(1).toLowerCase(), XSD_DOUBLE); +break; +case 201: +this.$ = Parser.factory.namedNode(resolveIRI($$[$0])); +break; +case 202: + + var namePos = $$[$0].indexOf(':'), + prefix = $$[$0].substr(0, namePos), + expansion = Parser.prefixes[prefix]; + if (!expansion) throw new Error('Unknown prefix: ' + prefix); + var uriString = resolveIRI(expansion + $$[$0].substr(namePos + 1)); + this.$ = Parser.factory.namedNode(uriString); + +break; +case 203: + + $$[$0] = $$[$0].substr(0, $$[$0].length - 1); + if (!($$[$0] in Parser.prefixes)) throw new Error('Unknown prefix: ' + $$[$0]); + var uriString = resolveIRI(Parser.prefixes[$$[$0]]); + this.$ = Parser.factory.namedNode(uriString); + +break; +case 212: case 220: case 222: case 224: case 234: case 236: case 242: case 246: case 250: case 264: case 266: case 268: case 270: case 272: case 274: case 276: case 278: case 303: case 309: case 320: case 336: case 370: case 386: case 405: case 407: case 433: case 435: case 445: case 449: case 451: case 453: +$$[$0-1].push($$[$0]); +break; +case 223: case 241: case 263: case 265: case 267: case 273: case 277: case 404: case 406: +this.$ = [$$[$0]]; +break; +case 280: +$$[$0-3].push($$[$0-2]); +break; +case 330: case 342: case 346: case 356: case 358: case 362: case 374: case 376: case 384: case 390: case 392: case 401: +$$[$0-2].push($$[$0-1]); +break; +} +}, +table: [o($V0,$V1,{3:1,4:2,7:3}),{1:[3]},o($V2,[2,279],{5:4,8:5,313:6,210:7,9:8,103:9,211:10,17:11,40:12,49:13,54:14,104:15,18:16,22:17,25:21,6:[2,204],13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,28:$V4,41:[1,18],50:[1,19],55:[1,20]}),o([6,13,16,28,35,41,50,55,107,117,120,122,123,132,133,138,195,219,224,312,322,323,324,325,326],[2,2],{314:23,11:24,14:25,12:[1,26],15:[1,27]}),{6:[1,28]},{6:[2,206]},{6:[2,207]},{6:[2,208]},{6:[2,217],10:29,89:30,90:$V5},{6:[2,205]},o($V6,[2,391],{212:32,213:33}),o($V7,[2,213]),o($V7,[2,214]),o($V7,[2,215]),o($V7,[2,216]),{105:34,107:[1,35],110:36,113:37,117:[1,38],120:[1,39],122:[1,40],123:[1,41],124:42,128:43,132:[2,304],133:[2,298],137:49,138:[1,50],322:[1,44],323:[1,45],324:[1,46],325:[1,47],326:[1,48]},o($V8,[2,219],{19:51}),o($V8,[2,221],{23:52}),o($V9,[2,235],{42:53,44:54,46:[1,55]}),{13:$Va,16:$Vb,26:[1,58],34:$Vc,51:56,60:61,312:$Vd,318:59,319:57},o($V8,[2,249],{56:65}),{26:[1,66],27:67,33:68,34:$Ve,35:$Vf},o($Vg,[2,227],{29:71,315:72,316:[1,73],317:[1,74]}),o($V0,[2,212]),o($V0,[2,209]),o($V0,[2,210]),{13:[1,75]},{16:[1,76]},{1:[2,1]},{6:[2,3]},{6:[2,218]},{34:[1,78],35:[1,80],91:77,93:[1,79]},o([6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312],[2,110],{330:[1,81]}),o($Vh,[2,398],{214:82,218:83,224:[1,84]}),{6:[2,281],106:85,191:[1,86]},o($Vi,[2,283],{108:87,321:[1,88]}),o($Vj,[2,289],{111:89,321:[1,90]}),o($Vk,[2,294],{114:91,321:[1,92]}),{118:93,119:[2,296],321:[1,94]},{46:$Vl,121:95},{46:$Vl,121:97},{46:$Vl,121:98},{125:99,133:$Vm},{129:101,132:$Vn},o($Vo,[2,287]),o($Vo,[2,288]),o($Vp,[2,291]),o($Vp,[2,292]),o($Vp,[2,293]),{132:[2,305],133:[2,299]},{13:$Va,16:$Vb,60:103,312:$Vd},{20:104,45:$Vq,46:$Vr,57:105,58:$Vs,61:106},{20:109,45:$Vq,46:$Vr,57:110,58:$Vs,61:106},o($V8,[2,233],{43:111}),{45:[1,112],57:113,58:$Vs},o($Vt,[2,361],{179:114,180:115,181:116,48:[2,359]}),o($Vu,[2,245],{52:117}),o($Vu,[2,243],{60:61,318:118,13:$Va,16:$Vb,34:$Vc,312:$Vd}),o($Vu,[2,244]),o($Vv,[2,241]),o($Vv,[2,239]),o($Vv,[2,240]),o($Vw,[2,201]),o($Vw,[2,202]),o($Vw,[2,203]),{20:119,45:$Vq,46:$Vr,57:120,58:$Vs,61:106},o($V8,[2,8]),o($V8,[2,9],{33:121,34:$Ve,35:$Vf}),o($Vx,[2,223]),o($Vx,[2,13]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:122,39:123,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,231:$VC,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vg,[2,10]),o($Vg,[2,228]),o($Vg,[2,225]),o($Vg,[2,226]),o($V0,[2,4]),{13:[1,176]},o($V61,[2,40]),{46:[1,177]},{46:[1,178]},{34:[1,180],95:179},o($V6,[2,390]),o([6,13,16,34,35,38,87,93,226,231,245,246,299,300,301,302,303,304,305,306,307,308,309,310,311,312,330],[2,111],{331:[1,181]}),{13:$Va,16:$Vb,35:[1,187],60:184,195:[1,185],215:182,216:183,219:[1,186],312:$Vd},o($Vh,[2,399]),{6:[2,49]},o($V0,$V1,{7:3,4:188}),{13:$Va,16:$Vb,60:189,312:$Vd},o($Vi,[2,284]),{112:190,119:[1,191],141:[1,193],143:192,320:[1,194],327:[1,195]},o($Vj,[2,290]),o($Vi,$V71,{115:196,142:198,119:$V81,141:$V91}),o($Vk,[2,295]),{119:[1,200]},{119:[2,297]},o($Va1,[2,54]),o($Vt,$Vb1,{144:201,151:202,152:203,48:$Vc1,119:$Vc1}),o($Va1,[2,55]),o($Va1,[2,56]),o($Vd1,[2,300],{126:204,129:205,132:$Vn}),{46:$Vl,121:206},o($Vd1,[2,306],{130:207,125:208,133:$Vm}),{46:$Vl,121:209},o([132,133],[2,62]),o($Ve1,$Vf1,{21:210,64:211,74:212,75:$Vg1}),o($V8,[2,220]),{46:$Vh1,62:214},o($Vi,[2,251],{59:216,320:[1,217]}),{46:[2,254]},o($Vi1,$Vj1,{24:218,63:219,67:220,68:$Vk1}),o($V8,[2,222]),{20:222,45:$Vq,46:$Vr,57:223,58:$Vs,61:106},{46:[1,224]},o($V9,[2,236]),{48:[1,225]},{48:[2,360]},{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:230,60:235,87:$VA,93:$Vn1,98:236,153:226,183:227,185:228,226:$Vo1,231:$VC,243:229,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vr1,[2,247],{61:106,53:240,57:241,20:242,45:$Vq,46:$Vr,58:$Vs}),o($Vv,[2,242]),o($Vi1,$Vj1,{63:219,67:220,24:243,68:$Vk1}),o($V8,[2,250]),o($Vx,[2,224]),{37:[1,244]},{37:[1,245]},o($Vs1,[2,432],{248:246}),{13:$Va,16:$Vb,34:$Vl1,39:249,60:235,87:$VA,93:$Vn1,98:236,119:[1,247],231:$VC,236:248,243:250,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt1,[2,434],{252:251}),o($Vt1,[2,148],{256:252,257:253,258:[2,442],295:[1,254],334:[1,255],335:[1,256],336:[1,257],337:[1,258],338:[1,259],339:[1,260]}),o($Vu1,[2,444],{260:261}),o($Vv1,[2,452],{268:262}),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:263,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:264,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,263:154,265:155,272:265,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vv1,[2,160]),o($Vv1,[2,161]),o($Vv1,[2,162]),o($Vv1,[2,163],{35:$Vw1,93:$Vx1}),o($Vv1,[2,164]),o($Vv1,[2,165]),o($Vv1,[2,166]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:268,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,168]),{93:[1,269]},{35:[1,270]},{35:[1,271]},{35:[1,272]},{35:$Vz1,93:$VA1,177:273},{35:[1,276]},{35:[1,278],93:[1,277]},{284:[1,279]},o($VB1,[2,182],{297:[1,280],298:[1,281]}),o($VB1,[2,185]),o($VB1,[2,186]),o($VB1,[2,187]),o($VB1,[2,188]),o($VB1,[2,189]),o($VB1,[2,190]),{35:[1,282]},{35:[1,283]},{35:[1,284]},o($VC1,[2,456]),o($VC1,[2,457]),o($VC1,[2,458]),o($VC1,[2,459]),o($VC1,[2,460]),{284:[2,462]},o($VD1,[2,191]),o($VD1,[2,192]),o($VD1,[2,193]),o($VD1,[2,194]),o($VB1,[2,195]),o($VB1,[2,196]),o($VB1,[2,197]),o($VB1,[2,198]),o($VB1,[2,199]),o($VB1,[2,200]),o($V0,[2,5]),o($VE1,[2,269],{92:285}),o($VF1,[2,271],{94:286}),{34:[1,288],38:[1,287]},o($VG1,[2,273]),o($V6,[2,392]),o($VH1,[2,113]),o($VH1,[2,396],{217:289,332:290,26:[1,292],271:[1,293],333:[1,291]}),o($VI1,[2,114]),o($VI1,[2,115]),{13:$Va,16:$Vb,35:[1,297],60:298,93:[1,296],195:$VJ1,220:294,221:295,224:$VK1,312:$Vd},o($V6,$V3,{211:10,210:301}),o($V2,[2,280],{6:[2,282]}),o($Va1,[2,285],{109:302,139:303,140:[1,304]}),o($Va1,[2,51]),{13:$Va,16:$Vb,60:305,312:$Vd},o($Va1,[2,67]),o($Va1,[2,314]),o($Va1,[2,315]),o($Va1,[2,316]),{116:[1,306]},o($VL1,[2,64]),{13:$Va,16:$Vb,60:307,312:$Vd},o($Vi,[2,313]),{13:$Va,16:$Vb,60:308,312:$Vd},o($VM1,[2,319],{145:309}),o($VM1,[2,318]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:230,60:235,87:$VA,93:$Vn1,98:236,153:310,183:227,185:228,226:$Vo1,231:$VC,243:229,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vd1,[2,302],{127:311}),o($Vd1,[2,301]),o([45,132,135],[2,60]),o($Vd1,[2,308],{131:312}),o($Vd1,[2,307]),o([45,133,135],[2,59]),o($V7,[2,6]),o($VN1,[2,259],{65:313,77:314,78:[1,315]}),o($Ve1,[2,258]),{13:$Va,16:$Vb,35:$Vz,60:321,72:319,73:320,76:316,82:318,84:317,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o([6,48,68,75,78,86,88,90],[2,21]),o($Vt,$VO1,{25:21,30:322,155:323,18:324,22:325,156:326,162:327,163:328,28:$V4,46:$VP1,48:$VP1,90:$VP1,119:$VP1,167:$VP1,168:$VP1,170:$VP1,173:$VP1,174:$VP1}),{13:$Va,16:$Vb,60:329,312:$Vd},o($Vi,[2,252]),o($V7,[2,7]),o($Ve1,$Vf1,{64:211,74:212,21:330,75:$Vg1}),o($Vi1,[2,256]),{69:[1,331]},o($Vi1,$Vj1,{63:219,67:220,24:332,68:$Vk1}),o($V8,[2,234]),o($Vt,$Vb1,{152:203,47:333,151:334,48:[2,237]}),o($V8,[2,92]),{48:[2,363],182:335,328:[1,336]},{13:$Va,16:$Vb,34:$VQ1,60:341,184:337,188:338,193:339,195:$VR1,312:$Vd},o($VS1,[2,367],{188:338,193:339,60:341,186:343,187:344,184:345,13:$Va,16:$Vb,34:$VQ1,195:$VR1,312:$Vd}),o($VT1,[2,365]),o($VT1,[2,366]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:347,225:346,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,184:352,188:338,193:339,195:$VR1,312:$Vd},o($VU1,[2,137]),o($VU1,[2,138]),o($VU1,[2,139]),o($VU1,[2,140]),o($VU1,[2,141]),o($VU1,[2,142]),o($VU1,[2,143]),o($Vi1,$Vj1,{63:219,67:220,24:353,68:$Vk1}),o($Vu,[2,246]),o($Vr1,[2,248]),o($V7,[2,19]),{34:[1,354]},{34:[1,355]},o([37,38,191,278],[2,144],{249:356,250:[1,357]}),{13:$Va,16:$Vb,34:[1,359],60:360,232:358,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,193:361,195:$VR1,312:$Vd},o($VT1,[2,418]),o($VT1,[2,419]),o($Vs1,[2,146],{253:362,254:[1,363]}),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,255:364,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{258:[1,365]},o($VV1,[2,436]),o($VV1,[2,437]),o($VV1,[2,438]),o($VV1,[2,439]),o($VV1,[2,440]),o($VV1,[2,441]),{258:[2,443]},o([37,38,191,250,254,258,278,295,334,335,336,337,338,339],[2,151],{261:366,262:367,263:368,265:369,271:[1,370],273:[1,371],306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$}),o($Vu1,[2,155],{269:372,270:373,26:$VW1,331:$VX1}),o($Vv1,[2,157]),o($Vv1,[2,158]),o($Vv1,[2,159]),o($Vy1,[2,88]),o($VV1,[2,353],{175:376,316:[1,377]}),{38:[1,378]},o($Vy1,[2,169]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:379,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:380,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:381,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,173]),o($Vy1,[2,90]),o($VV1,[2,357],{178:382}),{34:[1,383]},o($Vy1,[2,175]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:384,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{46:$Vh1,62:385},o($VB1,[2,183]),{13:$Va,16:$Vb,60:386,312:$Vd},o($VY1,[2,463],{286:387,316:[1,388]}),o($VV1,[2,467],{289:389,316:[1,390]}),o($VV1,[2,469],{291:391,316:[1,392]}),{13:$Va,16:$Vb,48:[1,393],60:395,87:$VA,97:394,98:396,99:397,100:$VZ1,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{48:[1,400],93:[1,401]},{46:[1,402]},o($VG1,[2,274]),o($VH1,[2,112]),o($VH1,[2,397]),o($VH1,[2,393]),o($VH1,[2,394]),o($VH1,[2,395]),o($VI1,[2,116]),o($VI1,[2,118]),o($VI1,[2,119]),o($V$1,[2,400],{222:403}),o($VI1,[2,121]),o($VI1,[2,122]),{13:$Va,16:$Vb,60:404,195:[1,405],312:$Vd},{38:[1,406]},o($Va1,[2,50]),o($Va1,[2,286]),{119:[1,407]},o($Va1,[2,66]),o($Vi,$V71,{142:198,115:408,119:$V81,141:$V91}),o($VL1,[2,65]),o($Va1,[2,53]),{48:[1,409],119:[1,411],146:410},o($VM1,[2,331],{154:412,328:[1,413]}),{45:[1,414],134:415,135:$V02},{45:[1,417],134:418,135:$V02},o($V12,[2,261],{66:419,85:420,86:[1,421],88:[1,422]}),o($VN1,[2,260]),{69:[1,423]},o($Ve1,[2,30],{274:141,280:146,283:149,82:318,72:319,73:320,60:321,84:424,13:$Va,16:$Vb,35:$Vz,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($V22,[2,265]),o($V32,[2,85]),o($V32,[2,86]),o($V32,[2,87]),{35:$Vw1,93:$Vx1},{48:[1,425]},{48:[1,426]},{20:427,45:$Vq,46:$Vr,61:106},{20:428,45:$Vq,46:$Vr,61:106},o($V42,[2,335],{157:429}),o($V42,[2,334]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:434,60:235,87:$VA,93:$Vn1,98:236,164:430,201:431,203:432,226:$V62,231:$VC,243:433,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vu,[2,20]),o($V12,[2,22]),{13:$Va,16:$Vb,34:$V72,35:$V82,60:321,70:437,71:438,72:439,73:440,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($V7,[2,16]),{48:[1,443]},{48:[2,238]},{48:[2,93]},o($Vt,[2,362],{48:[2,364]}),o($VS1,[2,94]),o($V92,[2,369],{189:444}),o($Vt,[2,373],{194:445,196:446}),o($Vt,[2,100]),o($Vt,[2,101]),o($Vt,[2,102]),o($VS1,[2,95]),o($VS1,[2,96]),o($VS1,[2,368]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,38:[1,447],39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:448,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Va2,[2,404]),o($Vb2,[2,129]),o($Vb2,[2,130]),o($Vb2,[2,408]),o($Vb2,[2,409]),{227:[1,449]},o($V7,[2,18]),{38:[1,450]},{38:[1,451]},o($Vs1,[2,433]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:452,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{46:[1,453]},{46:[2,412]},{46:[2,413]},{13:$Va,16:$Vb,34:$Vl1,39:455,60:235,87:$VA,93:$Vn1,98:236,231:$VC,237:454,243:456,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt1,[2,435]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,251:457,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vt1,[2,149]),{35:$Vz1,93:$VA1,177:458},o($Vu1,[2,445]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,259:459,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vv1,[2,448],{264:460}),o($Vv1,[2,450],{266:461}),o($VV1,[2,446]),o($VV1,[2,447]),o($Vv1,[2,453]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,263:154,265:155,267:462,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,454]),o($VV1,[2,455]),o($VV1,[2,355],{176:463}),o($VV1,[2,354]),o([6,13,16,26,34,35,37,38,46,48,78,81,83,86,87,88,90,93,119,167,168,170,173,174,191,226,231,245,246,250,254,258,271,273,275,276,277,278,279,281,282,284,285,288,290,295,299,300,301,302,303,304,305,306,307,308,309,310,311,312,328,331,334,335,336,337,338,339,340,341,342,343,344],[2,167]),{38:[1,464]},{278:[1,465]},{278:[1,466]},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:467,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{38:[1,468]},{38:[1,469]},o($Vy1,[2,177]),o($VB1,[2,184]),{13:$Va,16:$Vb,26:[1,471],34:$Vy,35:$Vz,36:472,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,287:470,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VY1,[2,464]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:473,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,468]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:474,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($VV1,[2,470]),o($V61,[2,41]),o($VE1,[2,270]),o($Vc2,[2,44]),o($Vc2,[2,45]),o($Vc2,[2,46]),o($Vc2,[2,47]),{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:477,119:[1,475],231:$V_1,241:476,244:478,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V61,[2,42]),o($VF1,[2,272]),o($Vd2,[2,275],{96:479}),{13:$Va,16:$Vb,38:[2,402],60:298,195:$VJ1,221:481,223:480,224:$VK1,312:$Vd},o($VI1,[2,123]),o($VI1,[2,124]),o($VI1,[2,117]),{13:$Va,16:$Vb,60:482,312:$Vd},o($Va1,[2,52]),o([6,45,132,133,135,191],[2,68]),o($VM1,[2,320]),{13:$Va,16:$Vb,34:[1,484],60:485,147:483,312:$Vd},o($VM1,[2,70]),o($Vt,[2,330],{48:$Ve2,119:$Ve2}),{46:$Vh1,62:486},o($Vd1,[2,303]),o($Vi,[2,310],{136:487,320:[1,488]}),{46:$Vh1,62:489},o($Vd1,[2,309]),o($V12,[2,23]),o($V12,[2,262]),{87:[1,490]},{87:[1,491]},{13:$Va,16:$Vb,34:$Vf2,35:$Vz,60:321,72:319,73:320,79:492,80:493,81:$Vg2,82:318,83:$Vh2,84:496,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($V22,[2,266]),o($Vi2,[2,71]),o($Vi2,[2,72]),o($Ve1,$Vf1,{64:211,74:212,21:498,75:$Vg1}),o($Vi1,$Vj1,{63:219,67:220,24:499,68:$Vk1}),{46:[2,345],48:[2,73],89:509,90:$V5,119:[1,505],158:500,159:501,166:502,167:[1,503],168:[1,504],170:[1,506],173:[1,507],174:[1,508]},o($V42,[2,343],{165:510,328:[1,511]}),o($V6,$V3,{211:10,202:512,205:513,210:514,34:$Vj2}),o($Vk2,[2,379],{211:10,205:513,210:514,204:516,202:517,13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,34:$Vj2}),o($Vl2,[2,377]),o($Vl2,[2,378]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:519,203:521,226:$V62,228:518,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V6,$V3,{211:10,205:513,210:514,202:524,34:$Vj2}),o($Vi1,[2,24],{274:141,280:146,283:149,60:321,72:439,73:440,71:525,13:$Va,16:$Vb,34:$V72,35:$V82,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($Vm2,[2,263]),o($Vm2,[2,25]),o($Vm2,[2,26]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:526,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vm2,[2,29]),o($Vi1,$Vj1,{63:219,67:220,24:527,68:$Vk1}),o([48,119,227,328],[2,97],{190:528,191:[1,529]}),o($V92,[2,99]),{13:$Va,16:$Vb,34:$Vl1,35:$Vm1,39:351,60:235,87:$VA,93:$Vn1,98:236,185:349,197:530,226:$Vo1,229:348,231:$VC,243:350,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vn2,[2,125]),o($Va2,[2,405]),o($Vn2,[2,126]),o($Vx,[2,14]),o($Vx,[2,15]),o($Vs1,[2,145]),{13:$Va,16:$Vb,34:$Vl1,39:532,60:235,87:$VA,93:$Vn1,98:236,231:$VC,233:531,243:533,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{235:[1,534]},{235:[2,420]},{235:[2,421]},o($Vt1,[2,147]),o($Vt1,[2,150]),o($Vu1,[2,152]),o($Vu1,[2,153],{270:373,269:535,26:$VW1,331:$VX1}),o($Vu1,[2,154],{270:373,269:536,26:$VW1,331:$VX1}),o($Vv1,[2,156]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:537,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,170]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:538,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:539,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{38:[1,540],278:[1,541]},o($Vy1,[2,174]),o($Vy1,[2,176]),{38:[1,542]},{38:[2,465]},{38:[2,466]},{38:[1,543]},{38:[2,471],191:[1,546],292:544,293:545},{13:$Va,16:$Vb,34:[1,548],60:549,238:547,312:$Vd},{13:$Va,16:$Vb,34:$VQ1,60:341,193:550,195:$VR1,312:$Vd},o($VT1,[2,428]),o($VT1,[2,429]),{35:[1,553],48:[1,551],101:552},{38:[1,554]},{38:[2,403],330:[1,555]},o($Va1,[2,63]),{46:[1,556]},{46:[2,321]},{46:[2,322]},o($Va1,[2,57]),{13:$Va,16:$Vb,60:557,312:$Vd},o($Vi,[2,311]),o($Va1,[2,58]),o($V12,[2,36],{88:[1,558]}),o($V12,[2,37],{86:[1,559]}),o($VN1,[2,31],{274:141,280:146,283:149,82:318,72:319,73:320,60:321,84:496,80:560,13:$Va,16:$Vb,34:$Vf2,35:$Vz,81:$Vg2,83:$Vh2,275:$VF,276:$VG,277:$VH,279:$VI,281:$VJ,282:$VK,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51}),o($Vo2,[2,267]),{35:$Vz,82:561},{35:$Vz,82:562},o($Vo2,[2,34]),o($Vo2,[2,35]),{31:563,48:[2,229],89:564,90:$V5},{32:565,48:[2,231],89:566,90:$V5},o($V42,[2,336]),o($Vp2,[2,337],{160:567,328:[1,568]}),{46:$Vh1,62:569},{46:$Vh1,62:570},{46:$Vh1,62:571},{13:$Va,16:$Vb,34:[1,573],60:574,169:572,312:$Vd},o($Vq2,[2,349],{171:575,321:[1,576]}),{13:$Va,16:$Vb,35:$Vz,60:321,72:319,73:320,82:318,84:577,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{35:[1,578]},o($Vr2,[2,84]),o($V42,[2,75]),o($Vt,[2,342],{46:$Vs2,48:$Vs2,90:$Vs2,119:$Vs2,167:$Vs2,168:$Vs2,170:$Vs2,173:$Vs2,174:$Vs2}),o($Vk2,[2,105]),o($Vt,[2,383],{206:579}),o($Vt,[2,381]),o($Vt,[2,382]),o($Vk2,[2,106]),o($Vk2,[2,380]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,38:[1,580],39:523,60:235,87:$VA,93:$Vn1,98:236,200:581,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Va2,[2,406]),o($Vt2,[2,131]),o($Vt2,[2,132]),o($Vt2,[2,410]),o($Vt2,[2,411]),{227:[1,582]},o($Vm2,[2,264]),{37:[1,584],38:[1,583]},o($V7,[2,17]),o($V92,[2,370]),o($V92,[2,371],{193:339,60:341,192:585,188:586,13:$Va,16:$Vb,34:$VQ1,195:$VR1,312:$Vd}),o($V92,[2,103],{278:[1,587]}),{13:$Va,16:$Vb,34:$VQ1,60:341,193:588,195:$VR1,312:$Vd},o($VT1,[2,414]),o($VT1,[2,415]),o($Vu2,[2,134]),o($Vv1,[2,449]),o($Vv1,[2,451]),{38:[1,589],278:[1,590]},{38:[1,591]},{278:[1,592]},o($Vy1,[2,91]),o($VV1,[2,358]),o($Vy1,[2,178]),o($Vy1,[2,179]),{38:[1,593]},{38:[2,472]},{294:[1,594]},{46:[1,595]},{46:[2,422]},{46:[2,423]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:597,231:$V_1,242:596,244:598,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($V61,[2,43]),o($Vd2,[2,276]),{13:$Va,16:$Vb,60:395,87:$VA,97:600,98:396,99:397,100:$VZ1,102:599,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($VI1,[2,120]),o($V$1,[2,401]),o($Vt,$Vb1,{152:203,148:601,151:602,48:[2,323]}),o($Vd1,[2,61]),{87:[1,603]},{87:[1,604]},o($Vo2,[2,268]),o($Vo2,[2,32]),o($Vo2,[2,33]),{48:[2,11]},{48:[2,230]},{48:[2,12]},{48:[2,232]},o($Vt,$VO1,{163:328,161:605,162:606,46:$Vv2,48:$Vv2,90:$Vv2,119:$Vv2,167:$Vv2,168:$Vv2,170:$Vv2,173:$Vv2,174:$Vv2}),o($Vp2,[2,338]),o($Vr2,[2,76],{329:[1,607]}),o($Vr2,[2,77]),o($Vr2,[2,78]),{46:$Vh1,62:608},{46:[2,347]},{46:[2,348]},{13:$Va,16:$Vb,34:[1,610],60:611,172:609,312:$Vd},o($Vq2,[2,350]),o($Vr2,[2,81]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:612,39:613,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,231:$VC,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:614,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vw2,[2,127]),o($Va2,[2,407]),o($Vw2,[2,128]),o($Vm2,[2,27]),{34:[1,615]},o($V92,[2,98]),o($V92,[2,372]),o($Vt,[2,374]),{13:$Va,16:$Vb,34:$Vl1,39:617,60:235,87:$VA,93:$Vn1,98:236,231:$VC,234:616,243:618,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vy1,[2,89]),o($VV1,[2,356]),o($Vy1,[2,171]),{13:$Va,16:$Vb,34:$Vy,35:$Vz,36:619,60:136,72:135,73:137,82:134,87:$VA,98:138,219:$VB,247:124,251:126,255:127,259:128,263:154,265:155,267:129,271:$VD,272:133,273:$VE,274:141,275:$VF,276:$VG,277:$VH,279:$VI,280:146,281:$VJ,282:$VK,283:149,284:$VL,285:$VM,288:$VN,290:$VO,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd,339:$V01,340:$V11,341:$V21,342:$V31,343:$V41,344:$V51},o($Vy1,[2,180]),{295:[1,620]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:622,231:$V_1,239:621,244:623,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},{235:[1,624]},{235:[2,430]},{235:[2,431]},{13:$Va,16:$Vb,38:[1,625],60:395,87:$VA,97:626,98:396,99:397,100:$VZ1,231:$V_1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vx2,[2,277]),{48:[1,627]},{48:[2,324]},o($V12,[2,38]),o($V12,[2,39]),o($V42,[2,74]),o($V42,[2,340]),{46:[2,346]},o($Vr2,[2,79]),{46:$Vh1,62:628},{46:[2,351]},{46:[2,352]},{37:[1,629]},{37:[1,630]},o($Vy2,[2,385],{207:631,278:[1,632]}),{38:[1,633]},{48:[1,634]},{48:[2,416]},{48:[2,417]},{38:[1,635]},{296:636,302:$VS,303:$VT,304:$VU,305:$VV},{13:$Va,16:$Vb,34:$VQ1,60:341,193:637,195:$VR1,312:$Vd},o($VT1,[2,424]),o($VT1,[2,425]),o($Vz2,[2,136]),o($Vd2,[2,48]),o($Vx2,[2,278]),o($VA2,[2,325],{149:638,328:[1,639]}),o($Vr2,[2,80]),{34:[1,640]},{34:[1,641]},o([46,48,90,119,167,168,170,173,174,227,328],[2,107],{208:642,191:[1,643]}),o($Vt,[2,384]),o($Vm2,[2,28]),{235:[1,644]},o($Vy1,[2,172]),{38:[2,181]},{13:$Va,16:$Vb,60:235,87:$VA,93:$Vn1,98:236,99:646,231:$V_1,240:645,244:647,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vt,$Vb1,{152:203,150:648,151:649,48:$VB2,119:$VB2}),o($VA2,[2,326]),{38:[1,650]},{38:[1,651]},o($Vy2,[2,386]),o($Vy2,[2,108],{211:10,209:652,210:653,13:$V3,16:$V3,35:$V3,195:$V3,219:$V3,224:$V3,312:$V3,34:[1,654]}),o($Vu2,[2,133]),{48:[1,655]},{48:[2,426]},{48:[2,427]},o($VM1,[2,69]),o($VM1,[2,328]),o($Vr2,[2,82]),o($Vr2,[2,83]),o($Vt,[2,375],{198:656,199:657}),o($Vt,[2,387]),o($Vt,[2,388]),{235:[1,658]},o($Vy2,[2,109]),{13:$Va,16:$Vb,34:$Vl1,35:$V52,39:523,60:235,87:$VA,93:$Vn1,98:236,200:659,203:521,226:$V62,230:520,231:$VC,243:522,244:234,245:$Vp1,246:$Vq1,263:154,265:155,296:150,299:$VP,300:$VQ,301:$VR,302:$VS,303:$VT,304:$VU,305:$VV,306:$VW,307:$VX,308:$VY,309:$VZ,310:$V_,311:$V$,312:$Vd},o($Vz2,[2,135]),o($Vy2,[2,104],{278:[1,660]}),o($Vt,[2,376])], +defaultActions: {5:[2,206],6:[2,207],7:[2,208],9:[2,205],28:[2,1],29:[2,3],30:[2,218],85:[2,49],94:[2,297],108:[2,254],115:[2,360],165:[2,462],260:[2,443],334:[2,238],335:[2,93],359:[2,412],360:[2,413],455:[2,420],456:[2,421],471:[2,465],472:[2,466],484:[2,321],485:[2,322],545:[2,472],548:[2,422],549:[2,423],563:[2,11],564:[2,230],565:[2,12],566:[2,232],573:[2,347],574:[2,348],597:[2,430],598:[2,431],602:[2,324],607:[2,346],610:[2,351],611:[2,352],617:[2,416],618:[2,417],636:[2,181],646:[2,426],647:[2,427]}, +parseError: function parseError (str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } +}, +parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + _token_stack: + var lex = function () { + var token; + token = lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + }; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; } break; - // All other groups break up a BGP - default: - // Only add the group if its pattern is non-empty - if (!group.patterns || group.patterns.length > 0) { - appendTo(merged, group); - currentBgp = null; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; } - } - return merged; } - - // Return the id of an expression - function getExpressionId(expression) { - return expression.variable ? expression.variable.value : expression.value || expression.expression.value; + return true; +}}; + + /* + SPARQL parser in the Jison parser generator format. + */ + + var Wildcard = (__webpack_require__(87735)/* .Wildcard */ .R); + + // Common namespaces and entities + var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', + RDF_TYPE = RDF + 'type', + RDF_FIRST = RDF + 'first', + RDF_REST = RDF + 'rest', + RDF_NIL = RDF + 'nil', + XSD = 'http://www.w3.org/2001/XMLSchema#', + XSD_INTEGER = XSD + 'integer', + XSD_DECIMAL = XSD + 'decimal', + XSD_DOUBLE = XSD + 'double', + XSD_BOOLEAN = XSD + 'boolean'; + + var base = '', basePath = '', baseRoot = ''; + + // Returns a lowercase version of the given string + function lowercase(string) { + return string.toLowerCase(); + } + + // Appends the item to the array and returns the array + function appendTo(array, item) { + return array.push(item), array; + } + + // Appends the items to the array and returns the array + function appendAllTo(array, items) { + return array.push.apply(array, items), array; + } + + // Extends a base object with properties of other objects + function extend(base) { + if (!base) base = {}; + for (var i = 1, l = arguments.length, arg; i < l && (arg = arguments[i] || {}); i++) + for (var name in arg) + base[name] = arg[name]; + return base; + } + + // Creates an array that contains all items of the given arrays + function unionAll() { + var union = []; + for (var i = 0, l = arguments.length; i < l; i++) + union = union.concat.apply(union, arguments[i]); + return union; + } + + // Resolves an IRI against a base path + function resolveIRI(iri) { + // Strip off possible angular brackets + if (iri[0] === '<') + iri = iri.substring(1, iri.length - 1); + // Return absolute IRIs unmodified + if (/^[a-z]+:/i.test(iri)) + return iri; + if (!Parser.base) + throw new Error('Cannot resolve relative IRI ' + iri + ' because no base IRI was set.'); + if (base !== Parser.base) { + base = Parser.base; + basePath = base.replace(/[^\/:]*$/, ''); + baseRoot = base.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]; + } + switch (iri[0]) { + // An empty relative IRI indicates the base IRI + case undefined: + return base; + // Resolve relative fragment IRIs against the base IRI + case '#': + return base + iri; + // Resolve relative query string IRIs by replacing the query string + case '?': + return base.replace(/(?:\?.*)?$/, iri); + // Resolve root relative IRIs at the root of the base IRI + case '/': + return baseRoot + iri; + // Resolve all other IRIs at the base IRI's path + default: + return basePath + iri; } - - // Get all "aggregate"'s from an expression - function getAggregatesOfExpression(expression) { - if (!expression) { - return []; - } - if (expression.type === 'aggregate') { - return [expression]; - } else if (expression.type === "operation") { - const aggregates = []; - for (const arg of expression.args) { - aggregates.push(...getAggregatesOfExpression(arg)); - } - return aggregates; - } - return []; + } + + // If the item is a variable, ensures it starts with a question mark + function toVar(variable) { + if (variable) { + var first = variable[0]; + if (first === '?' || first === '$') return Parser.factory.variable(variable.substr(1)); } - - // Get all variables used in an expression - function getVariablesFromExpression(expression) { - const variables = new Set(); - const visitExpression = function (expr) { - if (!expr) { return; } - if (expr.termType === "Variable") { - variables.add(expr); - } else if (expr.type === "operation") { - expr.args.forEach(visitExpression); - } - }; - visitExpression(expression); - return variables; - } - - // Helper function to flatten arrays - function flatten(input, depth = 1, stack = []) { - for (const item of input) { - if (depth > 0 && item instanceof Array) { - flatten(item, depth - 1, stack); - } else { - stack.push(item); - } - } - return stack; + return variable; + } + + // Creates an operation with the given name and arguments + function operation(operatorName, args) { + return { type: 'operation', operator: operatorName, args: args || [] }; + } + + // Creates an expression with the given type and attributes + function expression(expr, attr) { + var expression = { expression: expr === '*'? new Wildcard() : expr }; + if (attr) + for (var a in attr) + expression[a] = attr[a]; + return expression; + } + + // Creates a path with the given type and items + function path(type, items) { + return { type: 'path', pathType: type, items: items }; + } + + // Transforms a list of operations types and arguments into a tree of operations + function createOperationTree(initialExpression, operationList) { + for (var i = 0, l = operationList.length, item; i < l && (item = operationList[i]); i++) + initialExpression = operation(item[0], [initialExpression, item[1]]); + return initialExpression; + } + + // Group datasets by default and named + function groupDatasets(fromClauses, groupName) { + var defaults = [], named = [], l = fromClauses.length, fromClause, group = {}; + if (!l) + return null; + for (var i = 0; i < l && (fromClause = fromClauses[i]); i++) + (fromClause.named ? named : defaults).push(fromClause.iri); + group[groupName || 'from'] = { default: defaults, named: named }; + return group; + } + + // Converts the string to a number + function toInt(string) { + return parseInt(string, 10); + } + + // Transforms a possibly single group into its patterns + function degroupSingle(group) { + return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group; + } + + // Creates a literal with the given value and type + function createTypedLiteral(value, type) { + if (type && type.termType !== 'NamedNode'){ + type = Parser.factory.namedNode(type); } - - function isVariable(term) { - return term.termType === 'Variable'; + return Parser.factory.literal(value, type); + } + + // Creates a literal with the given value and language + function createLangLiteral(value, lang) { + return Parser.factory.literal(value, lang); + } + + // Creates a triple with the given subject, predicate, and object + function triple(subject, predicate, object) { + var triple = {}; + if (subject != null) triple.subject = subject; + if (predicate != null) triple.predicate = predicate; + if (object != null) triple.object = object; + return triple; + } + + // Creates a new blank node + function blank(name) { + if (typeof name === 'string') { // Only use name if a name is given + if (name.startsWith('e_')) return Parser.factory.blankNode(name); + return Parser.factory.blankNode('e_' + name); } - - function getBoundVarsFromGroupGraphPattern(pattern) { - if (pattern.triples) { - const boundVars = []; - for (const triple of pattern.triples) { - if (isVariable(triple.subject)) boundVars.push(triple.subject.value); - if (isVariable(triple.predicate)) boundVars.push(triple.predicate.value); - if (isVariable(triple.object)) boundVars.push(triple.object.value); - } - return boundVars; - } else if (pattern.patterns) { - const boundVars = []; - for (const pat of pattern.patterns) { - boundVars.push(...getBoundVarsFromGroupGraphPattern(pat)); + return Parser.factory.blankNode('g_' + blankId++); + }; + var blankId = 0; + Parser._resetBlanks = function () { blankId = 0; } + + // Regular expression and replacement strings to escape strings + var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g, + escapeReplacements = { '\\': '\\', "'": "'", '"': '"', + 't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' }, + partialSurrogatesWithoutEndpoint = /[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/, + fromCharCode = String.fromCharCode; + + // Translates escape codes in the string into their textual equivalent + function unescapeString(string, trimLength) { + string = string.substring(trimLength, string.length - trimLength); + try { + string = string.replace(escapeSequence, function (sequence, unicode4, unicode8, escapedChar) { + var charCode; + if (unicode4) { + charCode = parseInt(unicode4, 16); + if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance + return fromCharCode(charCode); + } + else if (unicode8) { + charCode = parseInt(unicode8, 16); + if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance + if (charCode < 0xFFFF) return fromCharCode(charCode); + return fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF)); } - return boundVars; - } - return []; - } - - // Helper function to find duplicates in array - function getDuplicatesInArray(array) { - const sortedArray = array.slice().sort(); - const duplicates = []; - for (let i = 0; i < sortedArray.length - 1; i++) { - if (sortedArray[i + 1] == sortedArray[i]) { - duplicates.push(sortedArray[i]); + else { + var replacement = escapeReplacements[escapedChar]; + if (!replacement) throw new Error(); + return replacement; } - } - return duplicates; + }); } - - function ensureSparqlStar(value) { - if (!Parser.sparqlStar) { - throw new Error('SPARQL* support is not enabled'); - } - return value; + catch (error) { return ''; } + + // Test for invalid unicode surrogate pairs + if (partialSurrogatesWithoutEndpoint.exec(string)) { + throw new Error('Invalid unicode codepoint of surrogate pair without corresponding codepoint in ' + string); } - - function ensureNoVariables(operations) { - for (const operation of operations) { - if (operation.type === 'graph' && operation.name.termType === 'Variable') { - throw new Error('Detected illegal variable in GRAPH'); - } - if (operation.type === 'bgp' || operation.type === 'graph') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'Variable' || - triple.predicate.termType === 'Variable' || - triple.object.termType === 'Variable') { - throw new Error('Detected illegal variable in BGP'); - } + + return string; + } + + // Creates a list, collecting its (possibly blank) items and triples associated with those items + function createList(objects) { + var list = blank(), head = list, listItems = [], listTriples, triples = []; + objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); }); + + // Build an RDF list out of the items + for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]), + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)); + + // Return the list's identifier, its triples, and the triples associated with its items + return { entity: list, triples: appendAllTo(listTriples, triples) }; + } + + // Creates a blank node identifier, collecting triples with that blank node as subject + function createAnonymousObject(propertyList) { + var entity = blank(); + return { + entity: entity, + triples: propertyList.map(function (t) { return extend(triple(entity), t); }) + }; + } + + // Collects all (possibly blank) objects, and triples that have them as subject + function objectListToTriples(predicate, objectList, otherTriples) { + var objects = [], triples = []; + objectList.forEach(function (l) { + objects.push(triple(null, predicate, l.entity)); + appendAllTo(triples, l.triples); + }); + return unionAll(objects, otherTriples || [], triples); + } + + // Simplifies groups by merging adjacent BGPs + function mergeAdjacentBGPs(groups) { + var merged = [], currentBgp; + for (var i = 0, group; group = groups[i]; i++) { + switch (group.type) { + // Add a BGP's triples to the current BGP + case 'bgp': + if (group.triples.length) { + if (!currentBgp) + appendTo(merged, currentBgp = group); + else + appendAllTo(currentBgp.triples, group.triples); } - } - } - return operations; - } - - function ensureNoBnodes(operations) { - for (const operation of operations) { - if (operation.type === 'bgp') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'BlankNode' || - triple.predicate.termType === 'BlankNode' || - triple.object.termType === 'BlankNode') { - throw new Error('Detected illegal blank node in BGP'); - } + break; + // All other groups break up a BGP + default: + // Only add the group if its pattern is non-empty + if (!group.patterns || group.patterns.length > 0) { + appendTo(merged, group); + currentBgp = null; } - } } - return operations; } - /* generated by jison-lex 0.3.4 */ - var lexer = (function(){ - var lexer = ({ - - EOF:1, - - parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - - // resets the lexer, sets new input - setInput:function (input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0,0]; - } - this.offset = 0; - return this; - }, - - // consumes and returns one char from the input - input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - - // unshifts one char (or a string) into the input - unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, - - // When called from action, caches matched text and appends it on next action - more:function () { - this._more = true; - return this; - }, - - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - - } - return this; - }, - - // retain first n characters of the match - less:function (n) { - this.unput(this.match.slice(n)); - }, - - // displays already matched input, i.e. for error messages - pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, - - // displays upcoming input, i.e. for error messages - upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - - // displays the character position where the lexing error occurred, i.e. for error messages - showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - - // test the lexed token: return FALSE when not a match, otherwise return token - test_match:function(match, indexed_rule) { - var token, - lines, - backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } - return false; - }, - - // return next match in input - next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, - - // return next match that has a token - lex:function lex () { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); - } - }, - - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - begin:function begin (condition) { - this.conditionStack.push(condition); - }, - - // pop the previously active lexer condition state off the condition stack - popState:function popState () { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - - // produce the lexer rule set which is active for the currently active lexer condition state - _currentRules:function _currentRules () { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState:function topState (n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - - // alias for begin(condition) - pushState:function pushState (condition) { - this.begin(condition); - }, - - // return the number of states currently on the stack - stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, - options: {"flex":true,"case-insensitive":true}, - performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - var YYSTATE=YY_START; - switch($avoiding_name_collisions) { - case 0:/* ignore */ - break; - case 1:return 12 - break; - case 2:return 15 - break; - case 3:return 28 - break; - case 4:return 316 - break; - case 5:return 317 - break; - case 6:return 35 - break; - case 7:return 37 - break; - case 8:return 38 - break; - case 9:return 26 - break; - case 10:return 41 - break; - case 11:return 45 - break; - case 12:return 46 - break; - case 13:return 48 - break; - case 14:return 50 - break; - case 15:return 55 - break; - case 16:return 58 - break; - case 17:return 320 - break; - case 18:return 68 - break; - case 19:return 69 - break; - case 20:return 75 - break; - case 21:return 78 - break; - case 22:return 81 - break; - case 23:return 83 - break; - case 24:return 86 - break; - case 25:return 88 - break; - case 26:return 90 - break; - case 27:return 191 - break; - case 28:return 107 - break; - case 29:return 321 - break; - case 30:return 140 - break; - case 31:return 322 - break; - case 32:return 323 - break; - case 33:return 117 - break; - case 34:return 324 - break; - case 35:return 116 - break; - case 36:return 325 - break; - case 37:return 326 - break; - case 38:return 120 - break; - case 39:return 122 - break; - case 40:return 123 - break; - case 41:return 138 - break; - case 42:return 132 - break; - case 43:return 133 - break; - case 44:return 135 - break; - case 45:return 141 - break; - case 46:return 119 - break; - case 47:return 327 - break; - case 48:return 328 - break; - case 49:return 167 - break; - case 50:return 170 - break; - case 51:return 174 - break; - case 52:return 100 - break; - case 53:return 168 - break; - case 54:return 329 - break; - case 55:return 173 - break; - case 56:return 231 - break; - case 57:return 235 - break; - case 58:return 278 - break; - case 59:return 195 - break; - case 60:return 330 - break; - case 61:return 331 - break; - case 62:return 224 - break; - case 63:return 333 - break; - case 64:return 271 - break; - case 65:return 219 - break; - case 66:return 226 - break; - case 67:return 227 - break; - case 68:return 250 - break; - case 69:return 254 - break; - case 70:return 295 - break; - case 71:return 334 - break; - case 72:return 335 - break; - case 73:return 336 - break; - case 74:return 337 - break; - case 75:return 338 - break; - case 76:return 258 - break; - case 77:return 339 - break; - case 78:return 273 - break; - case 79:return 281 - break; - case 80:return 282 - break; - case 81:return 275 - break; - case 82:return 276 - break; - case 83:return 277 - break; - case 84:return 340 - break; - case 85:return 341 - break; - case 86:return 279 - break; - case 87:return 343 - break; - case 88:return 342 - break; - case 89:return 344 - break; - case 90:return 284 - break; - case 91:return 285 - break; - case 92:return 288 - break; - case 93:return 290 - break; - case 94:return 294 - break; - case 95:return 298 - break; - case 96:return 301 - break; - case 97:return 13 - break; - case 98:return 16 - break; - case 99:return 312 - break; - case 100:return 245 - break; - case 101:return 34 - break; - case 102:return 297 - break; - case 103:return 87 - break; - case 104:return 299 - break; - case 105:return 300 - break; - case 106:return 306 - break; - case 107:return 307 - break; - case 108:return 308 - break; - case 109:return 309 - break; - case 110:return 310 - break; - case 111:return 311 - break; - case 112:return 'EXPONENT' - break; - case 113:return 302 - break; - case 114:return 303 - break; - case 115:return 304 - break; - case 116:return 305 - break; - case 117:return 93 - break; - case 118:return 246 - break; - case 119:return 6 - break; - case 120:return 'INVALID' - break; - case 121:console.log(yy_.yytext); - break; + return merged; } - }, - rules: [/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i], - conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,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,91,92,93,94,95,96,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],"inclusive":true}} - }); - return lexer; - })(); - parser.lexer = lexer; - function Parser () { - this.yy = {}; - } - Parser.prototype = parser;parser.Parser = Parser; - return new Parser; - })();module.exports=SparqlParser - - - /***/ }), - - /***/ 87735: - /***/ ((module) => { - - - // Wildcard constructor - class Wildcard { - constructor() { - return WILDCARD || this; + + // Return the id of an expression + function getExpressionId(expression) { + return expression.variable ? expression.variable.value : expression.value || expression.expression.value; + } + + // Get all "aggregate"'s from an expression + function getAggregatesOfExpression(expression) { + if (!expression) { + return []; } - - equals(other) { - return other && (this.termType === other.termType); + if (expression.type === 'aggregate') { + return [expression]; + } else if (expression.type === "operation") { + const aggregates = []; + for (const arg of expression.args) { + aggregates.push(...getAggregatesOfExpression(arg)); + } + return aggregates; } + return []; } - - Object.defineProperty(Wildcard.prototype, 'value', { - enumerable: true, - value: '*', - }); - - Object.defineProperty(Wildcard.prototype, 'termType', { - enumerable: true, - value: 'Wildcard', - }); - - - // Wildcard singleton - var WILDCARD = new Wildcard(); - - module.exports.R = Wildcard; - - - /***/ }), - - /***/ 99623: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - var Parser = (__webpack_require__(89516).Parser); - var Generator = __webpack_require__(10113); - var Wildcard = (__webpack_require__(87735)/* .Wildcard */ .R); - var { DataFactory } = __webpack_require__(18628); - - module.exports = { - /** - * Creates a SPARQL parser with the given pre-defined prefixes and base IRI - * @param options { - * prefixes?: { [prefix: string]: string }, - * baseIRI?: string, - * factory?: import('rdf-js').DataFactory, - * sparqlStar?: boolean, - * skipValidation?: boolean, - * skipUngroupedVariableCheck?: boolean - * } - */ - Parser: function ({ prefixes, baseIRI, factory, sparqlStar, skipValidation, skipUngroupedVariableCheck, pathOnly } = {}) { - - // Create a copy of the prefixes - var prefixesCopy = {}; - for (var prefix in prefixes || {}) - prefixesCopy[prefix] = prefixes[prefix]; - - // Create a new parser with the given prefixes - // (Workaround for https://github.com/zaach/jison/issues/241) - var parser = new Parser(); - parser.parse = function () { - Parser.base = baseIRI || ''; - Parser.prefixes = Object.create(prefixesCopy); - Parser.factory = factory || new DataFactory(); - Parser.sparqlStar = Boolean(sparqlStar); - Parser.pathOnly = Boolean(pathOnly); - // We keep skipUngroupedVariableCheck for compatibility reasons. - Parser.skipValidation = Boolean(skipValidation) || Boolean(skipUngroupedVariableCheck) - return Parser.prototype.parse.apply(parser, arguments); - }; - parser._resetBlanks = Parser._resetBlanks; - return parser; - }, - Generator: Generator, - Wildcard: Wildcard, - }; - - - /***/ }), - - /***/ 29975: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { AbortError, codes } = __webpack_require__(4213) - const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(46342) - const eos = __webpack_require__(24597) - const { ERR_INVALID_ARG_TYPE } = codes - - // This method is inlined here for readable-stream - // It also does not allow for signal to not exist on the stream - // https://github.com/nodejs/node/pull/36061#discussion_r533718029 - const validateAbortSignal = (signal, name) => { - if (typeof signal !== 'object' || !('aborted' in signal)) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } - } - module.exports.addAbortSignal = function addAbortSignal(signal, stream) { - validateAbortSignal(signal, 'signal') - if (!isNodeStream(stream) && !isWebStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - return module.exports.addAbortSignalNoValidate(signal, stream) - } - module.exports.addAbortSignalNoValidate = function (signal, stream) { - if (typeof signal !== 'object' || !('aborted' in signal)) { - return stream - } - const onAbort = isNodeStream(stream) - ? () => { - stream.destroy( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - : () => { - stream[kControllerErrorFunction]( - new AbortError(undefined, { - cause: signal.reason - }) - ) + + // Get all variables used in an expression + function getVariablesFromExpression(expression) { + const variables = new Set(); + const visitExpression = function (expr) { + if (!expr) { return; } + if (expr.termType === "Variable") { + variables.add(expr); + } else if (expr.type === "operation") { + expr.args.forEach(visitExpression); + } + }; + visitExpression(expression); + return variables; + } + + // Helper function to flatten arrays + function flatten(input, depth = 1, stack = []) { + for (const item of input) { + if (depth > 0 && item instanceof Array) { + flatten(item, depth - 1, stack); + } else { + stack.push(item); } - if (signal.aborted) { - onAbort() - } else { - signal.addEventListener('abort', onAbort) - eos(stream, () => signal.removeEventListener('abort', onAbort)) } - return stream + return stack; } - - - /***/ }), - - /***/ 51085: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(26701) - const { Buffer } = __webpack_require__(2486) - const { inspect } = __webpack_require__(72978) - module.exports = class BufferList { - constructor() { - this.head = null - this.tail = null - this.length = 0 + + function isVariable(term) { + return term.termType === 'Variable'; + } + + function getBoundVarsFromGroupGraphPattern(pattern) { + if (pattern.triples) { + const boundVars = []; + for (const triple of pattern.triples) { + if (isVariable(triple.subject)) boundVars.push(triple.subject.value); + if (isVariable(triple.predicate)) boundVars.push(triple.predicate.value); + if (isVariable(triple.object)) boundVars.push(triple.object.value); + } + return boundVars; + } else if (pattern.patterns) { + const boundVars = []; + for (const pat of pattern.patterns) { + boundVars.push(...getBoundVarsFromGroupGraphPattern(pat)); + } + return boundVars; } - push(v) { - const entry = { - data: v, - next: null + return []; + } + + // Helper function to find duplicates in array + function getDuplicatesInArray(array) { + const sortedArray = array.slice().sort(); + const duplicates = []; + for (let i = 0; i < sortedArray.length - 1; i++) { + if (sortedArray[i + 1] == sortedArray[i]) { + duplicates.push(sortedArray[i]); } - if (this.length > 0) this.tail.next = entry - else this.head = entry - this.tail = entry - ++this.length } - unshift(v) { - const entry = { - data: v, - next: this.head - } - if (this.length === 0) this.tail = entry - this.head = entry - ++this.length - } - shift() { - if (this.length === 0) return - const ret = this.head.data - if (this.length === 1) this.head = this.tail = null - else this.head = this.head.next - --this.length - return ret - } - clear() { - this.head = this.tail = null - this.length = 0 - } - join(s) { - if (this.length === 0) return '' - let p = this.head - let ret = '' + p.data - while ((p = p.next) !== null) ret += s + p.data - return ret - } - concat(n) { - if (this.length === 0) return Buffer.alloc(0) - const ret = Buffer.allocUnsafe(n >>> 0) - let p = this.head - let i = 0 - while (p) { - TypedArrayPrototypeSet(ret, p.data, i) - i += p.data.length - p = p.next - } - return ret + return duplicates; + } + + function ensureSparqlStar(value) { + if (!Parser.sparqlStar) { + throw new Error('SPARQL* support is not enabled'); } - - // Consumes a specified amount of bytes or characters from the buffered data. - consume(n, hasStrings) { - const data = this.head.data - if (n < data.length) { - // `slice` is the same for buffers and strings. - const slice = data.slice(0, n) - this.head.data = data.slice(n) - return slice + return value; + } + + function ensureNoVariables(operations) { + for (const operation of operations) { + if (operation.type === 'graph' && operation.name.termType === 'Variable') { + throw new Error('Detected illegal variable in GRAPH'); } - if (n === data.length) { - // First chunk is a perfect match. - return this.shift() + if (operation.type === 'bgp' || operation.type === 'graph') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'Variable' || + triple.predicate.termType === 'Variable' || + triple.object.termType === 'Variable') { + throw new Error('Detected illegal variable in BGP'); + } + } } - // Result spans more than one buffer. - return hasStrings ? this._getString(n) : this._getBuffer(n) } - first() { - return this.head.data - } - *[SymbolIterator]() { - for (let p = this.head; p; p = p.next) { - yield p.data + return operations; + } + + function ensureNoBnodes(operations) { + for (const operation of operations) { + if (operation.type === 'bgp') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'BlankNode' || + triple.predicate.termType === 'BlankNode' || + triple.object.termType === 'BlankNode') { + throw new Error('Detected illegal blank node in BGP'); + } + } } } - - // Consumes a specified amount of characters from the buffered data. - _getString(n) { - let ret = '' - let p = this.head - let c = 0 - do { - const str = p.data - if (n > str.length) { - ret += str - n -= str.length + return operations; + } +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ +var lexer = ({ + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); } else { - if (n === str.length) { - ret += str - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - ret += StringPrototypeSlice(str, 0, n) - this.head = p - p.data = StringPrototypeSlice(str, n) - } - break + throw new Error(str); } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Consumes a specified amount of bytes from the buffered data. - _getBuffer(n) { - const ret = Buffer.allocUnsafe(n) - const retLen = n - let p = this.head - let c = 0 - do { - const buf = p.data - if (n > buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - n -= buf.length + }, + +// resets the lexer, sets new input +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; } else { - if (n === buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) - this.head = p - p.data = buf.slice(n) - } - break + this.yylloc.last_column++; } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Make sure the linked list only shows the minimal necessary information. - [Symbol.for('nodejs.util.inspect.custom')](_, options) { - return inspect(this, { - ...options, - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - }) - } - } - - - /***/ }), - - /***/ 65729: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { pipeline } = __webpack_require__(33939) - const Duplex = __webpack_require__(35960) - const { destroyer } = __webpack_require__(92573) - const { - isNodeStream, - isReadable, - isWritable, - isWebStream, - isTransformStream, - isWritableStream, - isReadableStream - } = __webpack_require__(46342) - const { - AbortError, - codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } - } = __webpack_require__(4213) - const eos = __webpack_require__(24597) - module.exports = function compose(...streams) { - if (streams.length === 0) { - throw new ERR_MISSING_ARGS('streams') - } - if (streams.length === 1) { - return Duplex.from(streams[0]) - } - const orgStreams = [...streams] - if (typeof streams[0] === 'function') { - streams[0] = Duplex.from(streams[0]) - } - if (typeof streams[streams.length - 1] === 'function') { - const idx = streams.length - 1 - streams[idx] = Duplex.from(streams[idx]) - } - for (let n = 0; n < streams.length; ++n) { - if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { - // TODO(ronag): Add checks for non streams. - continue - } - if ( - n < streams.length - 1 && - !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) - ) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') - } - if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') - } - } - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } else if (!readable && !writable) { - d.destroy() - } - } - const head = streams[0] - const tail = pipeline(streams, onfinished) - const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) - const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplex({ - // TODO (ronag): highWaterMark? - writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), - readableObjectMode: !!(tail !== null && tail !== undefined && tail.writableObjectMode), - writable, - readable - }) - if (writable) { - if (isNodeStream(head)) { - d._write = function (chunk, encoding, callback) { - if (head.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } + if (this.options.ranges) { + this.yylloc.range[1]++; } - d._final = function (callback) { - head.end() - onfinish = callback + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; } - head.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - } else if (isWebStream(head)) { - const writable = isTransformStream(head) ? head.writable : head - const writer = writable.getWriter() - d._write = async function (chunk, encoding, callback) { - try { - await writer.ready - writer.write(chunk).catch(() => {}) - callback() - } catch (err) { - callback(err) - } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } - d._final = async function (callback) { - try { - await writer.ready - writer.close().catch(() => {}) - onfinish = callback - } catch (err) { - callback(err) - } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } - } - const toRead = isTransformStream(tail) ? tail.readable : tail - eos(toRead, () => { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// displays already matched input, i.e. for error messages +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); } - }) - } - if (readable) { - if (isNodeStream(tail)) { - tail.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - tail.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = tail.read() - if (buf === null) { - onreadable = d._read - return + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function(match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); } - if (!d.push(buf)) { - return + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; } - } + return false; // rule action called reject() implying the next rule should be tested instead. } - } else if (isWebStream(tail)) { - const readable = isTransformStream(tail) ? tail.readable : tail - const reader = readable.getReader() - d._read = async function () { - while (true) { - try { - const { value, done } = await reader.read() - if (!d.push(value)) { - return - } - if (done) { - d.push(null) - return - } - } catch { - return + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } } - } } - } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - if (isNodeStream(tail)) { - destroyer(tail, err) - } - } - } - return d - } - - - /***/ }), - - /***/ 92573: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - const { - aggregateTwoErrors, - codes: { ERR_MULTIPLE_CALLBACK }, - AbortError - } = __webpack_require__(4213) - const { Symbol } = __webpack_require__(26701) - const { kDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(46342) - const kDestroy = Symbol('kDestroy') - const kConstruct = Symbol('kConstruct') - function checkError(err, w, r) { - if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + +// return next match that has a token +lex:function lex () { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin (condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState () { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules () { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState (n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState (condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {"flex":true,"case-insensitive":true}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:/* ignore */ +break; +case 1:return 12 +break; +case 2:return 15 +break; +case 3:return 28 +break; +case 4:return 316 +break; +case 5:return 317 +break; +case 6:return 35 +break; +case 7:return 37 +break; +case 8:return 38 +break; +case 9:return 26 +break; +case 10:return 41 +break; +case 11:return 45 +break; +case 12:return 46 +break; +case 13:return 48 +break; +case 14:return 50 +break; +case 15:return 55 +break; +case 16:return 58 +break; +case 17:return 320 +break; +case 18:return 68 +break; +case 19:return 69 +break; +case 20:return 75 +break; +case 21:return 78 +break; +case 22:return 81 +break; +case 23:return 83 +break; +case 24:return 86 +break; +case 25:return 88 +break; +case 26:return 90 +break; +case 27:return 191 +break; +case 28:return 107 +break; +case 29:return 321 +break; +case 30:return 140 +break; +case 31:return 322 +break; +case 32:return 323 +break; +case 33:return 117 +break; +case 34:return 324 +break; +case 35:return 116 +break; +case 36:return 325 +break; +case 37:return 326 +break; +case 38:return 120 +break; +case 39:return 122 +break; +case 40:return 123 +break; +case 41:return 138 +break; +case 42:return 132 +break; +case 43:return 133 +break; +case 44:return 135 +break; +case 45:return 141 +break; +case 46:return 119 +break; +case 47:return 327 +break; +case 48:return 328 +break; +case 49:return 167 +break; +case 50:return 170 +break; +case 51:return 174 +break; +case 52:return 100 +break; +case 53:return 168 +break; +case 54:return 329 +break; +case 55:return 173 +break; +case 56:return 231 +break; +case 57:return 235 +break; +case 58:return 278 +break; +case 59:return 195 +break; +case 60:return 330 +break; +case 61:return 331 +break; +case 62:return 224 +break; +case 63:return 333 +break; +case 64:return 271 +break; +case 65:return 219 +break; +case 66:return 226 +break; +case 67:return 227 +break; +case 68:return 250 +break; +case 69:return 254 +break; +case 70:return 295 +break; +case 71:return 334 +break; +case 72:return 335 +break; +case 73:return 336 +break; +case 74:return 337 +break; +case 75:return 338 +break; +case 76:return 258 +break; +case 77:return 339 +break; +case 78:return 273 +break; +case 79:return 281 +break; +case 80:return 282 +break; +case 81:return 275 +break; +case 82:return 276 +break; +case 83:return 277 +break; +case 84:return 340 +break; +case 85:return 341 +break; +case 86:return 279 +break; +case 87:return 343 +break; +case 88:return 342 +break; +case 89:return 344 +break; +case 90:return 284 +break; +case 91:return 285 +break; +case 92:return 288 +break; +case 93:return 290 +break; +case 94:return 294 +break; +case 95:return 298 +break; +case 96:return 301 +break; +case 97:return 13 +break; +case 98:return 16 +break; +case 99:return 312 +break; +case 100:return 245 +break; +case 101:return 34 +break; +case 102:return 297 +break; +case 103:return 87 +break; +case 104:return 299 +break; +case 105:return 300 +break; +case 106:return 306 +break; +case 107:return 307 +break; +case 108:return 308 +break; +case 109:return 309 +break; +case 110:return 310 +break; +case 111:return 311 +break; +case 112:return 'EXPONENT' +break; +case 113:return 302 +break; +case 114:return 303 +break; +case 115:return 304 +break; +case 116:return 305 +break; +case 117:return 93 +break; +case 118:return 246 +break; +case 119:return 6 +break; +case 120:return 'INVALID' +break; +case 121:console.log(yy_.yytext); +break; +} +}, +rules: [/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,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,91,92,93,94,95,96,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],"inclusive":true}} +}); +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})();module.exports=SparqlParser + + +/***/ }), + +/***/ 87735: +/***/ ((module) => { + + +// Wildcard constructor +class Wildcard { + constructor() { + return WILDCARD || this; } - - // Backwards compat. cb() is undocumented and unused in core but - // unfortunately might be used by modules. - function destroy(err, cb) { - const r = this._readableState - const w = this._writableState - // With duplex streams we use the writable side for state. - const s = w || r - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - if (typeof cb === 'function') { - cb() - } - return this - } - - // We set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - checkError(err, w, r) - if (w) { - w.destroyed = true - } - if (r) { - r.destroyed = true - } - - // If still constructing then defer calling _destroy. - if (!s.constructed) { - this.once(kDestroy, function (er) { - _destroy(this, aggregateTwoErrors(er, err), cb) - }) - } else { - _destroy(this, err, cb) - } - return this + + equals(other) { + return other && (this.termType === other.termType); } - function _destroy(self, err, cb) { - let called = false - function onDestroy(err) { - if (called) { - return - } - called = true - const r = self._readableState - const w = self._writableState - checkError(err, w, r) - if (w) { - w.closed = true - } - if (r) { - r.closed = true - } - if (typeof cb === 'function') { - cb(err) +} + +Object.defineProperty(Wildcard.prototype, 'value', { + enumerable: true, + value: '*', +}); + +Object.defineProperty(Wildcard.prototype, 'termType', { + enumerable: true, + value: 'Wildcard', +}); + + +// Wildcard singleton +var WILDCARD = new Wildcard(); + +module.exports.R = Wildcard; + + +/***/ }), + +/***/ 99623: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Parser = (__webpack_require__(89516).Parser); +var Generator = __webpack_require__(10113); +var Wildcard = (__webpack_require__(87735)/* .Wildcard */ .R); +var { DataFactory } = __webpack_require__(18628); + +module.exports = { + /** + * Creates a SPARQL parser with the given pre-defined prefixes and base IRI + * @param options { + * prefixes?: { [prefix: string]: string }, + * baseIRI?: string, + * factory?: import('rdf-js').DataFactory, + * sparqlStar?: boolean, + * skipValidation?: boolean, + * skipUngroupedVariableCheck?: boolean + * } + */ + Parser: function ({ prefixes, baseIRI, factory, sparqlStar, skipValidation, skipUngroupedVariableCheck, pathOnly } = {}) { + + // Create a copy of the prefixes + var prefixesCopy = {}; + for (var prefix in prefixes || {}) + prefixesCopy[prefix] = prefixes[prefix]; + + // Create a new parser with the given prefixes + // (Workaround for https://github.com/zaach/jison/issues/241) + var parser = new Parser(); + parser.parse = function () { + Parser.base = baseIRI || ''; + Parser.prefixes = Object.create(prefixesCopy); + Parser.factory = factory || new DataFactory(); + Parser.sparqlStar = Boolean(sparqlStar); + Parser.pathOnly = Boolean(pathOnly); + // We keep skipUngroupedVariableCheck for compatibility reasons. + Parser.skipValidation = Boolean(skipValidation) || Boolean(skipUngroupedVariableCheck) + return Parser.prototype.parse.apply(parser, arguments); + }; + parser._resetBlanks = Parser._resetBlanks; + return parser; + }, + Generator: Generator, + Wildcard: Wildcard, +}; + + +/***/ }), + +/***/ 29975: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { AbortError, codes } = __webpack_require__(4213) +const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(46342) +const eos = __webpack_require__(24597) +const { ERR_INVALID_ARG_TYPE } = codes + +// This method is inlined here for readable-stream +// It also does not allow for signal to not exist on the stream +// https://github.com/nodejs/node/pull/36061#discussion_r533718029 +const validateAbortSignal = (signal, name) => { + if (typeof signal !== 'object' || !('aborted' in signal)) { + throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) + } +} +module.exports.addAbortSignal = function addAbortSignal(signal, stream) { + validateAbortSignal(signal, 'signal') + if (!isNodeStream(stream) && !isWebStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } + return module.exports.addAbortSignalNoValidate(signal, stream) +} +module.exports.addAbortSignalNoValidate = function (signal, stream) { + if (typeof signal !== 'object' || !('aborted' in signal)) { + return stream + } + const onAbort = isNodeStream(stream) + ? () => { + stream.destroy( + new AbortError(undefined, { + cause: signal.reason + }) + ) } - if (err) { - process.nextTick(emitErrorCloseNT, self, err) - } else { - process.nextTick(emitCloseNT, self) + : () => { + stream[kControllerErrorFunction]( + new AbortError(undefined, { + cause: signal.reason + }) + ) } - } - try { - self._destroy(err || null, onDestroy) - } catch (err) { - onDestroy(err) - } + if (signal.aborted) { + onAbort() + } else { + signal.addEventListener('abort', onAbort) + eos(stream, () => signal.removeEventListener('abort', onAbort)) } - function emitErrorCloseNT(self, err) { - emitErrorNT(self, err) - emitCloseNT(self) + return stream +} + + +/***/ }), + +/***/ 51085: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(26701) +const { Buffer } = __webpack_require__(2486) +const { inspect } = __webpack_require__(72978) +module.exports = class BufferList { + constructor() { + this.head = null + this.tail = null + this.length = 0 } - function emitCloseNT(self) { - const r = self._readableState - const w = self._writableState - if (w) { - w.closeEmitted = true - } - if (r) { - r.closeEmitted = true - } - if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { - self.emit('close') - } + push(v) { + const entry = { + data: v, + next: null + } + if (this.length > 0) this.tail.next = entry + else this.head = entry + this.tail = entry + ++this.length + } + unshift(v) { + const entry = { + data: v, + next: this.head + } + if (this.length === 0) this.tail = entry + this.head = entry + ++this.length + } + shift() { + if (this.length === 0) return + const ret = this.head.data + if (this.length === 1) this.head = this.tail = null + else this.head = this.head.next + --this.length + return ret } - function emitErrorNT(self, err) { - const r = self._readableState - const w = self._writableState - if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { - return - } - if (w) { - w.errorEmitted = true - } - if (r) { - r.errorEmitted = true - } - self.emit('error', err) + clear() { + this.head = this.tail = null + this.length = 0 } - function undestroy() { - const r = this._readableState - const w = this._writableState - if (r) { - r.constructed = true - r.closed = false - r.closeEmitted = false - r.destroyed = false - r.errored = null - r.errorEmitted = false - r.reading = false - r.ended = r.readable === false - r.endEmitted = r.readable === false - } - if (w) { - w.constructed = true - w.destroyed = false - w.closed = false - w.closeEmitted = false - w.errored = null - w.errorEmitted = false - w.finalCalled = false - w.prefinished = false - w.ended = w.writable === false - w.ending = w.writable === false - w.finished = w.writable === false - } - } - function errorOrDestroy(stream, err, sync) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - - const r = stream._readableState - const w = stream._writableState - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - return this - } - if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) - stream.destroy(err) - else if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - if (sync) { - process.nextTick(emitErrorNT, stream, err) - } else { - emitErrorNT(stream, err) - } - } + join(s) { + if (this.length === 0) return '' + let p = this.head + let ret = '' + p.data + while ((p = p.next) !== null) ret += s + p.data + return ret } - function construct(stream, cb) { - if (typeof stream._construct !== 'function') { - return - } - const r = stream._readableState - const w = stream._writableState - if (r) { - r.constructed = false - } - if (w) { - w.constructed = false - } - stream.once(kConstruct, cb) - if (stream.listenerCount(kConstruct) > 1) { - // Duplex - return + concat(n) { + if (this.length === 0) return Buffer.alloc(0) + const ret = Buffer.allocUnsafe(n >>> 0) + let p = this.head + let i = 0 + while (p) { + TypedArrayPrototypeSet(ret, p.data, i) + i += p.data.length + p = p.next } - process.nextTick(constructNT, stream) + return ret } - function constructNT(stream) { - let called = false - function onConstruct(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) - return - } - called = true - const r = stream._readableState - const w = stream._writableState - const s = w || r - if (r) { - r.constructed = true - } - if (w) { - w.constructed = true - } - if (s.destroyed) { - stream.emit(kDestroy, err) - } else if (err) { - errorOrDestroy(stream, err, true) - } else { - process.nextTick(emitConstructNT, stream) - } + + // Consumes a specified amount of bytes or characters from the buffered data. + consume(n, hasStrings) { + const data = this.head.data + if (n < data.length) { + // `slice` is the same for buffers and strings. + const slice = data.slice(0, n) + this.head.data = data.slice(n) + return slice } - try { - stream._construct((err) => { - process.nextTick(onConstruct, err) - }) - } catch (err) { - process.nextTick(onConstruct, err) + if (n === data.length) { + // First chunk is a perfect match. + return this.shift() } + // Result spans more than one buffer. + return hasStrings ? this._getString(n) : this._getBuffer(n) } - function emitConstructNT(stream) { - stream.emit(kConstruct) - } - function isRequest(stream) { - return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' + first() { + return this.head.data } - function emitCloseLegacy(stream) { - stream.emit('close') - } - function emitErrorCloseLegacy(stream, err) { - stream.emit('error', err) - process.nextTick(emitCloseLegacy, stream) - } - - // Normalize destroy for legacy. - function destroyer(stream, err) { - if (!stream || isDestroyed(stream)) { - return - } - if (!err && !isFinished(stream)) { - err = new AbortError() - } - - // TODO: Remove isRequest branches. - if (isServerRequest(stream)) { - stream.socket = null - stream.destroy(err) - } else if (isRequest(stream)) { - stream.abort() - } else if (isRequest(stream.req)) { - stream.req.abort() - } else if (typeof stream.destroy === 'function') { - stream.destroy(err) - } else if (typeof stream.close === 'function') { - // TODO: Don't lose err? - stream.close() - } else if (err) { - process.nextTick(emitErrorCloseLegacy, stream, err) - } else { - process.nextTick(emitCloseLegacy, stream) - } - if (!stream.destroyed) { - stream[kDestroyed] = true - } - } - module.exports = { - construct, - destroyer, - destroy, - undestroy, - errorOrDestroy - } - - - /***/ }), - - /***/ 35960: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a duplex stream is just a stream that is both readable and writable. - // Since JS doesn't have multiple prototype inheritance, this class - // prototypically inherits from Readable, and then parasitically from - // Writable. - - - - const { - ObjectDefineProperties, - ObjectGetOwnPropertyDescriptor, - ObjectKeys, - ObjectSetPrototypeOf - } = __webpack_require__(26701) - module.exports = Duplex - const Readable = __webpack_require__(3845) - const Writable = __webpack_require__(12657) - ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) - ObjectSetPrototypeOf(Duplex, Readable) - { - const keys = ObjectKeys(Writable.prototype) - // Allow the keys array to be GC'ed. - for (let i = 0; i < keys.length; i++) { - const method = keys[i] - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] - } - } - function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options) - Readable.call(this, options) - Writable.call(this, options) - if (options) { - this.allowHalfOpen = options.allowHalfOpen !== false - if (options.readable === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if (options.writable === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } else { - this.allowHalfOpen = true + *[SymbolIterator]() { + for (let p = this.head; p; p = p.next) { + yield p.data } } - ObjectDefineProperties(Duplex.prototype, { - writable: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') - }, - writableHighWaterMark: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') - }, - writableObjectMode: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') - }, - writableBuffer: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') - }, - writableLength: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') - }, - writableFinished: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') - }, - writableCorked: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') - }, - writableEnded: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') - }, - writableNeedDrain: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') - }, - destroyed: { - __proto__: null, - get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false - } - return this._readableState.destroyed && this._writableState.destroyed - }, - set(value) { - // Backward compatibility, the user is explicitly - // managing destroyed. - if (this._readableState && this._writableState) { - this._readableState.destroyed = value - this._writableState.destroyed = value + + // Consumes a specified amount of characters from the buffered data. + _getString(n) { + let ret = '' + let p = this.head + let c = 0 + do { + const str = p.data + if (n > str.length) { + ret += str + n -= str.length + } else { + if (n === str.length) { + ret += str + ++c + if (p.next) this.head = p.next + else this.head = this.tail = null + } else { + ret += StringPrototypeSlice(str, 0, n) + this.head = p + p.data = StringPrototypeSlice(str, n) } + break } - } - }) - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters - } - Duplex.fromWeb = function (pair, options) { - return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) - } - Duplex.toWeb = function (duplex) { - return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) - } - let duplexify - Duplex.from = function (body) { - if (!duplexify) { - duplexify = __webpack_require__(47720) - } - return duplexify(body, 'body') - } - - - /***/ }), - - /***/ 47720: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - ;('use strict') - const bufferModule = __webpack_require__(2486) - const { - isReadable, - isWritable, - isIterable, - isNodeStream, - isReadableNodeStream, - isWritableNodeStream, - isDuplexNodeStream - } = __webpack_require__(46342) - const eos = __webpack_require__(24597) - const { - AbortError, - codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } - } = __webpack_require__(4213) - const { destroyer } = __webpack_require__(92573) - const Duplex = __webpack_require__(35960) - const Readable = __webpack_require__(3845) - const { createDeferredPromise } = __webpack_require__(72978) - const from = __webpack_require__(54562) - const Blob = globalThis.Blob || bufferModule.Blob - const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - return b instanceof Blob - } - : function isBlob(b) { - return false + ++c + } while ((p = p.next) !== null) + this.length -= c + return ret + } + + // Consumes a specified amount of bytes from the buffered data. + _getBuffer(n) { + const ret = Buffer.allocUnsafe(n) + const retLen = n + let p = this.head + let c = 0 + do { + const buf = p.data + if (n > buf.length) { + TypedArrayPrototypeSet(ret, buf, retLen - n) + n -= buf.length + } else { + if (n === buf.length) { + TypedArrayPrototypeSet(ret, buf, retLen - n) + ++c + if (p.next) this.head = p.next + else this.head = this.tail = null + } else { + TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) + this.head = p + p.data = buf.slice(n) } - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - const { FunctionPrototypeCall } = __webpack_require__(26701) - - // This is needed for pre node 17. - class Duplexify extends Duplex { - constructor(options) { - super(options) - - // https://github.com/nodejs/node/pull/34385 - - if ((options === null || options === undefined ? undefined : options.readable) === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if ((options === null || options === undefined ? undefined : options.writable) === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } - } - module.exports = function duplexify(body, name) { - if (isDuplexNodeStream(body)) { - return body - } - if (isReadableNodeStream(body)) { - return _duplexify({ - readable: body - }) - } - if (isWritableNodeStream(body)) { - return _duplexify({ - writable: body - }) - } - if (isNodeStream(body)) { - return _duplexify({ - writable: false, - readable: false - }) - } - - // TODO: Webstreams - // if (isReadableStream(body)) { - // return _duplexify({ readable: Readable.fromWeb(body) }); - // } - - // TODO: Webstreams - // if (isWritableStream(body)) { - // return _duplexify({ writable: Writable.fromWeb(body) }); - // } - - if (typeof body === 'function') { - const { value, write, final, destroy } = fromAsyncGen(body) - if (isIterable(value)) { - return from(Duplexify, value, { - // TODO (ronag): highWaterMark? - objectMode: true, - write, - final, - destroy - }) - } - const then = value === null || value === undefined ? undefined : value.then - if (typeof then === 'function') { - let d - const promise = FunctionPrototypeCall( - then, - value, - (val) => { - if (val != null) { - throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) - } - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - // TODO (ronag): highWaterMark? - objectMode: true, - readable: false, - write, - final(cb) { - final(async () => { - try { - await promise - process.nextTick(cb, null) - } catch (err) { - process.nextTick(cb, err) - } - }) - }, - destroy - })) + break } - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) - } - if (isBlob(body)) { - return duplexify(body.arrayBuffer()) - } - if (isIterable(body)) { - return from(Duplexify, body, { - // TODO (ronag): highWaterMark? - objectMode: true, - writable: false - }) + ++c + } while ((p = p.next) !== null) + this.length -= c + return ret + } + + // Make sure the linked list only shows the minimal necessary information. + [Symbol.for('nodejs.util.inspect.custom')](_, options) { + return inspect(this, { + ...options, + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + }) + } +} + + +/***/ }), + +/***/ 65729: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { pipeline } = __webpack_require__(33939) +const Duplex = __webpack_require__(35960) +const { destroyer } = __webpack_require__(92573) +const { + isNodeStream, + isReadable, + isWritable, + isWebStream, + isTransformStream, + isWritableStream, + isReadableStream +} = __webpack_require__(46342) +const { + AbortError, + codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } +} = __webpack_require__(4213) +const eos = __webpack_require__(24597) +module.exports = function compose(...streams) { + if (streams.length === 0) { + throw new ERR_MISSING_ARGS('streams') + } + if (streams.length === 1) { + return Duplex.from(streams[0]) + } + const orgStreams = [...streams] + if (typeof streams[0] === 'function') { + streams[0] = Duplex.from(streams[0]) + } + if (typeof streams[streams.length - 1] === 'function') { + const idx = streams.length - 1 + streams[idx] = Duplex.from(streams[idx]) + } + for (let n = 0; n < streams.length; ++n) { + if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { + // TODO(ronag): Add checks for non streams. + continue } - - // TODO: Webstreams. - // if ( - // isReadableStream(body?.readable) && - // isWritableStream(body?.writable) - // ) { - // return Duplexify.fromWeb(body); - // } - if ( - typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || - typeof (body === null || body === undefined ? undefined : body.readable) === 'object' + n < streams.length - 1 && + !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) ) { - const readable = - body !== null && body !== undefined && body.readable - ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) - ? body === null || body === undefined - ? undefined - : body.readable - : duplexify(body.readable) - : undefined - const writable = - body !== null && body !== undefined && body.writable - ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) - ? body === null || body === undefined - ? undefined - : body.writable - : duplexify(body.writable) - : undefined - return _duplexify({ - readable, - writable - }) + throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') } - const then = body === null || body === undefined ? undefined : body.then - if (typeof then === 'function') { - let d - FunctionPrototypeCall( - then, - body, - (val) => { - if (val != null) { - d.push(val) - } - d.push(null) - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - objectMode: true, - writable: false, - read() {} - })) + if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { + throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') } - throw new ERR_INVALID_ARG_TYPE( - name, - [ - 'Blob', - 'ReadableStream', - 'WritableStream', - 'Stream', - 'Iterable', - 'AsyncIterable', - 'Function', - '{ readable, writable } pair', - 'Promise' - ], - body - ) } - function fromAsyncGen(fn) { - let { promise, resolve } = createDeferredPromise() - const ac = new AbortController() - const signal = ac.signal - const value = fn( - (async function* () { - while (true) { - const _promise = promise - promise = null - const { chunk, done, cb } = await _promise - process.nextTick(cb) - if (done) return - if (signal.aborted) - throw new AbortError(undefined, { - cause: signal.reason - }) - ;({ promise, resolve } = createDeferredPromise()) - yield chunk - } - })(), - { - signal - } - ) - return { - value, - write(chunk, encoding, cb) { - const _resolve = resolve - resolve = null - _resolve({ - chunk, - done: false, - cb - }) - }, - final(cb) { - const _resolve = resolve - resolve = null - _resolve({ - done: true, - cb - }) - }, - destroy(err, cb) { - ac.abort() - cb(err) - } + let ondrain + let onfinish + let onreadable + let onclose + let d + function onfinished(err) { + const cb = onclose + onclose = null + if (cb) { + cb(err) + } else if (err) { + d.destroy(err) + } else if (!readable && !writable) { + d.destroy() } } - function _duplexify(pair) { - const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable - const w = pair.writable - let readable = !!isReadable(r) - let writable = !!isWritable(w) - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } - } - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplexify({ - // TODO (ronag): highWaterMark? - readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), - writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), - readable, - writable - }) - if (writable) { - eos(w, (err) => { - writable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) + const head = streams[0] + const tail = pipeline(streams, onfinished) + const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) + const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) + + // TODO(ronag): Avoid double buffering. + // Implement Writable/Readable/Duplex traits. + // See, https://github.com/nodejs/node/pull/33515. + d = new Duplex({ + // TODO (ronag): highWaterMark? + writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), + readableObjectMode: !!(tail !== null && tail !== undefined && tail.writableObjectMode), + writable, + readable + }) + if (writable) { + if (isNodeStream(head)) { d._write = function (chunk, encoding, callback) { - if (w.write(chunk, encoding)) { + if (head.write(chunk, encoding)) { callback() } else { ondrain = callback } } d._final = function (callback) { - w.end() + head.end() onfinish = callback } - w.on('drain', function () { + head.on('drain', function () { if (ondrain) { const cb = ondrain ondrain = null cb() } }) - w.on('finish', function () { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() + } else if (isWebStream(head)) { + const writable = isTransformStream(head) ? head.writable : head + const writer = writable.getWriter() + d._write = async function (chunk, encoding, callback) { + try { + await writer.ready + writer.write(chunk).catch(() => {}) + callback() + } catch (err) { + callback(err) } - }) - } - if (readable) { - eos(r, (err) => { - readable = false - if (err) { - destroyer(r, err) + } + d._final = async function (callback) { + try { + await writer.ready + writer.close().catch(() => {}) + onfinish = callback + } catch (err) { + callback(err) } - onfinished(err) - }) - r.on('readable', function () { + } + } + const toRead = isTransformStream(tail) ? tail.readable : tail + eos(toRead, () => { + if (onfinish) { + const cb = onfinish + onfinish = null + cb() + } + }) + } + if (readable) { + if (isNodeStream(tail)) { + tail.on('readable', function () { if (onreadable) { const cb = onreadable onreadable = null cb() } }) - r.on('end', function () { + tail.on('end', function () { d.push(null) }) d._read = function () { while (true) { - const buf = r.read() + const buf = tail.read() if (buf === null) { onreadable = d._read return @@ -10309,39001 +9453,37002 @@ } } } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - destroyer(w, err) - destroyer(r, err) + } else if (isWebStream(tail)) { + const readable = isTransformStream(tail) ? tail.readable : tail + const reader = readable.getReader() + d._read = async function () { + while (true) { + try { + const { value, done } = await reader.read() + if (!d.push(value)) { + return + } + if (done) { + d.push(null) + return + } + } catch { + return + } + } } } - return d - } - - - /***/ }), - - /***/ 24597: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // Ported from https://github.com/mafintosh/end-of-stream with - // permission from the author, Mathias Buus (@mafintosh). - - ;('use strict') - const { AbortError, codes } = __webpack_require__(4213) - const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes - const { kEmptyObject, once } = __webpack_require__(72978) - const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(99639) - const { Promise, PromisePrototypeThen } = __webpack_require__(26701) - const { - isClosed, - isReadable, - isReadableNodeStream, - isReadableStream, - isReadableFinished, - isReadableErrored, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableFinished, - isWritableErrored, - isNodeStream, - willEmitClose: _willEmitClose, - kIsClosedPromise - } = __webpack_require__(46342) - function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function' - } - const nop = () => {} - function eos(stream, options, callback) { - var _options$readable, _options$writable - if (arguments.length === 2) { - callback = options - options = kEmptyObject - } else if (options == null) { - options = kEmptyObject - } else { - validateObject(options, 'options') - } - validateFunction(callback, 'callback') - validateAbortSignal(options.signal, 'options.signal') - callback = once(callback) - if (isReadableStream(stream) || isWritableStream(stream)) { - return eosWeb(stream, options, callback) - } - if (!isNodeStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } + d._destroy = function (err, callback) { + if (!err && onclose !== null) { + err = new AbortError() } - const readable = - (_options$readable = options.readable) !== null && _options$readable !== undefined - ? _options$readable - : isReadableNodeStream(stream) - const writable = - (_options$writable = options.writable) !== null && _options$writable !== undefined - ? _options$writable - : isWritableNodeStream(stream) - const wState = stream._writableState - const rState = stream._readableState - const onlegacyfinish = () => { - if (!stream.writable) { - onfinish() - } - } - - // TODO (ronag): Improve soft detection to include core modules and - // common ecosystem modules that do properly emit 'close' but fail - // this generic check. - let willEmitClose = - _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable - let writableFinished = isWritableFinished(stream, false) - const onfinish = () => { - writableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.readable || readable)) { - return - } - if (!readable || readableFinished) { - callback.call(stream) + onreadable = null + ondrain = null + onfinish = null + if (onclose === null) { + callback(err) + } else { + onclose = callback + if (isNodeStream(tail)) { + destroyer(tail, err) } } - let readableFinished = isReadableFinished(stream, false) - const onend = () => { - readableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.writable || writable)) { - return - } - if (!writable || writableFinished) { - callback.call(stream) - } + } + return d +} + + +/***/ }), + +/***/ 92573: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +const { + aggregateTwoErrors, + codes: { ERR_MULTIPLE_CALLBACK }, + AbortError +} = __webpack_require__(4213) +const { Symbol } = __webpack_require__(26701) +const { kDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(46342) +const kDestroy = Symbol('kDestroy') +const kConstruct = Symbol('kConstruct') +function checkError(err, w, r) { + if (err) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + err.stack // eslint-disable-line no-unused-expressions + + if (w && !w.errored) { + w.errored = err } - const onerror = (err) => { - callback.call(stream, err) + if (r && !r.errored) { + r.errored = err } - let closed = isClosed(stream) - const onclose = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - if (readable && !readableFinished && isReadableNodeStream(stream, true)) { - if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - if (writable && !writableFinished) { - if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - callback.call(stream) + } +} + +// Backwards compat. cb() is undocumented and unused in core but +// unfortunately might be used by modules. +function destroy(err, cb) { + const r = this._readableState + const w = this._writableState + // With duplex streams we use the writable side for state. + const s = w || r + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { + if (typeof cb === 'function') { + cb() } - const onclosed = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - callback.call(stream) + return this + } + + // We set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + checkError(err, w, r) + if (w) { + w.destroyed = true + } + if (r) { + r.destroyed = true + } + + // If still constructing then defer calling _destroy. + if (!s.constructed) { + this.once(kDestroy, function (er) { + _destroy(this, aggregateTwoErrors(er, err), cb) + }) + } else { + _destroy(this, err, cb) + } + return this +} +function _destroy(self, err, cb) { + let called = false + function onDestroy(err) { + if (called) { + return + } + called = true + const r = self._readableState + const w = self._writableState + checkError(err, w, r) + if (w) { + w.closed = true } - const onrequest = () => { - stream.req.on('finish', onfinish) + if (r) { + r.closed = true } - if (isRequest(stream)) { - stream.on('complete', onfinish) - if (!willEmitClose) { - stream.on('abort', onclose) - } - if (stream.req) { - onrequest() - } else { - stream.on('request', onrequest) - } - } else if (writable && !wState) { - // legacy streams - stream.on('end', onlegacyfinish) - stream.on('close', onlegacyfinish) - } - - // Not all streams will emit 'close' after 'aborted'. - if (!willEmitClose && typeof stream.aborted === 'boolean') { - stream.on('aborted', onclose) - } - stream.on('end', onend) - stream.on('finish', onfinish) - if (options.error !== false) { - stream.on('error', onerror) - } - stream.on('close', onclose) - if (closed) { - process.nextTick(onclose) - } else if ( - (wState !== null && wState !== undefined && wState.errorEmitted) || - (rState !== null && rState !== undefined && rState.errorEmitted) - ) { - if (!willEmitClose) { - process.nextTick(onclosed) - } - } else if ( - !readable && - (!willEmitClose || isReadable(stream)) && - (writableFinished || isWritable(stream) === false) - ) { - process.nextTick(onclosed) - } else if ( - !writable && - (!willEmitClose || isWritable(stream)) && - (readableFinished || isReadable(stream) === false) - ) { - process.nextTick(onclosed) - } else if (rState && stream.req && stream.aborted) { - process.nextTick(onclosed) + if (typeof cb === 'function') { + cb(err) } - const cleanup = () => { - callback = nop - stream.removeListener('aborted', onclose) - stream.removeListener('complete', onfinish) - stream.removeListener('abort', onclose) - stream.removeListener('request', onrequest) - if (stream.req) stream.req.removeListener('finish', onfinish) - stream.removeListener('end', onlegacyfinish) - stream.removeListener('close', onlegacyfinish) - stream.removeListener('finish', onfinish) - stream.removeListener('end', onend) - stream.removeListener('error', onerror) - stream.removeListener('close', onclose) - } - if (options.signal && !closed) { - const abort = () => { - // Keep it because cleanup removes it. - const endCallback = callback - cleanup() - endCallback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - const originalCallback = callback - callback = once((...args) => { - options.signal.removeEventListener('abort', abort) - originalCallback.apply(stream, args) - }) - options.signal.addEventListener('abort', abort) - } + if (err) { + process.nextTick(emitErrorCloseNT, self, err) + } else { + process.nextTick(emitCloseNT, self) } - return cleanup } - function eosWeb(stream, options, callback) { - let isAborted = false - let abort = nop - if (options.signal) { - abort = () => { - isAborted = true - callback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - const originalCallback = callback - callback = once((...args) => { - options.signal.removeEventListener('abort', abort) - originalCallback.apply(stream, args) - }) - options.signal.addEventListener('abort', abort) - } + try { + self._destroy(err || null, onDestroy) + } catch (err) { + onDestroy(err) + } +} +function emitErrorCloseNT(self, err) { + emitErrorNT(self, err) + emitCloseNT(self) +} +function emitCloseNT(self) { + const r = self._readableState + const w = self._writableState + if (w) { + w.closeEmitted = true + } + if (r) { + r.closeEmitted = true + } + if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { + self.emit('close') + } +} +function emitErrorNT(self, err) { + const r = self._readableState + const w = self._writableState + if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { + return + } + if (w) { + w.errorEmitted = true + } + if (r) { + r.errorEmitted = true + } + self.emit('error', err) +} +function undestroy() { + const r = this._readableState + const w = this._writableState + if (r) { + r.constructed = true + r.closed = false + r.closeEmitted = false + r.destroyed = false + r.errored = null + r.errorEmitted = false + r.reading = false + r.ended = r.readable === false + r.endEmitted = r.readable === false + } + if (w) { + w.constructed = true + w.destroyed = false + w.closed = false + w.closeEmitted = false + w.errored = null + w.errorEmitted = false + w.finalCalled = false + w.prefinished = false + w.ended = w.writable === false + w.ending = w.writable === false + w.finished = w.writable === false + } +} +function errorOrDestroy(stream, err, sync) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + const r = stream._readableState + const w = stream._writableState + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { + return this + } + if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) + stream.destroy(err) + else if (err) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + err.stack // eslint-disable-line no-unused-expressions + + if (w && !w.errored) { + w.errored = err } - const resolverFn = (...args) => { - if (!isAborted) { - process.nextTick(() => callback.apply(stream, args)) - } + if (r && !r.errored) { + r.errored = err + } + if (sync) { + process.nextTick(emitErrorNT, stream, err) + } else { + emitErrorNT(stream, err) + } + } +} +function construct(stream, cb) { + if (typeof stream._construct !== 'function') { + return + } + const r = stream._readableState + const w = stream._writableState + if (r) { + r.constructed = false + } + if (w) { + w.constructed = false + } + stream.once(kConstruct, cb) + if (stream.listenerCount(kConstruct) > 1) { + // Duplex + return + } + process.nextTick(constructNT, stream) +} +function constructNT(stream) { + let called = false + function onConstruct(err) { + if (called) { + errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) + return + } + called = true + const r = stream._readableState + const w = stream._writableState + const s = w || r + if (r) { + r.constructed = true + } + if (w) { + w.constructed = true } - PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) - return nop + if (s.destroyed) { + stream.emit(kDestroy, err) + } else if (err) { + errorOrDestroy(stream, err, true) + } else { + process.nextTick(emitConstructNT, stream) + } + } + try { + stream._construct((err) => { + process.nextTick(onConstruct, err) + }) + } catch (err) { + process.nextTick(onConstruct, err) + } +} +function emitConstructNT(stream) { + stream.emit(kConstruct) +} +function isRequest(stream) { + return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' +} +function emitCloseLegacy(stream) { + stream.emit('close') +} +function emitErrorCloseLegacy(stream, err) { + stream.emit('error', err) + process.nextTick(emitCloseLegacy, stream) +} + +// Normalize destroy for legacy. +function destroyer(stream, err) { + if (!stream || isDestroyed(stream)) { + return + } + if (!err && !isFinished(stream)) { + err = new AbortError() + } + + // TODO: Remove isRequest branches. + if (isServerRequest(stream)) { + stream.socket = null + stream.destroy(err) + } else if (isRequest(stream)) { + stream.abort() + } else if (isRequest(stream.req)) { + stream.req.abort() + } else if (typeof stream.destroy === 'function') { + stream.destroy(err) + } else if (typeof stream.close === 'function') { + // TODO: Don't lose err? + stream.close() + } else if (err) { + process.nextTick(emitErrorCloseLegacy, stream, err) + } else { + process.nextTick(emitCloseLegacy, stream) } - function finished(stream, opts) { - var _opts - let autoCleanup = false - if (opts === null) { - opts = kEmptyObject + if (!stream.destroyed) { + stream[kDestroyed] = true + } +} +module.exports = { + construct, + destroyer, + destroy, + undestroy, + errorOrDestroy +} + + +/***/ }), + +/***/ 35960: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototype inheritance, this class +// prototypically inherits from Readable, and then parasitically from +// Writable. + + + +const { + ObjectDefineProperties, + ObjectGetOwnPropertyDescriptor, + ObjectKeys, + ObjectSetPrototypeOf +} = __webpack_require__(26701) +module.exports = Duplex +const Readable = __webpack_require__(3845) +const Writable = __webpack_require__(12657) +ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) +ObjectSetPrototypeOf(Duplex, Readable) +{ + const keys = ObjectKeys(Writable.prototype) + // Allow the keys array to be GC'ed. + for (let i = 0; i < keys.length; i++) { + const method = keys[i] + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options) + Readable.call(this, options) + Writable.call(this, options) + if (options) { + this.allowHalfOpen = options.allowHalfOpen !== false + if (options.readable === false) { + this._readableState.readable = false + this._readableState.ended = true + this._readableState.endEmitted = true + } + if (options.writable === false) { + this._writableState.writable = false + this._writableState.ending = true + this._writableState.ended = true + this._writableState.finished = true } - if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { - validateBoolean(opts.cleanup, 'cleanup') - autoCleanup = opts.cleanup + } else { + this.allowHalfOpen = true + } +} +ObjectDefineProperties(Duplex.prototype, { + writable: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') + }, + writableHighWaterMark: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') + }, + writableObjectMode: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') + }, + writableBuffer: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') + }, + writableLength: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') + }, + writableFinished: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') + }, + writableCorked: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') + }, + writableEnded: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') + }, + writableNeedDrain: { + __proto__: null, + ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') + }, + destroyed: { + __proto__: null, + get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false + } + return this._readableState.destroyed && this._writableState.destroyed + }, + set(value) { + // Backward compatibility, the user is explicitly + // managing destroyed. + if (this._readableState && this._writableState) { + this._readableState.destroyed = value + this._writableState.destroyed = value + } } - return new Promise((resolve, reject) => { - const cleanup = eos(stream, opts, (err) => { - if (autoCleanup) { - cleanup() - } - if (err) { - reject(err) - } else { - resolve() - } - }) + } +}) +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Duplex.fromWeb = function (pair, options) { + return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) +} +Duplex.toWeb = function (duplex) { + return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) +} +let duplexify +Duplex.from = function (body) { + if (!duplexify) { + duplexify = __webpack_require__(47720) + } + return duplexify(body, 'body') +} + + +/***/ }), + +/***/ 47720: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +;('use strict') +const bufferModule = __webpack_require__(2486) +const { + isReadable, + isWritable, + isIterable, + isNodeStream, + isReadableNodeStream, + isWritableNodeStream, + isDuplexNodeStream +} = __webpack_require__(46342) +const eos = __webpack_require__(24597) +const { + AbortError, + codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } +} = __webpack_require__(4213) +const { destroyer } = __webpack_require__(92573) +const Duplex = __webpack_require__(35960) +const Readable = __webpack_require__(3845) +const { createDeferredPromise } = __webpack_require__(72978) +const from = __webpack_require__(54562) +const Blob = globalThis.Blob || bufferModule.Blob +const isBlob = + typeof Blob !== 'undefined' + ? function isBlob(b) { + return b instanceof Blob + } + : function isBlob(b) { + return false + } +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +const { FunctionPrototypeCall } = __webpack_require__(26701) + +// This is needed for pre node 17. +class Duplexify extends Duplex { + constructor(options) { + super(options) + + // https://github.com/nodejs/node/pull/34385 + + if ((options === null || options === undefined ? undefined : options.readable) === false) { + this._readableState.readable = false + this._readableState.ended = true + this._readableState.endEmitted = true + } + if ((options === null || options === undefined ? undefined : options.writable) === false) { + this._writableState.writable = false + this._writableState.ending = true + this._writableState.ended = true + this._writableState.finished = true + } + } +} +module.exports = function duplexify(body, name) { + if (isDuplexNodeStream(body)) { + return body + } + if (isReadableNodeStream(body)) { + return _duplexify({ + readable: body + }) + } + if (isWritableNodeStream(body)) { + return _duplexify({ + writable: body + }) + } + if (isNodeStream(body)) { + return _duplexify({ + writable: false, + readable: false }) } - module.exports = eos - module.exports.finished = finished - - - /***/ }), - - /***/ 54562: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - - const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(26701) - const { Buffer } = __webpack_require__(2486) - const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(4213).codes) - function from(Readable, iterable, opts) { - let iterator - if (typeof iterable === 'string' || iterable instanceof Buffer) { - return new Readable({ + + // TODO: Webstreams + // if (isReadableStream(body)) { + // return _duplexify({ readable: Readable.fromWeb(body) }); + // } + + // TODO: Webstreams + // if (isWritableStream(body)) { + // return _duplexify({ writable: Writable.fromWeb(body) }); + // } + + if (typeof body === 'function') { + const { value, write, final, destroy } = fromAsyncGen(body) + if (isIterable(value)) { + return from(Duplexify, value, { + // TODO (ronag): highWaterMark? objectMode: true, - ...opts, - read() { - this.push(iterable) - this.push(null) - } + write, + final, + destroy }) } - let isAsync - if (iterable && iterable[SymbolAsyncIterator]) { - isAsync = true - iterator = iterable[SymbolAsyncIterator]() - } else if (iterable && iterable[SymbolIterator]) { - isAsync = false - iterator = iterable[SymbolIterator]() - } else { - throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) + const then = value === null || value === undefined ? undefined : value.then + if (typeof then === 'function') { + let d + const promise = FunctionPrototypeCall( + then, + value, + (val) => { + if (val != null) { + throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) + } + }, + (err) => { + destroyer(d, err) + } + ) + return (d = new Duplexify({ + // TODO (ronag): highWaterMark? + objectMode: true, + readable: false, + write, + final(cb) { + final(async () => { + try { + await promise + process.nextTick(cb, null) + } catch (err) { + process.nextTick(cb, err) + } + }) + }, + destroy + })) } - const readable = new Readable({ + throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) + } + if (isBlob(body)) { + return duplexify(body.arrayBuffer()) + } + if (isIterable(body)) { + return from(Duplexify, body, { + // TODO (ronag): highWaterMark? objectMode: true, - highWaterMark: 1, - // TODO(ronag): What options should be allowed? - ...opts + writable: false }) - - // Flag to protect against _read - // being called before last iteration completion. - let reading = false - readable._read = function () { - if (!reading) { - reading = true - next() - } - } - readable._destroy = function (error, cb) { - PromisePrototypeThen( - close(error), - () => process.nextTick(cb, error), - // nextTick is here in case cb throws - (e) => process.nextTick(cb, e || error) - ) - } - async function close(error) { - const hadError = error !== undefined && error !== null - const hasThrow = typeof iterator.throw === 'function' - if (hadError && hasThrow) { - const { value, done } = await iterator.throw(error) - await value - if (done) { - return + } + + // TODO: Webstreams. + // if ( + // isReadableStream(body?.readable) && + // isWritableStream(body?.writable) + // ) { + // return Duplexify.fromWeb(body); + // } + + if ( + typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || + typeof (body === null || body === undefined ? undefined : body.readable) === 'object' + ) { + const readable = + body !== null && body !== undefined && body.readable + ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) + ? body === null || body === undefined + ? undefined + : body.readable + : duplexify(body.readable) + : undefined + const writable = + body !== null && body !== undefined && body.writable + ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) + ? body === null || body === undefined + ? undefined + : body.writable + : duplexify(body.writable) + : undefined + return _duplexify({ + readable, + writable + }) + } + const then = body === null || body === undefined ? undefined : body.then + if (typeof then === 'function') { + let d + FunctionPrototypeCall( + then, + body, + (val) => { + if (val != null) { + d.push(val) } + d.push(null) + }, + (err) => { + destroyer(d, err) } - if (typeof iterator.return === 'function') { - const { value } = await iterator.return() - await value + ) + return (d = new Duplexify({ + objectMode: true, + writable: false, + read() {} + })) + } + throw new ERR_INVALID_ARG_TYPE( + name, + [ + 'Blob', + 'ReadableStream', + 'WritableStream', + 'Stream', + 'Iterable', + 'AsyncIterable', + 'Function', + '{ readable, writable } pair', + 'Promise' + ], + body + ) +} +function fromAsyncGen(fn) { + let { promise, resolve } = createDeferredPromise() + const ac = new AbortController() + const signal = ac.signal + const value = fn( + (async function* () { + while (true) { + const _promise = promise + promise = null + const { chunk, done, cb } = await _promise + process.nextTick(cb) + if (done) return + if (signal.aborted) + throw new AbortError(undefined, { + cause: signal.reason + }) + ;({ promise, resolve } = createDeferredPromise()) + yield chunk } + })(), + { + signal } - async function next() { - for (;;) { - try { - const { value, done } = isAsync ? await iterator.next() : iterator.next() - if (done) { - readable.push(null) - } else { - const res = value && typeof value.then === 'function' ? await value : value - if (res === null) { - reading = false - throw new ERR_STREAM_NULL_VALUES() - } else if (readable.push(res)) { - continue - } else { - reading = false - } - } - } catch (err) { - readable.destroy(err) - } - break - } + ) + return { + value, + write(chunk, encoding, cb) { + const _resolve = resolve + resolve = null + _resolve({ + chunk, + done: false, + cb + }) + }, + final(cb) { + const _resolve = resolve + resolve = null + _resolve({ + done: true, + cb + }) + }, + destroy(err, cb) { + ac.abort() + cb(err) + } + } +} +function _duplexify(pair) { + const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable + const w = pair.writable + let readable = !!isReadable(r) + let writable = !!isWritable(w) + let ondrain + let onfinish + let onreadable + let onclose + let d + function onfinished(err) { + const cb = onclose + onclose = null + if (cb) { + cb(err) + } else if (err) { + d.destroy(err) } - return readable - } - module.exports = from - - - /***/ }), - - /***/ 2854: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(26701) - const { EventEmitter: EE } = __webpack_require__(5939) - function Stream(opts) { - EE.call(this, opts) - } - ObjectSetPrototypeOf(Stream.prototype, EE.prototype) - ObjectSetPrototypeOf(Stream, EE) - Stream.prototype.pipe = function (dest, options) { - const source = this - function ondata(chunk) { - if (dest.writable && dest.write(chunk) === false && source.pause) { - source.pause() - } - } - source.on('data', ondata) - function ondrain() { - if (source.readable && source.resume) { - source.resume() - } - } - dest.on('drain', ondrain) - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend) - source.on('close', onclose) - } - let didOnEnd = false - function onend() { - if (didOnEnd) return - didOnEnd = true - dest.end() - } - function onclose() { - if (didOnEnd) return - didOnEnd = true - if (typeof dest.destroy === 'function') dest.destroy() - } - - // Don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup() - if (EE.listenerCount(this, 'error') === 0) { - this.emit('error', er) + } + + // TODO(ronag): Avoid double buffering. + // Implement Writable/Readable/Duplex traits. + // See, https://github.com/nodejs/node/pull/33515. + d = new Duplexify({ + // TODO (ronag): highWaterMark? + readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), + writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), + readable, + writable + }) + if (writable) { + eos(w, (err) => { + writable = false + if (err) { + destroyer(r, err) + } + onfinished(err) + }) + d._write = function (chunk, encoding, callback) { + if (w.write(chunk, encoding)) { + callback() + } else { + ondrain = callback } } - prependListener(source, 'error', onerror) - prependListener(dest, 'error', onerror) - - // Remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata) - dest.removeListener('drain', ondrain) - source.removeListener('end', onend) - source.removeListener('close', onclose) - source.removeListener('error', onerror) - dest.removeListener('error', onerror) - source.removeListener('end', cleanup) - source.removeListener('close', cleanup) - dest.removeListener('close', cleanup) - } - source.on('end', cleanup) - source.on('close', cleanup) - dest.on('close', cleanup) - dest.emit('pipe', source) - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest - } - function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) - else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) - else emitter._events[event] = [fn, emitter._events[event]] - } - module.exports = { - Stream, - prependListener - } - - - /***/ }), - - /***/ 57395: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - const { - codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, - AbortError - } = __webpack_require__(4213) - const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(99639) - const kWeakHandler = (__webpack_require__(26701).Symbol)('kWeak') - const { finished } = __webpack_require__(24597) - const staticCompose = __webpack_require__(65729) - const { addAbortSignalNoValidate } = __webpack_require__(29975) - const { isWritable, isNodeStream } = __webpack_require__(46342) - const { - ArrayPrototypePush, - MathFloor, - Number, - NumberIsNaN, - Promise, - PromiseReject, - PromisePrototypeThen, - Symbol - } = __webpack_require__(26701) - const kEmpty = Symbol('kEmpty') - const kEof = Symbol('kEof') - function compose(stream, options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - if (isNodeStream(stream) && !isWritable(stream)) { - throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') - } - const composedStream = staticCompose(this, stream) - if (options !== null && options !== undefined && options.signal) { - // Not validating as we already validated before - addAbortSignalNoValidate(options.signal, composedStream) - } - return composedStream - } - function map(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let concurrency = 1 - if ((options === null || options === undefined ? undefined : options.concurrency) != null) { - concurrency = MathFloor(options.concurrency) - } - validateInteger(concurrency, 'concurrency', 1) - return async function* map() { - var _options$signal, _options$signal2 - const ac = new AbortController() - const stream = this - const queue = [] - const signal = ac.signal - const signalOpt = { - signal + d._final = function (callback) { + w.end() + onfinish = callback + } + w.on('drain', function () { + if (ondrain) { + const cb = ondrain + ondrain = null + cb() } - const abort = () => ac.abort() - if ( - options !== null && - options !== undefined && - (_options$signal = options.signal) !== null && - _options$signal !== undefined && - _options$signal.aborted - ) { - abort() + }) + w.on('finish', function () { + if (onfinish) { + const cb = onfinish + onfinish = null + cb() } - options === null || options === undefined - ? undefined - : (_options$signal2 = options.signal) === null || _options$signal2 === undefined - ? undefined - : _options$signal2.addEventListener('abort', abort) - let next - let resume - let done = false - function onDone() { - done = true + }) + } + if (readable) { + eos(r, (err) => { + readable = false + if (err) { + destroyer(r, err) } - async function pump() { - try { - for await (let val of stream) { - var _val - if (done) { - return - } - if (signal.aborted) { - throw new AbortError() - } - try { - val = fn(val, signalOpt) - } catch (err) { - val = PromiseReject(err) - } - if (val === kEmpty) { - continue - } - if (typeof ((_val = val) === null || _val === undefined ? undefined : _val.catch) === 'function') { - val.catch(onDone) - } - queue.push(val) - if (next) { - next() - next = null - } - if (!done && queue.length && queue.length >= concurrency) { - await new Promise((resolve) => { - resume = resolve - }) - } - } - queue.push(kEof) - } catch (err) { - const val = PromiseReject(err) - PromisePrototypeThen(val, undefined, onDone) - queue.push(val) - } finally { - var _options$signal3 - done = true - if (next) { - next() - next = null - } - options === null || options === undefined - ? undefined - : (_options$signal3 = options.signal) === null || _options$signal3 === undefined - ? undefined - : _options$signal3.removeEventListener('abort', abort) - } + onfinished(err) + }) + r.on('readable', function () { + if (onreadable) { + const cb = onreadable + onreadable = null + cb() } - pump() - try { - while (true) { - while (queue.length > 0) { - const val = await queue[0] - if (val === kEof) { - return - } - if (signal.aborted) { - throw new AbortError() - } - if (val !== kEmpty) { - yield val - } - queue.shift() - if (resume) { - resume() - resume = null - } - } - await new Promise((resolve) => { - next = resolve - }) + }) + r.on('end', function () { + d.push(null) + }) + d._read = function () { + while (true) { + const buf = r.read() + if (buf === null) { + onreadable = d._read + return } - } finally { - ac.abort() - done = true - if (resume) { - resume() - resume = null + if (!d.push(buf)) { + return } } - }.call(this) + } } - function asIndexedPairs(options = undefined) { - if (options != null) { - validateObject(options, 'options') + d._destroy = function (err, callback) { + if (!err && onclose !== null) { + err = new AbortError() } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + onreadable = null + ondrain = null + onfinish = null + if (onclose === null) { + callback(err) + } else { + onclose = callback + destroyer(w, err) + destroyer(r, err) } - return async function* asIndexedPairs() { - let index = 0 - for await (const val of this) { - var _options$signal4 - if ( - options !== null && - options !== undefined && - (_options$signal4 = options.signal) !== null && - _options$signal4 !== undefined && - _options$signal4.aborted - ) { - throw new AbortError({ - cause: options.signal.reason - }) - } - yield [index++, val] - } - }.call(this) } - async function some(fn, options = undefined) { - for await (const unused of filter.call(this, fn, options)) { - return true + return d +} + + +/***/ }), + +/***/ 24597: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + +;('use strict') +const { AbortError, codes } = __webpack_require__(4213) +const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes +const { kEmptyObject, once } = __webpack_require__(72978) +const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(99639) +const { Promise, PromisePrototypeThen } = __webpack_require__(26701) +const { + isClosed, + isReadable, + isReadableNodeStream, + isReadableStream, + isReadableFinished, + isReadableErrored, + isWritable, + isWritableNodeStream, + isWritableStream, + isWritableFinished, + isWritableErrored, + isNodeStream, + willEmitClose: _willEmitClose, + kIsClosedPromise +} = __webpack_require__(46342) +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function' +} +const nop = () => {} +function eos(stream, options, callback) { + var _options$readable, _options$writable + if (arguments.length === 2) { + callback = options + options = kEmptyObject + } else if (options == null) { + options = kEmptyObject + } else { + validateObject(options, 'options') + } + validateFunction(callback, 'callback') + validateAbortSignal(options.signal, 'options.signal') + callback = once(callback) + if (isReadableStream(stream) || isWritableStream(stream)) { + return eosWeb(stream, options, callback) + } + if (!isNodeStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } + const readable = + (_options$readable = options.readable) !== null && _options$readable !== undefined + ? _options$readable + : isReadableNodeStream(stream) + const writable = + (_options$writable = options.writable) !== null && _options$writable !== undefined + ? _options$writable + : isWritableNodeStream(stream) + const wState = stream._writableState + const rState = stream._readableState + const onlegacyfinish = () => { + if (!stream.writable) { + onfinish() } - return false } - async function every(fn, options = undefined) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + + // TODO (ronag): Improve soft detection to include core modules and + // common ecosystem modules that do properly emit 'close' but fail + // this generic check. + let willEmitClose = + _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable + let writableFinished = isWritableFinished(stream, false) + const onfinish = () => { + writableFinished = true + // Stream should not be destroyed here. If it is that + // means that user space is doing something differently and + // we cannot trust willEmitClose. + if (stream.destroyed) { + willEmitClose = false + } + if (willEmitClose && (!stream.readable || readable)) { + return + } + if (!readable || readableFinished) { + callback.call(stream) } - // https://en.wikipedia.org/wiki/De_Morgan%27s_laws - return !(await some.call( - this, - async (...args) => { - return !(await fn(...args)) - }, - options - )) } - async function find(fn, options) { - for await (const result of filter.call(this, fn, options)) { - return result + let readableFinished = isReadableFinished(stream, false) + const onend = () => { + readableFinished = true + // Stream should not be destroyed here. If it is that + // means that user space is doing something differently and + // we cannot trust willEmitClose. + if (stream.destroyed) { + willEmitClose = false + } + if (willEmitClose && (!stream.writable || writable)) { + return + } + if (!writable || writableFinished) { + callback.call(stream) } - return undefined } - async function forEach(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + const onerror = (err) => { + callback.call(stream, err) + } + let closed = isClosed(stream) + const onclose = () => { + closed = true + const errored = isWritableErrored(stream) || isReadableErrored(stream) + if (errored && typeof errored !== 'boolean') { + return callback.call(stream, errored) } - async function forEachFn(value, options) { - await fn(value, options) - return kEmpty + if (readable && !readableFinished && isReadableNodeStream(stream, true)) { + if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) } - // eslint-disable-next-line no-unused-vars - for await (const unused of map.call(this, forEachFn, options)); + if (writable && !writableFinished) { + if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) + } + callback.call(stream) } - function filter(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + const onclosed = () => { + closed = true + const errored = isWritableErrored(stream) || isReadableErrored(stream) + if (errored && typeof errored !== 'boolean') { + return callback.call(stream, errored) } - async function filterFn(value, options) { - if (await fn(value, options)) { - return value + callback.call(stream) + } + const onrequest = () => { + stream.req.on('finish', onfinish) + } + if (isRequest(stream)) { + stream.on('complete', onfinish) + if (!willEmitClose) { + stream.on('abort', onclose) + } + if (stream.req) { + onrequest() + } else { + stream.on('request', onrequest) + } + } else if (writable && !wState) { + // legacy streams + stream.on('end', onlegacyfinish) + stream.on('close', onlegacyfinish) + } + + // Not all streams will emit 'close' after 'aborted'. + if (!willEmitClose && typeof stream.aborted === 'boolean') { + stream.on('aborted', onclose) + } + stream.on('end', onend) + stream.on('finish', onfinish) + if (options.error !== false) { + stream.on('error', onerror) + } + stream.on('close', onclose) + if (closed) { + process.nextTick(onclose) + } else if ( + (wState !== null && wState !== undefined && wState.errorEmitted) || + (rState !== null && rState !== undefined && rState.errorEmitted) + ) { + if (!willEmitClose) { + process.nextTick(onclosed) + } + } else if ( + !readable && + (!willEmitClose || isReadable(stream)) && + (writableFinished || isWritable(stream) === false) + ) { + process.nextTick(onclosed) + } else if ( + !writable && + (!willEmitClose || isWritable(stream)) && + (readableFinished || isReadable(stream) === false) + ) { + process.nextTick(onclosed) + } else if (rState && stream.req && stream.aborted) { + process.nextTick(onclosed) + } + const cleanup = () => { + callback = nop + stream.removeListener('aborted', onclose) + stream.removeListener('complete', onfinish) + stream.removeListener('abort', onclose) + stream.removeListener('request', onrequest) + if (stream.req) stream.req.removeListener('finish', onfinish) + stream.removeListener('end', onlegacyfinish) + stream.removeListener('close', onlegacyfinish) + stream.removeListener('finish', onfinish) + stream.removeListener('end', onend) + stream.removeListener('error', onerror) + stream.removeListener('close', onclose) + } + if (options.signal && !closed) { + const abort = () => { + // Keep it because cleanup removes it. + const endCallback = callback + cleanup() + endCallback.call( + stream, + new AbortError(undefined, { + cause: options.signal.reason + }) + ) + } + if (options.signal.aborted) { + process.nextTick(abort) + } else { + const originalCallback = callback + callback = once((...args) => { + options.signal.removeEventListener('abort', abort) + originalCallback.apply(stream, args) + }) + options.signal.addEventListener('abort', abort) + } + } + return cleanup +} +function eosWeb(stream, options, callback) { + let isAborted = false + let abort = nop + if (options.signal) { + abort = () => { + isAborted = true + callback.call( + stream, + new AbortError(undefined, { + cause: options.signal.reason + }) + ) + } + if (options.signal.aborted) { + process.nextTick(abort) + } else { + const originalCallback = callback + callback = once((...args) => { + options.signal.removeEventListener('abort', abort) + originalCallback.apply(stream, args) + }) + options.signal.addEventListener('abort', abort) + } + } + const resolverFn = (...args) => { + if (!isAborted) { + process.nextTick(() => callback.apply(stream, args)) + } + } + PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) + return nop +} +function finished(stream, opts) { + var _opts + let autoCleanup = false + if (opts === null) { + opts = kEmptyObject + } + if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { + validateBoolean(opts.cleanup, 'cleanup') + autoCleanup = opts.cleanup + } + return new Promise((resolve, reject) => { + const cleanup = eos(stream, opts, (err) => { + if (autoCleanup) { + cleanup() + } + if (err) { + reject(err) + } else { + resolve() + } + }) + }) +} +module.exports = eos +module.exports.finished = finished + + +/***/ }), + +/***/ 54562: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ + +const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(26701) +const { Buffer } = __webpack_require__(2486) +const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(4213).codes) +function from(Readable, iterable, opts) { + let iterator + if (typeof iterable === 'string' || iterable instanceof Buffer) { + return new Readable({ + objectMode: true, + ...opts, + read() { + this.push(iterable) + this.push(null) } - return kEmpty + }) + } + let isAsync + if (iterable && iterable[SymbolAsyncIterator]) { + isAsync = true + iterator = iterable[SymbolAsyncIterator]() + } else if (iterable && iterable[SymbolIterator]) { + isAsync = false + iterator = iterable[SymbolIterator]() + } else { + throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) + } + const readable = new Readable({ + objectMode: true, + highWaterMark: 1, + // TODO(ronag): What options should be allowed? + ...opts + }) + + // Flag to protect against _read + // being called before last iteration completion. + let reading = false + readable._read = function () { + if (!reading) { + reading = true + next() } - return map.call(this, filterFn, options) } - - // Specific to provide better error to reduce since the argument is only - // missing if the stream has no items in it - but the code is still appropriate - class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { - constructor() { - super('reduce') - this.message = 'Reduce of an empty stream requires an initial value' + readable._destroy = function (error, cb) { + PromisePrototypeThen( + close(error), + () => process.nextTick(cb, error), + // nextTick is here in case cb throws + (e) => process.nextTick(cb, e || error) + ) + } + async function close(error) { + const hadError = error !== undefined && error !== null + const hasThrow = typeof iterator.throw === 'function' + if (hadError && hasThrow) { + const { value, done } = await iterator.throw(error) + await value + if (done) { + return + } + } + if (typeof iterator.return === 'function') { + const { value } = await iterator.return() + await value } } - async function reduce(reducer, initialValue, options) { - var _options$signal5 - if (typeof reducer !== 'function') { - throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) + async function next() { + for (;;) { + try { + const { value, done } = isAsync ? await iterator.next() : iterator.next() + if (done) { + readable.push(null) + } else { + const res = value && typeof value.then === 'function' ? await value : value + if (res === null) { + reading = false + throw new ERR_STREAM_NULL_VALUES() + } else if (readable.push(res)) { + continue + } else { + reading = false + } + } + } catch (err) { + readable.destroy(err) + } + break } - if (options != null) { - validateObject(options, 'options') + } + return readable +} +module.exports = from + + +/***/ }), + +/***/ 2854: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(26701) +const { EventEmitter: EE } = __webpack_require__(5939) +function Stream(opts) { + EE.call(this, opts) +} +ObjectSetPrototypeOf(Stream.prototype, EE.prototype) +ObjectSetPrototypeOf(Stream, EE) +Stream.prototype.pipe = function (dest, options) { + const source = this + function ondata(chunk) { + if (dest.writable && dest.write(chunk) === false && source.pause) { + source.pause() + } + } + source.on('data', ondata) + function ondrain() { + if (source.readable && source.resume) { + source.resume() + } + } + dest.on('drain', ondrain) + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend) + source.on('close', onclose) + } + let didOnEnd = false + function onend() { + if (didOnEnd) return + didOnEnd = true + dest.end() + } + function onclose() { + if (didOnEnd) return + didOnEnd = true + if (typeof dest.destroy === 'function') dest.destroy() + } + + // Don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup() + if (EE.listenerCount(this, 'error') === 0) { + this.emit('error', er) } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + } + prependListener(source, 'error', onerror) + prependListener(dest, 'error', onerror) + + // Remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata) + dest.removeListener('drain', ondrain) + source.removeListener('end', onend) + source.removeListener('close', onclose) + source.removeListener('error', onerror) + dest.removeListener('error', onerror) + source.removeListener('end', cleanup) + source.removeListener('close', cleanup) + dest.removeListener('close', cleanup) + } + source.on('end', cleanup) + source.on('close', cleanup) + dest.on('close', cleanup) + dest.emit('pipe', source) + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest +} +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) + else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) + else emitter._events[event] = [fn, emitter._events[event]] +} +module.exports = { + Stream, + prependListener +} + + +/***/ }), + +/***/ 57395: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +const { + codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, + AbortError +} = __webpack_require__(4213) +const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(99639) +const kWeakHandler = (__webpack_require__(26701).Symbol)('kWeak') +const { finished } = __webpack_require__(24597) +const staticCompose = __webpack_require__(65729) +const { addAbortSignalNoValidate } = __webpack_require__(29975) +const { isWritable, isNodeStream } = __webpack_require__(46342) +const { + ArrayPrototypePush, + MathFloor, + Number, + NumberIsNaN, + Promise, + PromiseReject, + PromisePrototypeThen, + Symbol +} = __webpack_require__(26701) +const kEmpty = Symbol('kEmpty') +const kEof = Symbol('kEof') +function compose(stream, options) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + if (isNodeStream(stream) && !isWritable(stream)) { + throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') + } + const composedStream = staticCompose(this, stream) + if (options !== null && options !== undefined && options.signal) { + // Not validating as we already validated before + addAbortSignalNoValidate(options.signal, composedStream) + } + return composedStream +} +function map(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + let concurrency = 1 + if ((options === null || options === undefined ? undefined : options.concurrency) != null) { + concurrency = MathFloor(options.concurrency) + } + validateInteger(concurrency, 'concurrency', 1) + return async function* map() { + var _options$signal, _options$signal2 + const ac = new AbortController() + const stream = this + const queue = [] + const signal = ac.signal + const signalOpt = { + signal } - let hasInitialValue = arguments.length > 1 + const abort = () => ac.abort() if ( options !== null && options !== undefined && - (_options$signal5 = options.signal) !== null && - _options$signal5 !== undefined && - _options$signal5.aborted + (_options$signal = options.signal) !== null && + _options$signal !== undefined && + _options$signal.aborted ) { - const err = new AbortError(undefined, { - cause: options.signal.reason - }) - this.once('error', () => {}) // The error is already propagated - await finished(this.destroy(err)) - throw err - } - const ac = new AbortController() - const signal = ac.signal - if (options !== null && options !== undefined && options.signal) { - const opts = { - once: true, - [kWeakHandler]: this + abort() + } + options === null || options === undefined + ? undefined + : (_options$signal2 = options.signal) === null || _options$signal2 === undefined + ? undefined + : _options$signal2.addEventListener('abort', abort) + let next + let resume + let done = false + function onDone() { + done = true + } + async function pump() { + try { + for await (let val of stream) { + var _val + if (done) { + return + } + if (signal.aborted) { + throw new AbortError() + } + try { + val = fn(val, signalOpt) + } catch (err) { + val = PromiseReject(err) + } + if (val === kEmpty) { + continue + } + if (typeof ((_val = val) === null || _val === undefined ? undefined : _val.catch) === 'function') { + val.catch(onDone) + } + queue.push(val) + if (next) { + next() + next = null + } + if (!done && queue.length && queue.length >= concurrency) { + await new Promise((resolve) => { + resume = resolve + }) + } + } + queue.push(kEof) + } catch (err) { + const val = PromiseReject(err) + PromisePrototypeThen(val, undefined, onDone) + queue.push(val) + } finally { + var _options$signal3 + done = true + if (next) { + next() + next = null + } + options === null || options === undefined + ? undefined + : (_options$signal3 = options.signal) === null || _options$signal3 === undefined + ? undefined + : _options$signal3.removeEventListener('abort', abort) } - options.signal.addEventListener('abort', () => ac.abort(), opts) } - let gotAnyItemFromStream = false + pump() try { - for await (const value of this) { - var _options$signal6 - gotAnyItemFromStream = true - if ( - options !== null && - options !== undefined && - (_options$signal6 = options.signal) !== null && - _options$signal6 !== undefined && - _options$signal6.aborted - ) { - throw new AbortError() - } - if (!hasInitialValue) { - initialValue = value - hasInitialValue = true - } else { - initialValue = await reducer(initialValue, value, { - signal - }) + while (true) { + while (queue.length > 0) { + const val = await queue[0] + if (val === kEof) { + return + } + if (signal.aborted) { + throw new AbortError() + } + if (val !== kEmpty) { + yield val + } + queue.shift() + if (resume) { + resume() + resume = null + } } - } - if (!gotAnyItemFromStream && !hasInitialValue) { - throw new ReduceAwareErrMissingArgs() + await new Promise((resolve) => { + next = resolve + }) } } finally { ac.abort() + done = true + if (resume) { + resume() + resume = null + } } - return initialValue + }.call(this) +} +function asIndexedPairs(options = undefined) { + if (options != null) { + validateObject(options, 'options') } - async function toArray(options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - const result = [] + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + return async function* asIndexedPairs() { + let index = 0 for await (const val of this) { - var _options$signal7 + var _options$signal4 if ( options !== null && options !== undefined && - (_options$signal7 = options.signal) !== null && - _options$signal7 !== undefined && - _options$signal7.aborted + (_options$signal4 = options.signal) !== null && + _options$signal4 !== undefined && + _options$signal4.aborted ) { - throw new AbortError(undefined, { + throw new AbortError({ cause: options.signal.reason }) } - ArrayPrototypePush(result, val) + yield [index++, val] } + }.call(this) +} +async function some(fn, options = undefined) { + for await (const unused of filter.call(this, fn, options)) { + return true + } + return false +} +async function every(fn, options = undefined) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + // https://en.wikipedia.org/wiki/De_Morgan%27s_laws + return !(await some.call( + this, + async (...args) => { + return !(await fn(...args)) + }, + options + )) +} +async function find(fn, options) { + for await (const result of filter.call(this, fn, options)) { return result } - function flatMap(fn, options) { - const values = map.call(this, fn, options) - return async function* flatMap() { - for await (const val of values) { - yield* val - } - }.call(this) + return undefined +} +async function forEach(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) } - function toIntegerOrInfinity(number) { - // We coerce here to align with the spec - // https://github.com/tc39/proposal-iterator-helpers/issues/169 - number = Number(number) - if (NumberIsNaN(number)) { - return 0 - } - if (number < 0) { - throw new ERR_OUT_OF_RANGE('number', '>= 0', number) - } - return number + async function forEachFn(value, options) { + await fn(value, options) + return kEmpty } - function drop(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') + // eslint-disable-next-line no-unused-vars + for await (const unused of map.call(this, forEachFn, options)); +} +function filter(fn, options) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) + } + async function filterFn(value, options) { + if (await fn(value, options)) { + return value } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + return kEmpty + } + return map.call(this, filterFn, options) +} + +// Specific to provide better error to reduce since the argument is only +// missing if the stream has no items in it - but the code is still appropriate +class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { + constructor() { + super('reduce') + this.message = 'Reduce of an empty stream requires an initial value' + } +} +async function reduce(reducer, initialValue, options) { + var _options$signal5 + if (typeof reducer !== 'function') { + throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) + } + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + let hasInitialValue = arguments.length > 1 + if ( + options !== null && + options !== undefined && + (_options$signal5 = options.signal) !== null && + _options$signal5 !== undefined && + _options$signal5.aborted + ) { + const err = new AbortError(undefined, { + cause: options.signal.reason + }) + this.once('error', () => {}) // The error is already propagated + await finished(this.destroy(err)) + throw err + } + const ac = new AbortController() + const signal = ac.signal + if (options !== null && options !== undefined && options.signal) { + const opts = { + once: true, + [kWeakHandler]: this } - number = toIntegerOrInfinity(number) - return async function* drop() { - var _options$signal8 + options.signal.addEventListener('abort', () => ac.abort(), opts) + } + let gotAnyItemFromStream = false + try { + for await (const value of this) { + var _options$signal6 + gotAnyItemFromStream = true if ( options !== null && options !== undefined && - (_options$signal8 = options.signal) !== null && - _options$signal8 !== undefined && - _options$signal8.aborted + (_options$signal6 = options.signal) !== null && + _options$signal6 !== undefined && + _options$signal6.aborted ) { throw new AbortError() } - for await (const val of this) { - var _options$signal9 - if ( - options !== null && - options !== undefined && - (_options$signal9 = options.signal) !== null && - _options$signal9 !== undefined && - _options$signal9.aborted - ) { - throw new AbortError() - } - if (number-- <= 0) { - yield val - } + if (!hasInitialValue) { + initialValue = value + hasInitialValue = true + } else { + initialValue = await reducer(initialValue, value, { + signal + }) } - }.call(this) + } + if (!gotAnyItemFromStream && !hasInitialValue) { + throw new ReduceAwareErrMissingArgs() + } + } finally { + ac.abort() + } + return initialValue +} +async function toArray(options) { + if (options != null) { + validateObject(options, 'options') } - function take(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + const result = [] + for await (const val of this) { + var _options$signal7 + if ( + options !== null && + options !== undefined && + (_options$signal7 = options.signal) !== null && + _options$signal7 !== undefined && + _options$signal7.aborted + ) { + throw new AbortError(undefined, { + cause: options.signal.reason + }) } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') + ArrayPrototypePush(result, val) + } + return result +} +function flatMap(fn, options) { + const values = map.call(this, fn, options) + return async function* flatMap() { + for await (const val of values) { + yield* val + } + }.call(this) +} +function toIntegerOrInfinity(number) { + // We coerce here to align with the spec + // https://github.com/tc39/proposal-iterator-helpers/issues/169 + number = Number(number) + if (NumberIsNaN(number)) { + return 0 + } + if (number < 0) { + throw new ERR_OUT_OF_RANGE('number', '>= 0', number) + } + return number +} +function drop(number, options = undefined) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + number = toIntegerOrInfinity(number) + return async function* drop() { + var _options$signal8 + if ( + options !== null && + options !== undefined && + (_options$signal8 = options.signal) !== null && + _options$signal8 !== undefined && + _options$signal8.aborted + ) { + throw new AbortError() } - number = toIntegerOrInfinity(number) - return async function* take() { - var _options$signal10 + for await (const val of this) { + var _options$signal9 if ( options !== null && options !== undefined && - (_options$signal10 = options.signal) !== null && - _options$signal10 !== undefined && - _options$signal10.aborted + (_options$signal9 = options.signal) !== null && + _options$signal9 !== undefined && + _options$signal9.aborted ) { throw new AbortError() } - for await (const val of this) { - var _options$signal11 - if ( - options !== null && - options !== undefined && - (_options$signal11 = options.signal) !== null && - _options$signal11 !== undefined && - _options$signal11.aborted - ) { - throw new AbortError() - } - if (number-- > 0) { - yield val - } else { - return - } + if (number-- <= 0) { + yield val } - }.call(this) + } + }.call(this) +} +function take(number, options = undefined) { + if (options != null) { + validateObject(options, 'options') } - module.exports.streamReturningOperators = { - asIndexedPairs, - drop, - filter, - flatMap, - map, - take, - compose - } - module.exports.promiseReturningOperators = { - every, - forEach, - reduce, - toArray, - some, - find - } - - - /***/ }), - - /***/ 38368: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a passthrough stream. - // basically just the most minimal sort of Transform stream. - // Every written chunk gets output as-is. - - - - const { ObjectSetPrototypeOf } = __webpack_require__(26701) - module.exports = PassThrough - const Transform = __webpack_require__(57425) - ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) - ObjectSetPrototypeOf(PassThrough, Transform) - function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options) - Transform.call(this, options) - } - PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk) - } - - - /***/ }), - - /***/ 33939: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // Ported from https://github.com/mafintosh/pump with - // permission from the author, Mathias Buus (@mafintosh). - - ;('use strict') - const { ArrayIsArray, Promise, SymbolAsyncIterator } = __webpack_require__(26701) - const eos = __webpack_require__(24597) - const { once } = __webpack_require__(72978) - const destroyImpl = __webpack_require__(92573) - const Duplex = __webpack_require__(35960) - const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_INVALID_RETURN_VALUE, - ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED, - ERR_STREAM_PREMATURE_CLOSE - }, - AbortError - } = __webpack_require__(4213) - const { validateFunction, validateAbortSignal } = __webpack_require__(99639) - const { - isIterable, - isReadable, - isReadableNodeStream, - isNodeStream, - isTransformStream, - isWebStream, - isReadableStream, - isReadableEnded - } = __webpack_require__(46342) - const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) - let PassThrough - let Readable - function destroyer(stream, reading, writing) { - let finished = false - stream.on('close', () => { - finished = true - }) - const cleanup = eos( - stream, - { - readable: reading, - writable: writing - }, - (err) => { - finished = !err - } - ) - return { - destroy: (err) => { - if (finished) return - finished = true - destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) - }, - cleanup - } - } - function popCallback(streams) { - // Streams should never be an empty array. It should always contain at least - // a single stream. Therefore optimize for the average case instead of - // checking for length === 0 as well. - validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') - return streams.pop() - } - function makeAsyncIterable(val) { - if (isIterable(val)) { - return val - } else if (isReadableNodeStream(val)) { - // Legacy streams are not Iterable. - return fromReadable(val) - } - throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') } - async function* fromReadable(val) { - if (!Readable) { - Readable = __webpack_require__(3845) + number = toIntegerOrInfinity(number) + return async function* take() { + var _options$signal10 + if ( + options !== null && + options !== undefined && + (_options$signal10 = options.signal) !== null && + _options$signal10 !== undefined && + _options$signal10.aborted + ) { + throw new AbortError() } - yield* Readable.prototype[SymbolAsyncIterator].call(val) - } - async function pumpToNode(iterable, writable, finish, { end }) { - let error - let onresolve = null - const resume = (err) => { - if (err) { - error = err + for await (const val of this) { + var _options$signal11 + if ( + options !== null && + options !== undefined && + (_options$signal11 = options.signal) !== null && + _options$signal11 !== undefined && + _options$signal11.aborted + ) { + throw new AbortError() } - if (onresolve) { - const callback = onresolve - onresolve = null - callback() + if (number-- > 0) { + yield val + } else { + return } } - const wait = () => - new Promise((resolve, reject) => { - if (error) { - reject(error) - } else { - onresolve = () => { - if (error) { - reject(error) - } else { - resolve() - } + }.call(this) +} +module.exports.streamReturningOperators = { + asIndexedPairs, + drop, + filter, + flatMap, + map, + take, + compose +} +module.exports.promiseReturningOperators = { + every, + forEach, + reduce, + toArray, + some, + find +} + + +/***/ }), + +/***/ 38368: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +const { ObjectSetPrototypeOf } = __webpack_require__(26701) +module.exports = PassThrough +const Transform = __webpack_require__(57425) +ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) +ObjectSetPrototypeOf(PassThrough, Transform) +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options) + Transform.call(this, options) +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk) +} + + +/***/ }), + +/***/ 33939: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + +;('use strict') +const { ArrayIsArray, Promise, SymbolAsyncIterator } = __webpack_require__(26701) +const eos = __webpack_require__(24597) +const { once } = __webpack_require__(72978) +const destroyImpl = __webpack_require__(92573) +const Duplex = __webpack_require__(35960) +const { + aggregateTwoErrors, + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_RETURN_VALUE, + ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED, + ERR_STREAM_PREMATURE_CLOSE + }, + AbortError +} = __webpack_require__(4213) +const { validateFunction, validateAbortSignal } = __webpack_require__(99639) +const { + isIterable, + isReadable, + isReadableNodeStream, + isNodeStream, + isTransformStream, + isWebStream, + isReadableStream, + isReadableEnded +} = __webpack_require__(46342) +const AbortController = globalThis.AbortController || (__webpack_require__(83392).AbortController) +let PassThrough +let Readable +function destroyer(stream, reading, writing) { + let finished = false + stream.on('close', () => { + finished = true + }) + const cleanup = eos( + stream, + { + readable: reading, + writable: writing + }, + (err) => { + finished = !err + } + ) + return { + destroy: (err) => { + if (finished) return + finished = true + destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) + }, + cleanup + } +} +function popCallback(streams) { + // Streams should never be an empty array. It should always contain at least + // a single stream. Therefore optimize for the average case instead of + // checking for length === 0 as well. + validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') + return streams.pop() +} +function makeAsyncIterable(val) { + if (isIterable(val)) { + return val + } else if (isReadableNodeStream(val)) { + // Legacy streams are not Iterable. + return fromReadable(val) + } + throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) +} +async function* fromReadable(val) { + if (!Readable) { + Readable = __webpack_require__(3845) + } + yield* Readable.prototype[SymbolAsyncIterator].call(val) +} +async function pumpToNode(iterable, writable, finish, { end }) { + let error + let onresolve = null + const resume = (err) => { + if (err) { + error = err + } + if (onresolve) { + const callback = onresolve + onresolve = null + callback() + } + } + const wait = () => + new Promise((resolve, reject) => { + if (error) { + reject(error) + } else { + onresolve = () => { + if (error) { + reject(error) + } else { + resolve() } } - }) - writable.on('drain', resume) - const cleanup = eos( - writable, - { - readable: false - }, - resume - ) - try { - if (writable.writableNeedDrain) { - await wait() - } - for await (const chunk of iterable) { - if (!writable.write(chunk)) { - await wait() - } - } - if (end) { - writable.end() } + }) + writable.on('drain', resume) + const cleanup = eos( + writable, + { + readable: false + }, + resume + ) + try { + if (writable.writableNeedDrain) { await wait() - finish() - } catch (err) { - finish(error !== err ? aggregateTwoErrors(error, err) : err) - } finally { - cleanup() - writable.off('drain', resume) - } - } - async function pumpToWeb(readable, writable, finish, { end }) { - if (isTransformStream(writable)) { - writable = writable.writable } - // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure - const writer = writable.getWriter() - try { - for await (const chunk of readable) { - await writer.ready - writer.write(chunk).catch(() => {}) + for await (const chunk of iterable) { + if (!writable.write(chunk)) { + await wait() } + } + if (end) { + writable.end() + } + await wait() + finish() + } catch (err) { + finish(error !== err ? aggregateTwoErrors(error, err) : err) + } finally { + cleanup() + writable.off('drain', resume) + } +} +async function pumpToWeb(readable, writable, finish, { end }) { + if (isTransformStream(writable)) { + writable = writable.writable + } + // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure + const writer = writable.getWriter() + try { + for await (const chunk of readable) { await writer.ready - if (end) { - await writer.close() - } - finish() + writer.write(chunk).catch(() => {}) + } + await writer.ready + if (end) { + await writer.close() + } + finish() + } catch (err) { + try { + await writer.abort(err) + finish(err) } catch (err) { - try { - await writer.abort(err) - finish(err) - } catch (err) { - finish(err) - } + finish(err) } } - function pipeline(...streams) { - return pipelineImpl(streams, once(popCallback(streams))) +} +function pipeline(...streams) { + return pipelineImpl(streams, once(popCallback(streams))) +} +function pipelineImpl(streams, callback, opts) { + if (streams.length === 1 && ArrayIsArray(streams[0])) { + streams = streams[0] + } + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams') } - function pipelineImpl(streams, callback, opts) { - if (streams.length === 1 && ArrayIsArray(streams[0])) { - streams = streams[0] + const ac = new AbortController() + const signal = ac.signal + const outerSignal = opts === null || opts === undefined ? undefined : opts.signal + + // Need to cleanup event listeners if last stream is readable + // https://github.com/nodejs/node/issues/35452 + const lastStreamCleanup = [] + validateAbortSignal(outerSignal, 'options.signal') + function abort() { + finishImpl(new AbortError()) + } + outerSignal === null || outerSignal === undefined ? undefined : outerSignal.addEventListener('abort', abort) + let error + let value + const destroys = [] + let finishCount = 0 + function finish(err) { + finishImpl(err, --finishCount === 0) + } + function finishImpl(err, final) { + if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { + error = err + } + if (!error && !final) { + return } - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams') + while (destroys.length) { + destroys.shift()(error) } - const ac = new AbortController() - const signal = ac.signal - const outerSignal = opts === null || opts === undefined ? undefined : opts.signal - - // Need to cleanup event listeners if last stream is readable - // https://github.com/nodejs/node/issues/35452 - const lastStreamCleanup = [] - validateAbortSignal(outerSignal, 'options.signal') - function abort() { - finishImpl(new AbortError()) - } - outerSignal === null || outerSignal === undefined ? undefined : outerSignal.addEventListener('abort', abort) - let error - let value - const destroys = [] - let finishCount = 0 - function finish(err) { - finishImpl(err, --finishCount === 0) - } - function finishImpl(err, final) { - if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { - error = err - } - if (!error && !final) { - return + outerSignal === null || outerSignal === undefined ? undefined : outerSignal.removeEventListener('abort', abort) + ac.abort() + if (final) { + if (!error) { + lastStreamCleanup.forEach((fn) => fn()) } - while (destroys.length) { - destroys.shift()(error) + process.nextTick(callback, error, value) + } + } + let ret + for (let i = 0; i < streams.length; i++) { + const stream = streams[i] + const reading = i < streams.length - 1 + const writing = i > 0 + const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false + const isLastStream = i === streams.length - 1 + if (isNodeStream(stream)) { + if (end) { + const { destroy, cleanup } = destroyer(stream, reading, writing) + destroys.push(destroy) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(cleanup) + } } - outerSignal === null || outerSignal === undefined ? undefined : outerSignal.removeEventListener('abort', abort) - ac.abort() - if (final) { - if (!error) { - lastStreamCleanup.forEach((fn) => fn()) + + // Catch stream errors that occur after pipe/pump has completed. + function onError(err) { + if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + finish(err) } - process.nextTick(callback, error, value) + } + stream.on('error', onError) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(() => { + stream.removeListener('error', onError) + }) } } - let ret - for (let i = 0; i < streams.length; i++) { - const stream = streams[i] - const reading = i < streams.length - 1 - const writing = i > 0 - const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false - const isLastStream = i === streams.length - 1 - if (isNodeStream(stream)) { - if (end) { - const { destroy, cleanup } = destroyer(stream, reading, writing) - destroys.push(destroy) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - - // Catch stream errors that occur after pipe/pump has completed. - function onError(err) { - if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - finish(err) - } - } - stream.on('error', onError) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(() => { - stream.removeListener('error', onError) - }) + if (i === 0) { + if (typeof stream === 'function') { + ret = stream({ + signal + }) + if (!isIterable(ret)) { + throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) } + } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { + ret = stream + } else { + ret = Duplex.from(stream) } - if (i === 0) { - if (typeof stream === 'function') { - ret = stream({ - signal - }) - if (!isIterable(ret)) { - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) - } - } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { - ret = stream - } else { - ret = Duplex.from(stream) + } else if (typeof stream === 'function') { + if (isTransformStream(ret)) { + var _ret + ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) + } else { + ret = makeAsyncIterable(ret) + } + ret = stream(ret, { + signal + }) + if (reading) { + if (!isIterable(ret, true)) { + throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) } - } else if (typeof stream === 'function') { - if (isTransformStream(ret)) { - var _ret - ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) - } else { - ret = makeAsyncIterable(ret) + } else { + var _ret2 + if (!PassThrough) { + PassThrough = __webpack_require__(38368) } - ret = stream(ret, { - signal + + // If the last argument to pipeline is not a stream + // we must create a proxy stream so that pipeline(...) + // always returns a stream which can be further + // composed through `.pipe(stream)`. + + const pt = new PassThrough({ + objectMode: true }) - if (reading) { - if (!isIterable(ret, true)) { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) - } - } else { - var _ret2 - if (!PassThrough) { - PassThrough = __webpack_require__(38368) - } - - // If the last argument to pipeline is not a stream - // we must create a proxy stream so that pipeline(...) - // always returns a stream which can be further - // composed through `.pipe(stream)`. - - const pt = new PassThrough({ - objectMode: true - }) - - // Handle Promises/A+ spec, `then` could be a getter that throws on - // second use. - const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then - if (typeof then === 'function') { - finishCount++ - then.call( - ret, - (val) => { - value = val - if (val != null) { - pt.write(val) - } - if (end) { - pt.end() - } - process.nextTick(finish) - }, - (err) => { - pt.destroy(err) - process.nextTick(finish, err) - } - ) - } else if (isIterable(ret, true)) { - finishCount++ - pumpToNode(ret, pt, finish, { - end - }) - } else if (isReadableStream(ret) || isTransformStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, pt, finish, { - end - }) - } else { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) - } - ret = pt - const { destroy, cleanup } = destroyer(ret, false, true) - destroys.push(destroy) - if (isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - } else if (isNodeStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount += 2 - const cleanup = pipe(ret, stream, finish, { - end - }) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } else if (isTransformStream(ret) || isReadableStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, stream, finish, { - end - }) - } else if (isIterable(ret)) { + + // Handle Promises/A+ spec, `then` could be a getter that throws on + // second use. + const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then + if (typeof then === 'function') { finishCount++ - pumpToNode(ret, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret + then.call( + ret, + (val) => { + value = val + if (val != null) { + pt.write(val) + } + if (end) { + pt.end() + } + process.nextTick(finish) + }, + (err) => { + pt.destroy(err) + process.nextTick(finish, err) + } ) - } - ret = stream - } else if (isWebStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount++ - pumpToWeb(makeAsyncIterable(ret), stream, finish, { - end - }) - } else if (isReadableStream(ret) || isIterable(ret)) { + } else if (isIterable(ret, true)) { finishCount++ - pumpToWeb(ret, stream, finish, { + pumpToNode(ret, pt, finish, { end }) - } else if (isTransformStream(ret)) { + } else if (isReadableStream(ret) || isTransformStream(ret)) { + const toRead = ret.readable || ret finishCount++ - pumpToWeb(ret.readable, stream, finish, { + pumpToNode(toRead, pt, finish, { end }) } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) + throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) + } + ret = pt + const { destroy, cleanup } = destroyer(ret, false, true) + destroys.push(destroy) + if (isLastStream) { + lastStreamCleanup.push(cleanup) } - ret = stream - } else { - ret = Duplex.from(stream) } - } - if ( - (signal !== null && signal !== undefined && signal.aborted) || - (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) - ) { - process.nextTick(abort) - } - return ret - } - function pipe(src, dst, finish, { end }) { - let ended = false - dst.on('close', () => { - if (!ended) { - // Finish if the destination closes before the source has completed. - finish(new ERR_STREAM_PREMATURE_CLOSE()) + } else if (isNodeStream(stream)) { + if (isReadableNodeStream(ret)) { + finishCount += 2 + const cleanup = pipe(ret, stream, finish, { + end + }) + if (isReadable(stream) && isLastStream) { + lastStreamCleanup.push(cleanup) + } + } else if (isTransformStream(ret) || isReadableStream(ret)) { + const toRead = ret.readable || ret + finishCount++ + pumpToNode(toRead, stream, finish, { + end + }) + } else if (isIterable(ret)) { + finishCount++ + pumpToNode(ret, stream, finish, { + end + }) + } else { + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) } - }) - src.pipe(dst, { - end: false - }) // If end is true we already will have a listener to end dst. - - if (end) { - // Compat. Before node v10.12.0 stdio used to throw an error so - // pipe() did/does not end() stdio destinations. - // Now they allow it but "secretly" don't close the underlying fd. - - function endFn() { - ended = true - dst.end() - } - if (isReadableEnded(src)) { - // End the destination if the source has already ended. - process.nextTick(endFn) + ret = stream + } else if (isWebStream(stream)) { + if (isReadableNodeStream(ret)) { + finishCount++ + pumpToWeb(makeAsyncIterable(ret), stream, finish, { + end + }) + } else if (isReadableStream(ret) || isIterable(ret)) { + finishCount++ + pumpToWeb(ret, stream, finish, { + end + }) + } else if (isTransformStream(ret)) { + finishCount++ + pumpToWeb(ret.readable, stream, finish, { + end + }) } else { - src.once('end', endFn) + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) } + ret = stream } else { - finish() + ret = Duplex.from(stream) } - eos( - src, - { - readable: true, - writable: false - }, - (err) => { - const rState = src._readableState - if ( - err && - err.code === 'ERR_STREAM_PREMATURE_CLOSE' && - rState && - rState.ended && - !rState.errored && - !rState.errorEmitted - ) { - // Some readable streams will emit 'close' before 'end'. However, since - // this is on the readable side 'end' should still be emitted if the - // stream has been ended and no error emitted. This should be allowed in - // favor of backwards compatibility. Since the stream is piped to a - // destination this should not result in any observable difference. - // We don't need to check if this is a writable premature close since - // eos will only fail with premature close on the reading side for - // duplex streams. - src.once('end', finish).once('error', finish) - } else { - finish(err) - } - } - ) - return eos( - dst, - { - readable: false, - writable: true - }, - finish - ) } - module.exports = { - pipelineImpl, - pipeline - } - - - /***/ }), - - /***/ 3845: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // 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') - const { - ArrayPrototypeIndexOf, - NumberIsInteger, - NumberIsNaN, - NumberParseInt, - ObjectDefineProperties, - ObjectKeys, - ObjectSetPrototypeOf, - Promise, - SafeSet, - SymbolAsyncIterator, - Symbol - } = __webpack_require__(26701) - module.exports = Readable - Readable.ReadableState = ReadableState - const { EventEmitter: EE } = __webpack_require__(5939) - const { Stream, prependListener } = __webpack_require__(2854) - const { Buffer } = __webpack_require__(2486) - const { addAbortSignal } = __webpack_require__(29975) - const eos = __webpack_require__(24597) - let debug = (__webpack_require__(72978).debuglog)('stream', (fn) => { - debug = fn + if ( + (signal !== null && signal !== undefined && signal.aborted) || + (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) + ) { + process.nextTick(abort) + } + return ret +} +function pipe(src, dst, finish, { end }) { + let ended = false + dst.on('close', () => { + if (!ended) { + // Finish if the destination closes before the source has completed. + finish(new ERR_STREAM_PREMATURE_CLOSE()) + } }) - const BufferList = __webpack_require__(51085) - const destroyImpl = __webpack_require__(92573) - const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(94263) - const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_OUT_OF_RANGE, - ERR_STREAM_PUSH_AFTER_EOF, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT - } - } = __webpack_require__(4213) - const { validateObject } = __webpack_require__(99639) - const kPaused = Symbol('kPaused') - const { StringDecoder } = __webpack_require__(10301) - const from = __webpack_require__(54562) - ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) - ObjectSetPrototypeOf(Readable, Stream) - const nop = () => {} - const { errorOrDestroy } = destroyImpl - function ReadableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(35960) - - // Object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.readableObjectMode) - - // The point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = options - ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift(). - this.buffer = new BufferList() - this.length = 0 - this.pipes = [] - this.flowing = null - this.ended = false - this.endEmitted = false - this.reading = false - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // A flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true - - // Whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false - this.emittedReadable = false - this.readableListening = false - this.resumeScheduled = false - this[kPaused] = null - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'end' (and potentially 'finish'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Has it been destroyed. - this.destroyed = false - - // Indicates whether the stream has errored. When true no further - // _read calls, 'data' or 'readable' events should occur. This is needed - // since when autoDestroy is disabled we need a way to tell whether the - // stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Ref the piped dest which we need a drain event on it - // type: null | Writable | Set. - this.awaitDrainWriters = null - this.multiAwaitDrain = false - - // If true, a maybeReadMore has been scheduled. - this.readingMore = false - this.dataEmitted = false - this.decoder = null - this.encoding = null - if (options && options.encoding) { - this.decoder = new StringDecoder(options.encoding) - this.encoding = options.encoding - } - } - function Readable(options) { - if (!(this instanceof Readable)) return new Readable(options) - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(35960) - this._readableState = new ReadableState(options, this, isDuplex) - if (options) { - if (typeof options.read === 'function') this._read = options.read - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal && !isDuplex) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - if (this._readableState.needReadable) { - maybeReadMore(this, this._readableState) - } - }) + src.pipe(dst, { + end: false + }) // If end is true we already will have a listener to end dst. + + if (end) { + // Compat. Before node v10.12.0 stdio used to throw an error so + // pipe() did/does not end() stdio destinations. + // Now they allow it but "secretly" don't close the underlying fd. + + function endFn() { + ended = true + dst.end() + } + if (isReadableEnded(src)) { + // End the destination if the source has already ended. + process.nextTick(endFn) + } else { + src.once('end', endFn) + } + } else { + finish() } - Readable.prototype.destroy = destroyImpl.destroy - Readable.prototype._undestroy = destroyImpl.undestroy - Readable.prototype._destroy = function (err, cb) { - cb(err) - } - Readable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) - } - - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, false) - } - - // Unshift should *always* be something directly out of read(). - Readable.prototype.unshift = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, true) - } - function readableAddChunk(stream, chunk, encoding, addToFront) { - debug('readableAddChunk', chunk) - const state = stream._readableState - let err - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding - if (state.encoding !== encoding) { - if (addToFront && state.encoding) { - // When unshifting, if state.encoding is set, we have to save - // the string in the BufferList with the state encoding. - chunk = Buffer.from(chunk, encoding).toString(state.encoding) - } else { - chunk = Buffer.from(chunk, encoding) - encoding = '' - } - } - } else if (chunk instanceof Buffer) { - encoding = '' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = '' - } else if (chunk != null) { - err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + eos( + src, + { + readable: true, + writable: false + }, + (err) => { + const rState = src._readableState + if ( + err && + err.code === 'ERR_STREAM_PREMATURE_CLOSE' && + rState && + rState.ended && + !rState.errored && + !rState.errorEmitted + ) { + // Some readable streams will emit 'close' before 'end'. However, since + // this is on the readable side 'end' should still be emitted if the + // stream has been ended and no error emitted. This should be allowed in + // favor of backwards compatibility. Since the stream is piped to a + // destination this should not result in any observable difference. + // We don't need to check if this is a writable premature close since + // eos will only fail with premature close on the reading side for + // duplex streams. + src.once('end', finish).once('error', finish) + } else { + finish(err) } } - if (err) { - errorOrDestroy(stream, err) - } else if (chunk === null) { - state.reading = false - onEofChunk(stream, state) - } else if (state.objectMode || (chunk && chunk.length > 0)) { - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) - else if (state.destroyed || state.errored) return false - else addChunk(stream, state, chunk, true) - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) - } else if (state.destroyed || state.errored) { - return false - } else { - state.reading = false - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk) - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) - else maybeReadMore(stream, state) + ) + return eos( + dst, + { + readable: false, + writable: true + }, + finish + ) +} +module.exports = { + pipelineImpl, + pipeline +} + + +/***/ }), + +/***/ 3845: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// 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') +const { + ArrayPrototypeIndexOf, + NumberIsInteger, + NumberIsNaN, + NumberParseInt, + ObjectDefineProperties, + ObjectKeys, + ObjectSetPrototypeOf, + Promise, + SafeSet, + SymbolAsyncIterator, + Symbol +} = __webpack_require__(26701) +module.exports = Readable +Readable.ReadableState = ReadableState +const { EventEmitter: EE } = __webpack_require__(5939) +const { Stream, prependListener } = __webpack_require__(2854) +const { Buffer } = __webpack_require__(2486) +const { addAbortSignal } = __webpack_require__(29975) +const eos = __webpack_require__(24597) +let debug = (__webpack_require__(72978).debuglog)('stream', (fn) => { + debug = fn +}) +const BufferList = __webpack_require__(51085) +const destroyImpl = __webpack_require__(92573) +const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(94263) +const { + aggregateTwoErrors, + codes: { + ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED, + ERR_OUT_OF_RANGE, + ERR_STREAM_PUSH_AFTER_EOF, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT + } +} = __webpack_require__(4213) +const { validateObject } = __webpack_require__(99639) +const kPaused = Symbol('kPaused') +const { StringDecoder } = __webpack_require__(10301) +const from = __webpack_require__(54562) +ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) +ObjectSetPrototypeOf(Readable, Stream) +const nop = () => {} +const { errorOrDestroy } = destroyImpl +function ReadableState(options, stream, isDuplex) { + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(35960) + + // Object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away. + this.objectMode = !!(options && options.objectMode) + if (isDuplex) this.objectMode = this.objectMode || !!(options && options.readableObjectMode) + + // The point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = options + ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) + : getDefaultHighWaterMark(false) + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift(). + this.buffer = new BufferList() + this.length = 0 + this.pipes = [] + this.flowing = null + this.ended = false + this.endEmitted = false + this.reading = false + + // Stream is still being constructed and cannot be + // destroyed until construction finished or failed. + // Async construction is opt in, therefore we start as + // constructed. + this.constructed = true + + // A flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true + + // Whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false + this.emittedReadable = false + this.readableListening = false + this.resumeScheduled = false + this[kPaused] = null + + // True if the error was already emitted and should not be thrown again. + this.errorEmitted = false + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = !options || options.emitClose !== false + + // Should .destroy() be called after 'end' (and potentially 'finish'). + this.autoDestroy = !options || options.autoDestroy !== false + + // Has it been destroyed. + this.destroyed = false + + // Indicates whether the stream has errored. When true no further + // _read calls, 'data' or 'readable' events should occur. This is needed + // since when autoDestroy is disabled we need a way to tell whether the + // stream has failed. + this.errored = null + + // Indicates whether the stream has finished destroying. + this.closed = false + + // True if close has been emitted or would have been emitted + // depending on emitClose. + this.closeEmitted = false + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' + + // Ref the piped dest which we need a drain event on it + // type: null | Writable | Set. + this.awaitDrainWriters = null + this.multiAwaitDrain = false + + // If true, a maybeReadMore has been scheduled. + this.readingMore = false + this.dataEmitted = false + this.decoder = null + this.encoding = null + if (options && options.encoding) { + this.decoder = new StringDecoder(options.encoding) + this.encoding = options.encoding + } +} +function Readable(options) { + if (!(this instanceof Readable)) return new Readable(options) + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5. + const isDuplex = this instanceof __webpack_require__(35960) + this._readableState = new ReadableState(options, this, isDuplex) + if (options) { + if (typeof options.read === 'function') this._read = options.read + if (typeof options.destroy === 'function') this._destroy = options.destroy + if (typeof options.construct === 'function') this._construct = options.construct + if (options.signal && !isDuplex) addAbortSignal(options.signal, this) + } + Stream.call(this, options) + destroyImpl.construct(this, () => { + if (this._readableState.needReadable) { + maybeReadMore(this, this._readableState) + } + }) +} +Readable.prototype.destroy = destroyImpl.destroy +Readable.prototype._undestroy = destroyImpl.undestroy +Readable.prototype._destroy = function (err, cb) { + cb(err) +} +Readable.prototype[EE.captureRejectionSymbol] = function (err) { + this.destroy(err) +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + return readableAddChunk(this, chunk, encoding, false) +} + +// Unshift should *always* be something directly out of read(). +Readable.prototype.unshift = function (chunk, encoding) { + return readableAddChunk(this, chunk, encoding, true) +} +function readableAddChunk(stream, chunk, encoding, addToFront) { + debug('readableAddChunk', chunk) + const state = stream._readableState + let err + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding + if (state.encoding !== encoding) { + if (addToFront && state.encoding) { + // When unshifting, if state.encoding is set, we have to save + // the string in the BufferList with the state encoding. + chunk = Buffer.from(chunk, encoding).toString(state.encoding) } else { - addChunk(stream, state, chunk, false) - } - } - } else if (!addToFront) { + chunk = Buffer.from(chunk, encoding) + encoding = '' + } + } + } else if (chunk instanceof Buffer) { + encoding = '' + } else if (Stream._isUint8Array(chunk)) { + chunk = Stream._uint8ArrayToBuffer(chunk) + encoding = '' + } else if (chunk != null) { + err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + } + } + if (err) { + errorOrDestroy(stream, err) + } else if (chunk === null) { + state.reading = false + onEofChunk(stream, state) + } else if (state.objectMode || (chunk && chunk.length > 0)) { + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) + else if (state.destroyed || state.errored) return false + else addChunk(stream, state, chunk, true) + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) + } else if (state.destroyed || state.errored) { + return false + } else { state.reading = false - maybeReadMore(stream, state) - } - - // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - return !state.ended && (state.length < state.highWaterMark || state.length === 0) - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { - // Use the guard to avoid creating `Set()` repeatedly - // when we have multiple pipes. - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk) + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) + else maybeReadMore(stream, state) } else { - state.awaitDrainWriters = null + addChunk(stream, state, chunk, false) } - state.dataEmitted = true - stream.emit('data', chunk) - } else { - // Update the buffer info. - state.length += state.objectMode ? 1 : chunk.length - if (addToFront) state.buffer.unshift(chunk) - else state.buffer.push(chunk) - if (state.needReadable) emitReadable(stream) } + } else if (!addToFront) { + state.reading = false maybeReadMore(stream, state) } - Readable.prototype.isPaused = function () { - const state = this._readableState - return state[kPaused] === true || state.flowing === false - } - - // Backwards compatibility. - Readable.prototype.setEncoding = function (enc) { - const decoder = new StringDecoder(enc) - this._readableState.decoder = decoder - // If setEncoding(null), decoder.encoding equals utf8. - this._readableState.encoding = this._readableState.decoder.encoding - const buffer = this._readableState.buffer - // Iterate over current buffer to convert already stored Buffers: - let content = '' - for (const data of buffer) { - content += decoder.write(data) - } - buffer.clear() - if (content !== '') buffer.push(content) - this._readableState.length = content.length - return this - } - - // Don't raise the hwm > 1GB. - const MAX_HWM = 0x40000000 - function computeNewHighWaterMark(n) { - if (n > MAX_HWM) { - throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0) +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { + // Use the guard to avoid creating `Set()` repeatedly + // when we have multiple pipes. + if (state.multiAwaitDrain) { + state.awaitDrainWriters.clear() } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts. - n-- - n |= n >>> 1 - n |= n >>> 2 - n |= n >>> 4 - n |= n >>> 8 - n |= n >>> 16 - n++ - } - return n - } - - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function howMuchToRead(n, state) { - if (n <= 0 || (state.length === 0 && state.ended)) return 0 - if (state.objectMode) return 1 - if (NumberIsNaN(n)) { - // Only flow one buffer at a time. - if (state.flowing && state.length) return state.buffer.first().length - return state.length - } - if (n <= state.length) return n - return state.ended ? state.length : 0 - } - - // You can override either this method, or the async _read(n) below. - Readable.prototype.read = function (n) { - debug('read', n) - // Same as parseInt(undefined, 10), however V8 7.3 performance regressed - // in this scenario, so we are doing it manually. - if (n === undefined) { - n = NaN - } else if (!NumberIsInteger(n)) { - n = NumberParseInt(n, 10) - } - const state = this._readableState - const nOrig = n - - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) - if (n !== 0) state.emittedReadable = false - - // If we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if ( - n === 0 && - state.needReadable && - ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) - ) { - debug('read: emitReadable', state.length, state.ended) - if (state.length === 0 && state.ended) endReadable(this) - else emitReadable(this) - return null - } - n = howMuchToRead(n, state) - - // If we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this) - return null + state.awaitDrainWriters = null } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - let doRead = state.needReadable - debug('need readable', doRead) - - // If we currently have less than the highWaterMark, then also read some. - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true - debug('length less than watermark', doRead) - } - - // However, if we've ended, then there's no point, if we're already - // reading, then it's unnecessary, if we're constructing we have to wait, - // and if we're destroyed or errored, then it's not allowed, - if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { - doRead = false - debug('reading, ended or constructing', doRead) - } else if (doRead) { - debug('do read') - state.reading = true - state.sync = true - // If the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true - - // Call internal read method - try { - this._read(state.highWaterMark) - } catch (err) { - errorOrDestroy(this, err) - } - state.sync = false - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state) + state.dataEmitted = true + stream.emit('data', chunk) + } else { + // Update the buffer info. + state.length += state.objectMode ? 1 : chunk.length + if (addToFront) state.buffer.unshift(chunk) + else state.buffer.push(chunk) + if (state.needReadable) emitReadable(stream) + } + maybeReadMore(stream, state) +} +Readable.prototype.isPaused = function () { + const state = this._readableState + return state[kPaused] === true || state.flowing === false +} + +// Backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + const decoder = new StringDecoder(enc) + this._readableState.decoder = decoder + // If setEncoding(null), decoder.encoding equals utf8. + this._readableState.encoding = this._readableState.decoder.encoding + const buffer = this._readableState.buffer + // Iterate over current buffer to convert already stored Buffers: + let content = '' + for (const data of buffer) { + content += decoder.write(data) + } + buffer.clear() + if (content !== '') buffer.push(content) + this._readableState.length = content.length + return this +} + +// Don't raise the hwm > 1GB. +const MAX_HWM = 0x40000000 +function computeNewHighWaterMark(n) { + if (n > MAX_HWM) { + throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts. + n-- + n |= n >>> 1 + n |= n >>> 2 + n |= n >>> 4 + n |= n >>> 8 + n |= n >>> 16 + n++ + } + return n +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || (state.length === 0 && state.ended)) return 0 + if (state.objectMode) return 1 + if (NumberIsNaN(n)) { + // Only flow one buffer at a time. + if (state.flowing && state.length) return state.buffer.first().length + return state.length + } + if (n <= state.length) return n + return state.ended ? state.length : 0 +} + +// You can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n) + // Same as parseInt(undefined, 10), however V8 7.3 performance regressed + // in this scenario, so we are doing it manually. + if (n === undefined) { + n = NaN + } else if (!NumberIsInteger(n)) { + n = NumberParseInt(n, 10) + } + const state = this._readableState + const nOrig = n + + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) + if (n !== 0) state.emittedReadable = false + + // If we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if ( + n === 0 && + state.needReadable && + ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) + ) { + debug('read: emitReadable', state.length, state.ended) + if (state.length === 0 && state.ended) endReadable(this) + else emitReadable(this) + return null + } + n = howMuchToRead(n, state) + + // If we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this) + return null + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + let doRead = state.needReadable + debug('need readable', doRead) + + // If we currently have less than the highWaterMark, then also read some. + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true + debug('length less than watermark', doRead) + } + + // However, if we've ended, then there's no point, if we're already + // reading, then it's unnecessary, if we're constructing we have to wait, + // and if we're destroyed or errored, then it's not allowed, + if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { + doRead = false + debug('reading, ended or constructing', doRead) + } else if (doRead) { + debug('do read') + state.reading = true + state.sync = true + // If the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true + + // Call internal read method + try { + this._read(state.highWaterMark) + } catch (err) { + errorOrDestroy(this, err) } - let ret - if (n > 0) ret = fromList(n, state) - else ret = null - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark - n = 0 + state.sync = false + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state) + } + let ret + if (n > 0) ret = fromList(n, state) + else ret = null + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark + n = 0 + } else { + state.length -= n + if (state.multiAwaitDrain) { + state.awaitDrainWriters.clear() } else { - state.length -= n - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } - } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this) + state.awaitDrainWriters = null } - if (ret !== null && !state.errorEmitted && !state.closeEmitted) { - state.dataEmitted = true - this.emit('data', ret) - } - return ret } - function onEofChunk(stream, state) { - debug('onEofChunk') - if (state.ended) return - if (state.decoder) { - const chunk = state.decoder.end() - if (chunk && chunk.length) { - state.buffer.push(chunk) - state.length += state.objectMode ? 1 : chunk.length - } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this) + } + if (ret !== null && !state.errorEmitted && !state.closeEmitted) { + state.dataEmitted = true + this.emit('data', ret) + } + return ret +} +function onEofChunk(stream, state) { + debug('onEofChunk') + if (state.ended) return + if (state.decoder) { + const chunk = state.decoder.end() + if (chunk && chunk.length) { + state.buffer.push(chunk) + state.length += state.objectMode ? 1 : chunk.length } - state.ended = true - if (state.sync) { - // If we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call. - emitReadable(stream) - } else { - // Emit 'readable' now to make sure it gets picked up. - state.needReadable = false - state.emittedReadable = true - // We have to emit readable now that we are EOF. Modules - // in the ecosystem (e.g. dicer) rely on this event being sync. - emitReadable_(stream) - } - } - - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - const state = stream._readableState - debug('emitReadable', state.needReadable, state.emittedReadable) + } + state.ended = true + if (state.sync) { + // If we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call. + emitReadable(stream) + } else { + // Emit 'readable' now to make sure it gets picked up. state.needReadable = false - if (!state.emittedReadable) { - debug('emitReadable', state.flowing) - state.emittedReadable = true - process.nextTick(emitReadable_, stream) - } + state.emittedReadable = true + // We have to emit readable now that we are EOF. Modules + // in the ecosystem (e.g. dicer) rely on this event being sync. + emitReadable_(stream) } - function emitReadable_(stream) { - const state = stream._readableState - debug('emitReadable_', state.destroyed, state.length, state.ended) - if (!state.destroyed && !state.errored && (state.length || state.ended)) { - stream.emit('readable') - state.emittedReadable = false - } - - // The stream needs another readable event if: - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark - flow(stream) - } - - // At this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore && state.constructed) { - state.readingMore = true - process.nextTick(maybeReadMore_, stream, state) - } - } - function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while ( - !state.reading && - !state.ended && - (state.length < state.highWaterMark || (state.flowing && state.length === 0)) - ) { - const len = state.length - debug('maybeReadMore read 0') - stream.read(0) - if (len === state.length) - // Didn't get any data, stop spinning. - break - } - state.readingMore = false - } - - // Abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function (n) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') - } - Readable.prototype.pipe = function (dest, pipeOpts) { - const src = this - const state = this._readableState - if (state.pipes.length === 1) { - if (!state.multiAwaitDrain) { - state.multiAwaitDrain = true - state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) - } - } - state.pipes.push(dest) - debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) - const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr - const endFn = doEnd ? onend : unpipe - if (state.endEmitted) process.nextTick(endFn) - else src.once('end', endFn) - dest.on('unpipe', onunpipe) - function onunpipe(readable, unpipeInfo) { - debug('onunpipe') - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true - cleanup() - } - } - } - function onend() { - debug('onend') - dest.end() - } - let ondrain - let cleanedUp = false - function cleanup() { - debug('cleanup') - // Cleanup event handlers once the pipe is broken. - dest.removeListener('close', onclose) - dest.removeListener('finish', onfinish) - if (ondrain) { - dest.removeListener('drain', ondrain) - } - dest.removeListener('error', onerror) - dest.removeListener('unpipe', onunpipe) - src.removeListener('end', onend) - src.removeListener('end', unpipe) - src.removeListener('data', ondata) - cleanedUp = true - - // If the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() - } - function pause() { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if (!cleanedUp) { - if (state.pipes.length === 1 && state.pipes[0] === dest) { - debug('false write response, pause', 0) - state.awaitDrainWriters = dest - state.multiAwaitDrain = false - } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { - debug('false write response, pause', state.awaitDrainWriters.size) - state.awaitDrainWriters.add(dest) - } - src.pause() - } - if (!ondrain) { - // When the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - ondrain = pipeOnDrain(src, dest) - dest.on('drain', ondrain) - } - } - src.on('data', ondata) - function ondata(chunk) { - debug('ondata') - const ret = dest.write(chunk) - debug('dest.write', ret) - if (ret === false) { - pause() - } - } - - // If the dest has an error, then stop piping into it. - // However, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er) - unpipe() - dest.removeListener('error', onerror) - if (dest.listenerCount('error') === 0) { - const s = dest._writableState || dest._readableState - if (s && !s.errorEmitted) { - // User incorrectly emitted 'error' directly on the stream. - errorOrDestroy(dest, er) - } else { - dest.emit('error', er) - } - } - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror) - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish) - unpipe() - } - dest.once('close', onclose) - function onfinish() { - debug('onfinish') - dest.removeListener('close', onclose) - unpipe() - } - dest.once('finish', onfinish) - function unpipe() { - debug('unpipe') - src.unpipe(dest) - } - - // Tell the dest that it's being piped to. - dest.emit('pipe', src) - - // Start the flow if it hasn't been started already. - - if (dest.writableNeedDrain === true) { - if (state.flowing) { - pause() - } - } else if (!state.flowing) { - debug('pipe resume') - src.resume() - } - return dest +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + const state = stream._readableState + debug('emitReadable', state.needReadable, state.emittedReadable) + state.needReadable = false + if (!state.emittedReadable) { + debug('emitReadable', state.flowing) + state.emittedReadable = true + process.nextTick(emitReadable_, stream) + } +} +function emitReadable_(stream) { + const state = stream._readableState + debug('emitReadable_', state.destroyed, state.length, state.ended) + if (!state.destroyed && !state.errored && (state.length || state.ended)) { + stream.emit('readable') + state.emittedReadable = false } - function pipeOnDrain(src, dest) { - return function pipeOnDrainFunctionResult() { - const state = src._readableState - - // `ondrain` will call directly, - // `this` maybe not a reference to dest, - // so we use the real dest here. - if (state.awaitDrainWriters === dest) { - debug('pipeOnDrain', 1) - state.awaitDrainWriters = null - } else if (state.multiAwaitDrain) { - debug('pipeOnDrain', state.awaitDrainWriters.size) - state.awaitDrainWriters.delete(dest) - } - if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { - src.resume() + + // The stream needs another readable event if: + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark + flow(stream) +} + +// At this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore && state.constructed) { + state.readingMore = true + process.nextTick(maybeReadMore_, stream, state) + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while ( + !state.reading && + !state.ended && + (state.length < state.highWaterMark || (state.flowing && state.length === 0)) + ) { + const len = state.length + debug('maybeReadMore read 0') + stream.read(0) + if (len === state.length) + // Didn't get any data, stop spinning. + break + } + state.readingMore = false +} + +// Abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') +} +Readable.prototype.pipe = function (dest, pipeOpts) { + const src = this + const state = this._readableState + if (state.pipes.length === 1) { + if (!state.multiAwaitDrain) { + state.multiAwaitDrain = true + state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) + } + } + state.pipes.push(dest) + debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) + const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr + const endFn = doEnd ? onend : unpipe + if (state.endEmitted) process.nextTick(endFn) + else src.once('end', endFn) + dest.on('unpipe', onunpipe) + function onunpipe(readable, unpipeInfo) { + debug('onunpipe') + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true + cleanup() } } } - Readable.prototype.unpipe = function (dest) { - const state = this._readableState - const unpipeInfo = { - hasUnpiped: false + function onend() { + debug('onend') + dest.end() + } + let ondrain + let cleanedUp = false + function cleanup() { + debug('cleanup') + // Cleanup event handlers once the pipe is broken. + dest.removeListener('close', onclose) + dest.removeListener('finish', onfinish) + if (ondrain) { + dest.removeListener('drain', ondrain) } - - // If we're not piping anywhere, then do nothing. - if (state.pipes.length === 0) return this - if (!dest) { - // remove all. - const dests = state.pipes - state.pipes = [] - this.pause() - for (let i = 0; i < dests.length; i++) - dests[i].emit('unpipe', this, { - hasUnpiped: false - }) - return this + dest.removeListener('error', onerror) + dest.removeListener('unpipe', onunpipe) + src.removeListener('end', onend) + src.removeListener('end', unpipe) + src.removeListener('data', ondata) + cleanedUp = true + + // If the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() + } + function pause() { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if (!cleanedUp) { + if (state.pipes.length === 1 && state.pipes[0] === dest) { + debug('false write response, pause', 0) + state.awaitDrainWriters = dest + state.multiAwaitDrain = false + } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { + debug('false write response, pause', state.awaitDrainWriters.size) + state.awaitDrainWriters.add(dest) + } + src.pause() + } + if (!ondrain) { + // When the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + ondrain = pipeOnDrain(src, dest) + dest.on('drain', ondrain) + } + } + src.on('data', ondata) + function ondata(chunk) { + debug('ondata') + const ret = dest.write(chunk) + debug('dest.write', ret) + if (ret === false) { + pause() } - - // Try to find the right one. - const index = ArrayPrototypeIndexOf(state.pipes, dest) - if (index === -1) return this - state.pipes.splice(index, 1) - if (state.pipes.length === 0) this.pause() - dest.emit('unpipe', this, unpipeInfo) - return this } - - // Set up data events if they are asked for - // Ensure readable listeners eventually get something. - Readable.prototype.on = function (ev, fn) { - const res = Stream.prototype.on.call(this, ev, fn) - const state = this._readableState - if (ev === 'data') { - // Update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0 - - // Try start flowing on next tick if stream isn't explicitly paused. - if (state.flowing !== false) this.resume() - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true - state.flowing = false - state.emittedReadable = false - debug('on readable', state.length, state.reading) - if (state.length) { - emitReadable(this) - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this) - } - } - } - return res - } - Readable.prototype.addListener = Readable.prototype.on - Readable.prototype.removeListener = function (ev, fn) { - const res = Stream.prototype.removeListener.call(this, ev, fn) - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res - } - Readable.prototype.off = Readable.prototype.removeListener - Readable.prototype.removeAllListeners = function (ev) { - const res = Stream.prototype.removeAllListeners.apply(this, arguments) - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res - } - function updateReadableListening(self) { - const state = self._readableState - state.readableListening = self.listenerCount('readable') > 0 - if (state.resumeScheduled && state[kPaused] === false) { - // Flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true - - // Crude way to check if we should resume. - } else if (self.listenerCount('data') > 0) { - self.resume() - } else if (!state.readableListening) { - state.flowing = null - } - } - function nReadingNextTick(self) { - debug('readable nexttick read 0') - self.read(0) - } - - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function () { - const state = this._readableState - if (!state.flowing) { - debug('resume') - // We flow only if there is no one listening - // for readable, but we still have to call - // resume(). - state.flowing = !state.readableListening - resume(this, state) - } - state[kPaused] = false - return this - } - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true - process.nextTick(resume_, stream, state) + + // If the dest has an error, then stop piping into it. + // However, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er) + unpipe() + dest.removeListener('error', onerror) + if (dest.listenerCount('error') === 0) { + const s = dest._writableState || dest._readableState + if (s && !s.errorEmitted) { + // User incorrectly emitted 'error' directly on the stream. + errorOrDestroy(dest, er) + } else { + dest.emit('error', er) + } } } - function resume_(stream, state) { - debug('resume', state.reading) - if (!state.reading) { - stream.read(0) - } - state.resumeScheduled = false - stream.emit('resume') - flow(stream) - if (state.flowing && !state.reading) stream.read(0) + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror) + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish) + unpipe() + } + dest.once('close', onclose) + function onfinish() { + debug('onfinish') + dest.removeListener('close', onclose) + unpipe() + } + dest.once('finish', onfinish) + function unpipe() { + debug('unpipe') + src.unpipe(dest) } - Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing) - if (this._readableState.flowing !== false) { - debug('pause') - this._readableState.flowing = false - this.emit('pause') + + // Tell the dest that it's being piped to. + dest.emit('pipe', src) + + // Start the flow if it hasn't been started already. + + if (dest.writableNeedDrain === true) { + if (state.flowing) { + pause() + } + } else if (!state.flowing) { + debug('pipe resume') + src.resume() + } + return dest +} +function pipeOnDrain(src, dest) { + return function pipeOnDrainFunctionResult() { + const state = src._readableState + + // `ondrain` will call directly, + // `this` maybe not a reference to dest, + // so we use the real dest here. + if (state.awaitDrainWriters === dest) { + debug('pipeOnDrain', 1) + state.awaitDrainWriters = null + } else if (state.multiAwaitDrain) { + debug('pipeOnDrain', state.awaitDrainWriters.size) + state.awaitDrainWriters.delete(dest) + } + if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { + src.resume() } - this._readableState[kPaused] = true + } +} +Readable.prototype.unpipe = function (dest) { + const state = this._readableState + const unpipeInfo = { + hasUnpiped: false + } + + // If we're not piping anywhere, then do nothing. + if (state.pipes.length === 0) return this + if (!dest) { + // remove all. + const dests = state.pipes + state.pipes = [] + this.pause() + for (let i = 0; i < dests.length; i++) + dests[i].emit('unpipe', this, { + hasUnpiped: false + }) return this } - function flow(stream) { - const state = stream._readableState - debug('flow', state.flowing) - while (state.flowing && stream.read() !== null); - } - - // Wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function (stream) { - let paused = false - - // TODO (ronag): Should this.destroy(err) emit - // 'error' on the wrapped stream? Would require - // a static factory method, e.g. Readable.wrap(stream). - - stream.on('data', (chunk) => { - if (!this.push(chunk) && stream.pause) { - paused = true - stream.pause() - } - }) - stream.on('end', () => { - this.push(null) - }) - stream.on('error', (err) => { - errorOrDestroy(this, err) - }) - stream.on('close', () => { - this.destroy() - }) - stream.on('destroy', () => { - this.destroy() - }) - this._read = () => { - if (paused && stream.resume) { - paused = false - stream.resume() - } + + // Try to find the right one. + const index = ArrayPrototypeIndexOf(state.pipes, dest) + if (index === -1) return this + state.pipes.splice(index, 1) + if (state.pipes.length === 0) this.pause() + dest.emit('unpipe', this, unpipeInfo) + return this +} + +// Set up data events if they are asked for +// Ensure readable listeners eventually get something. +Readable.prototype.on = function (ev, fn) { + const res = Stream.prototype.on.call(this, ev, fn) + const state = this._readableState + if (ev === 'data') { + // Update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0 + + // Try start flowing on next tick if stream isn't explicitly paused. + if (state.flowing !== false) this.resume() + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true + state.flowing = false + state.emittedReadable = false + debug('on readable', state.length, state.reading) + if (state.length) { + emitReadable(this) + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this) + } + } + } + return res +} +Readable.prototype.addListener = Readable.prototype.on +Readable.prototype.removeListener = function (ev, fn) { + const res = Stream.prototype.removeListener.call(this, ev, fn) + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this) + } + return res +} +Readable.prototype.off = Readable.prototype.removeListener +Readable.prototype.removeAllListeners = function (ev) { + const res = Stream.prototype.removeAllListeners.apply(this, arguments) + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this) + } + return res +} +function updateReadableListening(self) { + const state = self._readableState + state.readableListening = self.listenerCount('readable') > 0 + if (state.resumeScheduled && state[kPaused] === false) { + // Flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true + + // Crude way to check if we should resume. + } else if (self.listenerCount('data') > 0) { + self.resume() + } else if (!state.readableListening) { + state.flowing = null + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0') + self.read(0) +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + const state = this._readableState + if (!state.flowing) { + debug('resume') + // We flow only if there is no one listening + // for readable, but we still have to call + // resume(). + state.flowing = !state.readableListening + resume(this, state) + } + state[kPaused] = false + return this +} +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true + process.nextTick(resume_, stream, state) + } +} +function resume_(stream, state) { + debug('resume', state.reading) + if (!state.reading) { + stream.read(0) + } + state.resumeScheduled = false + stream.emit('resume') + flow(stream) + if (state.flowing && !state.reading) stream.read(0) +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing) + if (this._readableState.flowing !== false) { + debug('pause') + this._readableState.flowing = false + this.emit('pause') + } + this._readableState[kPaused] = true + return this +} +function flow(stream) { + const state = stream._readableState + debug('flow', state.flowing) + while (state.flowing && stream.read() !== null); +} + +// Wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + let paused = false + + // TODO (ronag): Should this.destroy(err) emit + // 'error' on the wrapped stream? Would require + // a static factory method, e.g. Readable.wrap(stream). + + stream.on('data', (chunk) => { + if (!this.push(chunk) && stream.pause) { + paused = true + stream.pause() } - - // Proxy all the other methods. Important when wrapping filters and duplexes. - const streamKeys = ObjectKeys(stream) - for (let j = 1; j < streamKeys.length; j++) { - const i = streamKeys[j] - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = stream[i].bind(stream) - } + }) + stream.on('end', () => { + this.push(null) + }) + stream.on('error', (err) => { + errorOrDestroy(this, err) + }) + stream.on('close', () => { + this.destroy() + }) + stream.on('destroy', () => { + this.destroy() + }) + this._read = () => { + if (paused && stream.resume) { + paused = false + stream.resume() } - return this } - Readable.prototype[SymbolAsyncIterator] = function () { - return streamToAsyncIterator(this) + + // Proxy all the other methods. Important when wrapping filters and duplexes. + const streamKeys = ObjectKeys(stream) + for (let j = 1; j < streamKeys.length; j++) { + const i = streamKeys[j] + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = stream[i].bind(stream) + } + } + return this +} +Readable.prototype[SymbolAsyncIterator] = function () { + return streamToAsyncIterator(this) +} +Readable.prototype.iterator = function (options) { + if (options !== undefined) { + validateObject(options, 'options') + } + return streamToAsyncIterator(this, options) +} +function streamToAsyncIterator(stream, options) { + if (typeof stream.read !== 'function') { + stream = Readable.wrap(stream, { + objectMode: true + }) } - Readable.prototype.iterator = function (options) { - if (options !== undefined) { - validateObject(options, 'options') + const iter = createAsyncIterator(stream, options) + iter.stream = stream + return iter +} +async function* createAsyncIterator(stream, options) { + let callback = nop + function next(resolve) { + if (this === stream) { + callback() + callback = nop + } else { + callback = resolve } - return streamToAsyncIterator(this, options) } - function streamToAsyncIterator(stream, options) { - if (typeof stream.read !== 'function') { - stream = Readable.wrap(stream, { - objectMode: true - }) + stream.on('readable', next) + let error + const cleanup = eos( + stream, + { + writable: false + }, + (err) => { + error = err ? aggregateTwoErrors(error, err) : null + callback() + callback = nop } - const iter = createAsyncIterator(stream, options) - iter.stream = stream - return iter - } - async function* createAsyncIterator(stream, options) { - let callback = nop - function next(resolve) { - if (this === stream) { - callback() - callback = nop + ) + try { + while (true) { + const chunk = stream.destroyed ? null : stream.read() + if (chunk !== null) { + yield chunk + } else if (error) { + throw error + } else if (error === null) { + return } else { - callback = resolve + await new Promise(next) } } - stream.on('readable', next) - let error - const cleanup = eos( - stream, - { - writable: false - }, - (err) => { - error = err ? aggregateTwoErrors(error, err) : null - callback() - callback = nop - } - ) - try { - while (true) { - const chunk = stream.destroyed ? null : stream.read() - if (chunk !== null) { - yield chunk - } else if (error) { - throw error - } else if (error === null) { - return - } else { - await new Promise(next) - } - } - } catch (err) { - error = aggregateTwoErrors(error, err) - throw error - } finally { - if ( - (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && - (error === undefined || stream._readableState.autoDestroy) - ) { - destroyImpl.destroyer(stream, null) - } else { - stream.off('readable', next) - cleanup() - } + } catch (err) { + error = aggregateTwoErrors(error, err) + throw error + } finally { + if ( + (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && + (error === undefined || stream._readableState.autoDestroy) + ) { + destroyImpl.destroyer(stream, null) + } else { + stream.off('readable', next) + cleanup() } } - - // Making it explicit these properties are not enumerable - // because otherwise some prototype manipulation in - // userland will fail. - ObjectDefineProperties(Readable.prototype, { - readable: { - __proto__: null, - get() { - const r = this._readableState - // r.readable === false means that this is part of a Duplex stream - // where the readable side was disabled upon construction. - // Compat. The user might manually disable readable side through - // deprecated setter. - return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted - }, - set(val) { - // Backwards compat. - if (this._readableState) { - this._readableState.readable = !!val - } - } - }, - readableDidRead: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.dataEmitted - } - }, - readableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._readableState.readable !== false && - (this._readableState.destroyed || this._readableState.errored) && - !this._readableState.endEmitted - ) - } - }, - readableHighWaterMark: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.highWaterMark - } - }, - readableBuffer: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState && this._readableState.buffer - } - }, - readableFlowing: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.flowing - }, - set: function (state) { - if (this._readableState) { - this._readableState.flowing = state - } - } - }, - readableLength: { - __proto__: null, - enumerable: false, - get() { - return this._readableState.length - } - }, - readableObjectMode: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.objectMode : false - } - }, - readableEncoding: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.encoding : null - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.errored : null - } - }, - closed: { - __proto__: null, - get() { - return this._readableState ? this._readableState.closed : false - } - }, - destroyed: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.destroyed : false - }, - set(value) { - // We ignore the value if the stream - // has not been initialized yet. - if (!this._readableState) { - return - } - - // Backward compatibility, the user is explicitly - // managing destroyed. - this._readableState.destroyed = value +} + +// Making it explicit these properties are not enumerable +// because otherwise some prototype manipulation in +// userland will fail. +ObjectDefineProperties(Readable.prototype, { + readable: { + __proto__: null, + get() { + const r = this._readableState + // r.readable === false means that this is part of a Duplex stream + // where the readable side was disabled upon construction. + // Compat. The user might manually disable readable side through + // deprecated setter. + return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted + }, + set(val) { + // Backwards compat. + if (this._readableState) { + this._readableState.readable = !!val } + } + }, + readableDidRead: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.dataEmitted + } + }, + readableAborted: { + __proto__: null, + enumerable: false, + get: function () { + return !!( + this._readableState.readable !== false && + (this._readableState.destroyed || this._readableState.errored) && + !this._readableState.endEmitted + ) + } + }, + readableHighWaterMark: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.highWaterMark + } + }, + readableBuffer: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState && this._readableState.buffer + } + }, + readableFlowing: { + __proto__: null, + enumerable: false, + get: function () { + return this._readableState.flowing }, - readableEnded: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.endEmitted : false + set: function (state) { + if (this._readableState) { + this._readableState.flowing = state } } - }) - ObjectDefineProperties(ReadableState.prototype, { - // Legacy getter for `pipesCount`. - pipesCount: { - __proto__: null, - get() { - return this.pipes.length - } + }, + readableLength: { + __proto__: null, + enumerable: false, + get() { + return this._readableState.length + } + }, + readableObjectMode: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.objectMode : false + } + }, + readableEncoding: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.encoding : null + } + }, + errored: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.errored : null + } + }, + closed: { + __proto__: null, + get() { + return this._readableState ? this._readableState.closed : false + } + }, + destroyed: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.destroyed : false }, - // Legacy property for `paused`. - paused: { - __proto__: null, - get() { - return this[kPaused] !== false - }, - set(value) { - this[kPaused] = !!value + set(value) { + // We ignore the value if the stream + // has not been initialized yet. + if (!this._readableState) { + return } + + // Backward compatibility, the user is explicitly + // managing destroyed. + this._readableState.destroyed = value } - }) - - // Exposed for testing purposes only. - Readable._fromList = fromList - - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromList(n, state) { - // nothing buffered. - if (state.length === 0) return null - let ret - if (state.objectMode) ret = state.buffer.shift() - else if (!n || n >= state.length) { - // Read it all, truncate the list. - if (state.decoder) ret = state.buffer.join('') - else if (state.buffer.length === 1) ret = state.buffer.first() - else ret = state.buffer.concat(state.length) - state.buffer.clear() - } else { - // read part of list. - ret = state.buffer.consume(n, state.decoder) + }, + readableEnded: { + __proto__: null, + enumerable: false, + get() { + return this._readableState ? this._readableState.endEmitted : false } - return ret } - function endReadable(stream) { - const state = stream._readableState - debug('endReadable', state.endEmitted) - if (!state.endEmitted) { - state.ended = true - process.nextTick(endReadableNT, state, stream) - } - } - function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length) - - // Check that we didn't get one last unshift. - if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { - state.endEmitted = true - stream.emit('end') - if (stream.writable && stream.allowHalfOpen === false) { - process.nextTick(endWritableNT, stream) - } else if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well. - const wState = stream._writableState - const autoDestroy = - !wState || - (wState.autoDestroy && - // We don't expect the writable to ever 'finish' - // if writable is explicitly set to false. - (wState.finished || wState.writable === false)) - if (autoDestroy) { - stream.destroy() - } - } +}) +ObjectDefineProperties(ReadableState.prototype, { + // Legacy getter for `pipesCount`. + pipesCount: { + __proto__: null, + get() { + return this.pipes.length } - } - function endWritableNT(stream) { - const writable = stream.writable && !stream.writableEnded && !stream.destroyed - if (writable) { - stream.end() + }, + // Legacy property for `paused`. + paused: { + __proto__: null, + get() { + return this[kPaused] !== false + }, + set(value) { + this[kPaused] = !!value } } - Readable.from = function (iterable, opts) { - return from(Readable, iterable, opts) +}) + +// Exposed for testing purposes only. +Readable._fromList = fromList + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered. + if (state.length === 0) return null + let ret + if (state.objectMode) ret = state.buffer.shift() + else if (!n || n >= state.length) { + // Read it all, truncate the list. + if (state.decoder) ret = state.buffer.join('') + else if (state.buffer.length === 1) ret = state.buffer.first() + else ret = state.buffer.concat(state.length) + state.buffer.clear() + } else { + // read part of list. + ret = state.buffer.consume(n, state.decoder) + } + return ret +} +function endReadable(stream) { + const state = stream._readableState + debug('endReadable', state.endEmitted) + if (!state.endEmitted) { + state.ended = true + process.nextTick(endReadableNT, state, stream) } - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length) + + // Check that we didn't get one last unshift. + if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { + state.endEmitted = true + stream.emit('end') + if (stream.writable && stream.allowHalfOpen === false) { + process.nextTick(endWritableNT, stream) + } else if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well. + const wState = stream._writableState + const autoDestroy = + !wState || + (wState.autoDestroy && + // We don't expect the writable to ever 'finish' + // if writable is explicitly set to false. + (wState.finished || wState.writable === false)) + if (autoDestroy) { + stream.destroy() + } + } } - Readable.fromWeb = function (readableStream, options) { - return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) +} +function endWritableNT(stream) { + const writable = stream.writable && !stream.writableEnded && !stream.destroyed + if (writable) { + stream.end() } - Readable.toWeb = function (streamReadable, options) { - return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) +} +Readable.from = function (iterable, opts) { + return from(Readable, iterable, opts) +} +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Readable.fromWeb = function (readableStream, options) { + return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) +} +Readable.toWeb = function (streamReadable, options) { + return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) +} +Readable.wrap = function (src, options) { + var _ref, _src$readableObjectMo + return new Readable({ + objectMode: + (_ref = + (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined + ? _src$readableObjectMo + : src.objectMode) !== null && _ref !== undefined + ? _ref + : true, + ...options, + destroy(err, callback) { + destroyImpl.destroyer(src, err) + callback(err) + } + }).wrap(src) +} + + +/***/ }), + +/***/ 94263: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { MathFloor, NumberIsInteger } = __webpack_require__(26701) +const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(4213).codes) +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null +} +function getDefaultHighWaterMark(objectMode) { + return objectMode ? 16 : 16 * 1024 +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) + if (hwm != null) { + if (!NumberIsInteger(hwm) || hwm < 0) { + const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' + throw new ERR_INVALID_ARG_VALUE(name, hwm) + } + return MathFloor(hwm) } - Readable.wrap = function (src, options) { - var _ref, _src$readableObjectMo - return new Readable({ - objectMode: - (_ref = - (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined - ? _src$readableObjectMo - : src.objectMode) !== null && _ref !== undefined - ? _ref - : true, + + // Default value + return getDefaultHighWaterMark(state.objectMode) +} +module.exports = { + getHighWaterMark, + getDefaultHighWaterMark +} + + +/***/ }), + +/***/ 57425: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// 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. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(26701) +module.exports = Transform +const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(4213).codes) +const Duplex = __webpack_require__(35960) +const { getHighWaterMark } = __webpack_require__(94263) +ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) +ObjectSetPrototypeOf(Transform, Duplex) +const kCallback = Symbol('kCallback') +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options) + + // TODO (ronag): This should preferably always be + // applied but would be semver-major. Or even better; + // make Transform a Readable with the Writable interface. + const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null + if (readableHighWaterMark === 0) { + // A Duplex will buffer both on the writable and readable side while + // a Transform just wants to buffer hwm number of elements. To avoid + // buffering twice we disable buffering on the writable side. + options = { ...options, - destroy(err, callback) { - destroyImpl.destroyer(src, err) - callback(err) - } - }).wrap(src) - } - - - /***/ }), - - /***/ 94263: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { MathFloor, NumberIsInteger } = __webpack_require__(26701) - const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(4213).codes) - function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null - } - function getDefaultHighWaterMark(objectMode) { - return objectMode ? 16 : 16 * 1024 - } - function getHighWaterMark(state, options, duplexKey, isDuplex) { - const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) - if (hwm != null) { - if (!NumberIsInteger(hwm) || hwm < 0) { - const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' - throw new ERR_INVALID_ARG_VALUE(name, hwm) - } - return MathFloor(hwm) - } - - // Default value - return getDefaultHighWaterMark(state.objectMode) - } - module.exports = { - getHighWaterMark, - getDefaultHighWaterMark - } - - - /***/ }), - - /***/ 57425: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - // 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. - - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. - - - - const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(26701) - module.exports = Transform - const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(4213).codes) - const Duplex = __webpack_require__(35960) - const { getHighWaterMark } = __webpack_require__(94263) - ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) - ObjectSetPrototypeOf(Transform, Duplex) - const kCallback = Symbol('kCallback') - function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options) - - // TODO (ronag): This should preferably always be - // applied but would be semver-major. Or even better; - // make Transform a Readable with the Writable interface. - const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null - if (readableHighWaterMark === 0) { - // A Duplex will buffer both on the writable and readable side while - // a Transform just wants to buffer hwm number of elements. To avoid - // buffering twice we disable buffering on the writable side. - options = { - ...options, - highWaterMark: null, - readableHighWaterMark, - // TODO (ronag): 0 is not optimal since we have - // a "bug" where we check needDrain before calling _write and not after. - // Refs: https://github.com/nodejs/node/pull/32887 - // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: options.writableHighWaterMark || 0 - } - } - Duplex.call(this, options) - - // We have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false - this[kCallback] = null - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform - if (typeof options.flush === 'function') this._flush = options.flush - } - - // When the writable side finishes, then flush out anything remaining. - // Backwards compat. Some Transform streams incorrectly implement _final - // instead of or in addition to _flush. By using 'prefinish' instead of - // implementing _final we continue supporting this unfortunate use case. - this.on('prefinish', prefinish) - } - function final(cb) { - if (typeof this._flush === 'function' && !this.destroyed) { - this._flush((er, data) => { - if (er) { - if (cb) { - cb(er) - } else { - this.destroy(er) - } - return - } - if (data != null) { - this.push(data) - } - this.push(null) - if (cb) { - cb() - } - }) - } else { - this.push(null) - if (cb) { - cb() - } - } - } - function prefinish() { - if (this._final !== final) { - final.call(this) + highWaterMark: null, + readableHighWaterMark, + // TODO (ronag): 0 is not optimal since we have + // a "bug" where we check needDrain before calling _write and not after. + // Refs: https://github.com/nodejs/node/pull/32887 + // Refs: https://github.com/nodejs/node/pull/35941 + writableHighWaterMark: options.writableHighWaterMark || 0 } } - Transform.prototype._final = final - Transform.prototype._transform = function (chunk, encoding, callback) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') + Duplex.call(this, options) + + // We have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false + this[kCallback] = null + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform + if (typeof options.flush === 'function') this._flush = options.flush } - Transform.prototype._write = function (chunk, encoding, callback) { - const rState = this._readableState - const wState = this._writableState - const length = rState.length - this._transform(chunk, encoding, (err, val) => { - if (err) { - callback(err) + + // When the writable side finishes, then flush out anything remaining. + // Backwards compat. Some Transform streams incorrectly implement _final + // instead of or in addition to _flush. By using 'prefinish' instead of + // implementing _final we continue supporting this unfortunate use case. + this.on('prefinish', prefinish) +} +function final(cb) { + if (typeof this._flush === 'function' && !this.destroyed) { + this._flush((er, data) => { + if (er) { + if (cb) { + cb(er) + } else { + this.destroy(er) + } return } - if (val != null) { - this.push(val) + if (data != null) { + this.push(data) } - if ( - wState.ended || - // Backwards compat. - length === rState.length || - // Backwards compat. - rState.length < rState.highWaterMark - ) { - callback() - } else { - this[kCallback] = callback + this.push(null) + if (cb) { + cb() } }) + } else { + this.push(null) + if (cb) { + cb() + } } - Transform.prototype._read = function () { - if (this[kCallback]) { - const callback = this[kCallback] - this[kCallback] = null +} +function prefinish() { + if (this._final !== final) { + final.call(this) + } +} +Transform.prototype._final = final +Transform.prototype._transform = function (chunk, encoding, callback) { + throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') +} +Transform.prototype._write = function (chunk, encoding, callback) { + const rState = this._readableState + const wState = this._writableState + const length = rState.length + this._transform(chunk, encoding, (err, val) => { + if (err) { + callback(err) + return + } + if (val != null) { + this.push(val) + } + if ( + wState.ended || + // Backwards compat. + length === rState.length || + // Backwards compat. + rState.length < rState.highWaterMark + ) { callback() + } else { + this[kCallback] = callback } + }) +} +Transform.prototype._read = function () { + if (this[kCallback]) { + const callback = this[kCallback] + this[kCallback] = null + callback() } - - - /***/ }), - - /***/ 46342: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { Symbol, SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(26701) - const kDestroyed = Symbol('kDestroyed') - const kIsErrored = Symbol('kIsErrored') - const kIsReadable = Symbol('kIsReadable') - const kIsDisturbed = Symbol('kIsDisturbed') - const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') - const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') - function isReadableNodeStream(obj, strict = false) { - var _obj$_readableState - return !!( - ( - obj && - typeof obj.pipe === 'function' && - typeof obj.on === 'function' && - (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && - (!obj._writableState || - ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined - ? undefined - : _obj$_readableState.readable) !== false) && - // Duplex - (!obj._writableState || obj._readableState) - ) // Writable has .pipe. - ) - } - - function isWritableNodeStream(obj) { - var _obj$_writableState - return !!( - ( - obj && - typeof obj.write === 'function' && - typeof obj.on === 'function' && - (!obj._readableState || - ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined - ? undefined - : _obj$_writableState.writable) !== false) - ) // Duplex - ) - } - - function isDuplexNodeStream(obj) { - return !!( +} + + +/***/ }), + +/***/ 46342: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { Symbol, SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(26701) +const kDestroyed = Symbol('kDestroyed') +const kIsErrored = Symbol('kIsErrored') +const kIsReadable = Symbol('kIsReadable') +const kIsDisturbed = Symbol('kIsDisturbed') +const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') +const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') +function isReadableNodeStream(obj, strict = false) { + var _obj$_readableState + return !!( + ( obj && typeof obj.pipe === 'function' && - obj._readableState && typeof obj.on === 'function' && - typeof obj.write === 'function' - ) - } - function isNodeStream(obj) { - return ( - obj && - (obj._readableState || - obj._writableState || - (typeof obj.write === 'function' && typeof obj.on === 'function') || - (typeof obj.pipe === 'function' && typeof obj.on === 'function')) - ) - } - function isReadableStream(obj) { - return !!( + (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && + (!obj._writableState || + ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined + ? undefined + : _obj$_readableState.readable) !== false) && + // Duplex + (!obj._writableState || obj._readableState) + ) // Writable has .pipe. + ) +} + +function isWritableNodeStream(obj) { + var _obj$_writableState + return !!( + ( obj && - !isNodeStream(obj) && - typeof obj.pipeThrough === 'function' && - typeof obj.getReader === 'function' && - typeof obj.cancel === 'function' - ) - } - function isWritableStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') - } - function isTransformStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') - } - function isWebStream(obj) { - return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) - } - function isIterable(obj, isAsync) { - if (obj == null) return false - if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' - if (isAsync === false) return typeof obj[SymbolIterator] === 'function' - return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' + typeof obj.write === 'function' && + typeof obj.on === 'function' && + (!obj._readableState || + ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined + ? undefined + : _obj$_writableState.writable) !== false) + ) // Duplex + ) +} + +function isDuplexNodeStream(obj) { + return !!( + obj && + typeof obj.pipe === 'function' && + obj._readableState && + typeof obj.on === 'function' && + typeof obj.write === 'function' + ) +} +function isNodeStream(obj) { + return ( + obj && + (obj._readableState || + obj._writableState || + (typeof obj.write === 'function' && typeof obj.on === 'function') || + (typeof obj.pipe === 'function' && typeof obj.on === 'function')) + ) +} +function isReadableStream(obj) { + return !!( + obj && + !isNodeStream(obj) && + typeof obj.pipeThrough === 'function' && + typeof obj.getReader === 'function' && + typeof obj.cancel === 'function' + ) +} +function isWritableStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') +} +function isTransformStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') +} +function isWebStream(obj) { + return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) +} +function isIterable(obj, isAsync) { + if (obj == null) return false + if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' + if (isAsync === false) return typeof obj[SymbolIterator] === 'function' + return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' +} +function isDestroyed(stream) { + if (!isNodeStream(stream)) return null + const wState = stream._writableState + const rState = stream._readableState + const state = wState || rState + return !!(stream.destroyed || stream[kDestroyed] || (state !== null && state !== undefined && state.destroyed)) +} + +// Have been end():d. +function isWritableEnded(stream) { + if (!isWritableNodeStream(stream)) return null + if (stream.writableEnded === true) return true + const wState = stream._writableState + if (wState !== null && wState !== undefined && wState.errored) return false + if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null + return wState.ended +} + +// Have emitted 'finish'. +function isWritableFinished(stream, strict) { + if (!isWritableNodeStream(stream)) return null + if (stream.writableFinished === true) return true + const wState = stream._writableState + if (wState !== null && wState !== undefined && wState.errored) return false + if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null + return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) +} + +// Have been push(null):d. +function isReadableEnded(stream) { + if (!isReadableNodeStream(stream)) return null + if (stream.readableEnded === true) return true + const rState = stream._readableState + if (!rState || rState.errored) return false + if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null + return rState.ended +} + +// Have emitted 'end'. +function isReadableFinished(stream, strict) { + if (!isReadableNodeStream(stream)) return null + const rState = stream._readableState + if (rState !== null && rState !== undefined && rState.errored) return false + if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null + return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) +} +function isReadable(stream) { + if (stream && stream[kIsReadable] != null) return stream[kIsReadable] + if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null + if (isDestroyed(stream)) return false + return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) +} +function isWritable(stream) { + if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null + if (isDestroyed(stream)) return false + return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) +} +function isFinished(stream, opts) { + if (!isNodeStream(stream)) { + return null } - function isDestroyed(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return !!(stream.destroyed || stream[kDestroyed] || (state !== null && state !== undefined && state.destroyed)) - } - - // Have been end():d. - function isWritableEnded(stream) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableEnded === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null - return wState.ended - } - - // Have emitted 'finish'. - function isWritableFinished(stream, strict) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableFinished === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null - return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) - } - - // Have been push(null):d. - function isReadableEnded(stream) { - if (!isReadableNodeStream(stream)) return null - if (stream.readableEnded === true) return true - const rState = stream._readableState - if (!rState || rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null - return rState.ended - } - - // Have emitted 'end'. - function isReadableFinished(stream, strict) { - if (!isReadableNodeStream(stream)) return null - const rState = stream._readableState - if (rState !== null && rState !== undefined && rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null - return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) - } - function isReadable(stream) { - if (stream && stream[kIsReadable] != null) return stream[kIsReadable] - if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) - } - function isWritable(stream) { - if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) - } - function isFinished(stream, opts) { - if (!isNodeStream(stream)) { - return null - } - if (isDestroyed(stream)) { - return true - } - if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { - return false - } - if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { - return false - } + if (isDestroyed(stream)) { return true } - function isWritableErrored(stream) { - var _stream$_writableStat, _stream$_writableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.writableErrored) { - return stream.writableErrored - } - return (_stream$_writableStat = - (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined - ? undefined - : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined - ? _stream$_writableStat - : null + if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { + return false } - function isReadableErrored(stream) { - var _stream$_readableStat, _stream$_readableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.readableErrored) { - return stream.readableErrored - } - return (_stream$_readableStat = - (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined - ? undefined - : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined - ? _stream$_readableStat - : null + if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { + return false } - function isClosed(stream) { - if (!isNodeStream(stream)) { - return null - } - if (typeof stream.closed === 'boolean') { - return stream.closed - } - const wState = stream._writableState - const rState = stream._readableState - if ( - typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || - typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' - ) { - return ( - (wState === null || wState === undefined ? undefined : wState.closed) || - (rState === null || rState === undefined ? undefined : rState.closed) - ) - } - if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { - return stream._closed - } + return true +} +function isWritableErrored(stream) { + var _stream$_writableStat, _stream$_writableStat2 + if (!isNodeStream(stream)) { return null } - function isOutgoingMessage(stream) { - return ( - typeof stream._closed === 'boolean' && - typeof stream._defaultKeepAlive === 'boolean' && - typeof stream._removedConnection === 'boolean' && - typeof stream._removedContLen === 'boolean' - ) + if (stream.writableErrored) { + return stream.writableErrored + } + return (_stream$_writableStat = + (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined + ? undefined + : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined + ? _stream$_writableStat + : null +} +function isReadableErrored(stream) { + var _stream$_readableStat, _stream$_readableStat2 + if (!isNodeStream(stream)) { + return null } - function isServerResponse(stream) { - return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) + if (stream.readableErrored) { + return stream.readableErrored + } + return (_stream$_readableStat = + (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined + ? undefined + : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined + ? _stream$_readableStat + : null +} +function isClosed(stream) { + if (!isNodeStream(stream)) { + return null } - function isServerRequest(stream) { - var _stream$req - return ( - typeof stream._consuming === 'boolean' && - typeof stream._dumped === 'boolean' && - ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === - undefined - ) + if (typeof stream.closed === 'boolean') { + return stream.closed } - function willEmitClose(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState + const wState = stream._writableState + const rState = stream._readableState + if ( + typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || + typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' + ) { return ( - (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) - ) - } - function isDisturbed(stream) { - var _stream$kIsDisturbed - return !!( - stream && - ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined - ? _stream$kIsDisturbed - : stream.readableDidRead || stream.readableAborted) + (wState === null || wState === undefined ? undefined : wState.closed) || + (rState === null || rState === undefined ? undefined : rState.closed) ) } - function isErrored(stream) { - var _ref, - _ref2, - _ref3, - _ref4, - _ref5, - _stream$kIsErrored, - _stream$_readableStat3, - _stream$_writableStat3, - _stream$_readableStat4, - _stream$_writableStat4 - return !!( - stream && - ((_ref = - (_ref2 = - (_ref3 = - (_ref4 = - (_ref5 = - (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined - ? _stream$kIsErrored - : stream.readableErrored) !== null && _ref5 !== undefined - ? _ref5 - : stream.writableErrored) !== null && _ref4 !== undefined - ? _ref4 - : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined - ? undefined - : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined - ? _ref3 - : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined + if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { + return stream._closed + } + return null +} +function isOutgoingMessage(stream) { + return ( + typeof stream._closed === 'boolean' && + typeof stream._defaultKeepAlive === 'boolean' && + typeof stream._removedConnection === 'boolean' && + typeof stream._removedContLen === 'boolean' + ) +} +function isServerResponse(stream) { + return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) +} +function isServerRequest(stream) { + var _stream$req + return ( + typeof stream._consuming === 'boolean' && + typeof stream._dumped === 'boolean' && + ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === + undefined + ) +} +function willEmitClose(stream) { + if (!isNodeStream(stream)) return null + const wState = stream._writableState + const rState = stream._readableState + const state = wState || rState + return ( + (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) + ) +} +function isDisturbed(stream) { + var _stream$kIsDisturbed + return !!( + stream && + ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined + ? _stream$kIsDisturbed + : stream.readableDidRead || stream.readableAborted) + ) +} +function isErrored(stream) { + var _ref, + _ref2, + _ref3, + _ref4, + _ref5, + _stream$kIsErrored, + _stream$_readableStat3, + _stream$_writableStat3, + _stream$_readableStat4, + _stream$_writableStat4 + return !!( + stream && + ((_ref = + (_ref2 = + (_ref3 = + (_ref4 = + (_ref5 = + (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined + ? _stream$kIsErrored + : stream.readableErrored) !== null && _ref5 !== undefined + ? _ref5 + : stream.writableErrored) !== null && _ref4 !== undefined + ? _ref4 + : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined ? undefined - : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined - ? _ref2 - : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined + : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined + ? _ref3 + : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined ? undefined - : _stream$_readableStat4.errored) !== null && _ref !== undefined - ? _ref - : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined + : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined + ? _ref2 + : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined ? undefined - : _stream$_writableStat4.errored) - ) - } - module.exports = { - kDestroyed, - isDisturbed, - kIsDisturbed, - isErrored, - kIsErrored, - isReadable, - kIsReadable, - kIsClosedPromise, - kControllerErrorFunction, - isClosed, - isDestroyed, - isDuplexNodeStream, - isFinished, - isIterable, - isReadableNodeStream, - isReadableStream, - isReadableEnded, - isReadableFinished, - isReadableErrored, - isNodeStream, - isWebStream, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableEnded, - isWritableFinished, - isWritableErrored, - isServerRequest, - isServerResponse, - willEmitClose, - isTransformStream - } - - - /***/ }), - - /***/ 12657: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const process = __webpack_require__(82530) - - /* replacement end */ - // 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. - - // A bit simpler than readable streams. - // Implement an async ._write(chunk, encoding, cb), and it'll handle all - // the drain event emission and buffering. - - ;('use strict') - const { - ArrayPrototypeSlice, - Error, - FunctionPrototypeSymbolHasInstance, - ObjectDefineProperty, - ObjectDefineProperties, - ObjectSetPrototypeOf, - StringPrototypeToLowerCase, - Symbol, - SymbolHasInstance - } = __webpack_require__(26701) - module.exports = Writable - Writable.WritableState = WritableState - const { EventEmitter: EE } = __webpack_require__(5939) - const Stream = (__webpack_require__(2854).Stream) - const { Buffer } = __webpack_require__(2486) - const destroyImpl = __webpack_require__(92573) - const { addAbortSignal } = __webpack_require__(29975) - const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(94263) - const { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED, - ERR_STREAM_ALREADY_FINISHED, - ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING - } = (__webpack_require__(4213).codes) - const { errorOrDestroy } = destroyImpl - ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) - ObjectSetPrototypeOf(Writable, Stream) - function nop() {} - const kOnFinished = Symbol('kOnFinished') - function WritableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(35960) - - // Object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) - - // The point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write(). - this.highWaterMark = options - ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // if _final has been called. - this.finalCalled = false - - // drain event flag. - this.needDrain = false - // At the start of calling end() - this.ending = false - // When end() has been called, and returned. - this.ended = false - // When 'finish' is emitted. - this.finished = false - - // Has it been destroyed - this.destroyed = false - - // Should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - const noDecode = !!(options && options.decodeStrings === false) - this.decodeStrings = !noDecode - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0 - - // A flag to see when we're in the middle of a write. - this.writing = false - - // When true all writes will be buffered until .uncork() call. - this.corked = 0 - - // A flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true - - // A flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false - - // The callback that's passed to _write(chunk, cb). - this.onwrite = onwrite.bind(undefined, stream) - - // The callback that the user supplies to write(chunk, encoding, cb). - this.writecb = null - - // The amount that is being written when _write is called. - this.writelen = 0 - - // Storage for data passed to the afterWrite() callback in case of - // synchronous _write() completion. - this.afterWriteTickInfo = null - resetBuffer(this) - - // Number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted. - this.pendingcb = 0 - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // Emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams. - this.prefinished = false - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'finish' (and potentially 'end'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Indicates whether the stream has errored. When true all write() calls - // should return false. This is needed since when autoDestroy - // is disabled we need a way to tell whether the stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - this[kOnFinished] = [] - } - function resetBuffer(state) { - state.buffered = [] - state.bufferedIndex = 0 - state.allBuffers = true - state.allNoop = true - } - WritableState.prototype.getBuffer = function getBuffer() { - return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) - } - ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { - __proto__: null, - get() { - return this.buffered.length - this.bufferedIndex - } - }) - function Writable(options) { - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(35960) - if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) - this._writableState = new WritableState(options, this, isDuplex) - if (options) { - if (typeof options.write === 'function') this._write = options.write - if (typeof options.writev === 'function') this._writev = options.writev - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.final === 'function') this._final = options.final - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - const state = this._writableState - if (!state.writing) { - clearBuffer(this, state) - } - finishMaybe(this, state) - }) - } - ObjectDefineProperty(Writable, SymbolHasInstance, { - __proto__: null, - value: function (object) { - if (FunctionPrototypeSymbolHasInstance(this, object)) return true - if (this !== Writable) return false - return object && object._writableState instanceof WritableState + : _stream$_readableStat4.errored) !== null && _ref !== undefined + ? _ref + : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined + ? undefined + : _stream$_writableStat4.errored) + ) +} +module.exports = { + kDestroyed, + isDisturbed, + kIsDisturbed, + isErrored, + kIsErrored, + isReadable, + kIsReadable, + kIsClosedPromise, + kControllerErrorFunction, + isClosed, + isDestroyed, + isDuplexNodeStream, + isFinished, + isIterable, + isReadableNodeStream, + isReadableStream, + isReadableEnded, + isReadableFinished, + isReadableErrored, + isNodeStream, + isWebStream, + isWritable, + isWritableNodeStream, + isWritableStream, + isWritableEnded, + isWritableFinished, + isWritableErrored, + isServerRequest, + isServerResponse, + willEmitClose, + isTransformStream +} + + +/***/ }), + +/***/ 12657: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const process = __webpack_require__(82530) + +/* replacement end */ +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +;('use strict') +const { + ArrayPrototypeSlice, + Error, + FunctionPrototypeSymbolHasInstance, + ObjectDefineProperty, + ObjectDefineProperties, + ObjectSetPrototypeOf, + StringPrototypeToLowerCase, + Symbol, + SymbolHasInstance +} = __webpack_require__(26701) +module.exports = Writable +Writable.WritableState = WritableState +const { EventEmitter: EE } = __webpack_require__(5939) +const Stream = (__webpack_require__(2854).Stream) +const { Buffer } = __webpack_require__(2486) +const destroyImpl = __webpack_require__(92573) +const { addAbortSignal } = __webpack_require__(29975) +const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(94263) +const { + ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED, + ERR_STREAM_ALREADY_FINISHED, + ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING +} = (__webpack_require__(4213).codes) +const { errorOrDestroy } = destroyImpl +ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) +ObjectSetPrototypeOf(Writable, Stream) +function nop() {} +const kOnFinished = Symbol('kOnFinished') +function WritableState(options, stream, isDuplex) { + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(35960) + + // Object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!(options && options.objectMode) + if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) + + // The point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write(). + this.highWaterMark = options + ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) + : getDefaultHighWaterMark(false) + + // if _final has been called. + this.finalCalled = false + + // drain event flag. + this.needDrain = false + // At the start of calling end() + this.ending = false + // When end() has been called, and returned. + this.ended = false + // When 'finish' is emitted. + this.finished = false + + // Has it been destroyed + this.destroyed = false + + // Should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + const noDecode = !!(options && options.decodeStrings === false) + this.decodeStrings = !noDecode + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' + + // Not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0 + + // A flag to see when we're in the middle of a write. + this.writing = false + + // When true all writes will be buffered until .uncork() call. + this.corked = 0 + + // A flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true + + // A flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false + + // The callback that's passed to _write(chunk, cb). + this.onwrite = onwrite.bind(undefined, stream) + + // The callback that the user supplies to write(chunk, encoding, cb). + this.writecb = null + + // The amount that is being written when _write is called. + this.writelen = 0 + + // Storage for data passed to the afterWrite() callback in case of + // synchronous _write() completion. + this.afterWriteTickInfo = null + resetBuffer(this) + + // Number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted. + this.pendingcb = 0 + + // Stream is still being constructed and cannot be + // destroyed until construction finished or failed. + // Async construction is opt in, therefore we start as + // constructed. + this.constructed = true + + // Emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams. + this.prefinished = false + + // True if the error was already emitted and should not be thrown again. + this.errorEmitted = false + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = !options || options.emitClose !== false + + // Should .destroy() be called after 'finish' (and potentially 'end'). + this.autoDestroy = !options || options.autoDestroy !== false + + // Indicates whether the stream has errored. When true all write() calls + // should return false. This is needed since when autoDestroy + // is disabled we need a way to tell whether the stream has failed. + this.errored = null + + // Indicates whether the stream has finished destroying. + this.closed = false + + // True if close has been emitted or would have been emitted + // depending on emitClose. + this.closeEmitted = false + this[kOnFinished] = [] +} +function resetBuffer(state) { + state.buffered = [] + state.bufferedIndex = 0 + state.allBuffers = true + state.allNoop = true +} +WritableState.prototype.getBuffer = function getBuffer() { + return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) +} +ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { + __proto__: null, + get() { + return this.buffered.length - this.bufferedIndex + } +}) +function Writable(options) { + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5. + const isDuplex = this instanceof __webpack_require__(35960) + if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) + this._writableState = new WritableState(options, this, isDuplex) + if (options) { + if (typeof options.write === 'function') this._write = options.write + if (typeof options.writev === 'function') this._writev = options.writev + if (typeof options.destroy === 'function') this._destroy = options.destroy + if (typeof options.final === 'function') this._final = options.final + if (typeof options.construct === 'function') this._construct = options.construct + if (options.signal) addAbortSignal(options.signal, this) + } + Stream.call(this, options) + destroyImpl.construct(this, () => { + const state = this._writableState + if (!state.writing) { + clearBuffer(this, state) } + finishMaybe(this, state) }) - - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) - } - function _write(stream, chunk, encoding, cb) { - const state = stream._writableState - if (typeof encoding === 'function') { - cb = encoding - encoding = state.defaultEncoding - } else { - if (!encoding) encoding = state.defaultEncoding - else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - if (typeof cb !== 'function') cb = nop - } - if (chunk === null) { - throw new ERR_STREAM_NULL_VALUES() - } else if (!state.objectMode) { - if (typeof chunk === 'string') { - if (state.decodeStrings !== false) { - chunk = Buffer.from(chunk, encoding) - encoding = 'buffer' - } - } else if (chunk instanceof Buffer) { - encoding = 'buffer' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) +} +ObjectDefineProperty(Writable, SymbolHasInstance, { + __proto__: null, + value: function (object) { + if (FunctionPrototypeSymbolHasInstance(this, object)) return true + if (this !== Writable) return false + return object && object._writableState instanceof WritableState + } +}) + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) +} +function _write(stream, chunk, encoding, cb) { + const state = stream._writableState + if (typeof encoding === 'function') { + cb = encoding + encoding = state.defaultEncoding + } else { + if (!encoding) encoding = state.defaultEncoding + else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) + if (typeof cb !== 'function') cb = nop + } + if (chunk === null) { + throw new ERR_STREAM_NULL_VALUES() + } else if (!state.objectMode) { + if (typeof chunk === 'string') { + if (state.decodeStrings !== false) { + chunk = Buffer.from(chunk, encoding) encoding = 'buffer' - } else { - throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) } + } else if (chunk instanceof Buffer) { + encoding = 'buffer' + } else if (Stream._isUint8Array(chunk)) { + chunk = Stream._uint8ArrayToBuffer(chunk) + encoding = 'buffer' + } else { + throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) + } + } + let err + if (state.ending) { + err = new ERR_STREAM_WRITE_AFTER_END() + } else if (state.destroyed) { + err = new ERR_STREAM_DESTROYED('write') + } + if (err) { + process.nextTick(cb, err) + errorOrDestroy(stream, err, true) + return err + } + state.pendingcb++ + return writeOrBuffer(stream, state, chunk, encoding, cb) +} +Writable.prototype.write = function (chunk, encoding, cb) { + return _write(this, chunk, encoding, cb) === true +} +Writable.prototype.cork = function () { + this._writableState.corked++ +} +Writable.prototype.uncork = function () { + const state = this._writableState + if (state.corked) { + state.corked-- + if (!state.writing) clearBuffer(this, state) + } +} +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) + if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) + this._writableState.defaultEncoding = encoding + return this +} + +// If we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, callback) { + const len = state.objectMode ? 1 : chunk.length + state.length += len + + // stream._write resets state.length + const ret = state.length < state.highWaterMark + // We must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true + if (state.writing || state.corked || state.errored || !state.constructed) { + state.buffered.push({ + chunk, + encoding, + callback + }) + if (state.allBuffers && encoding !== 'buffer') { + state.allBuffers = false } - let err - if (state.ending) { - err = new ERR_STREAM_WRITE_AFTER_END() - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('write') - } - if (err) { - process.nextTick(cb, err) - errorOrDestroy(stream, err, true) - return err - } - state.pendingcb++ - return writeOrBuffer(stream, state, chunk, encoding, cb) - } - Writable.prototype.write = function (chunk, encoding, cb) { - return _write(this, chunk, encoding, cb) === true - } - Writable.prototype.cork = function () { - this._writableState.corked++ - } - Writable.prototype.uncork = function () { - const state = this._writableState - if (state.corked) { - state.corked-- - if (!state.writing) clearBuffer(this, state) + if (state.allNoop && callback !== nop) { + state.allNoop = false } - } - Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) - if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - this._writableState.defaultEncoding = encoding - return this - } - - // If we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, chunk, encoding, callback) { - const len = state.objectMode ? 1 : chunk.length - state.length += len - - // stream._write resets state.length - const ret = state.length < state.highWaterMark - // We must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true - if (state.writing || state.corked || state.errored || !state.constructed) { - state.buffered.push({ - chunk, - encoding, - callback - }) - if (state.allBuffers && encoding !== 'buffer') { - state.allBuffers = false - } - if (state.allNoop && callback !== nop) { - state.allNoop = false - } - } else { - state.writelen = len - state.writecb = callback - state.writing = true - state.sync = true - stream._write(chunk, encoding, state.onwrite) - state.sync = false - } - - // Return false if errored or destroyed in order to break - // any synchronous while(stream.write(data)) loops. - return ret && !state.errored && !state.destroyed - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { + } else { state.writelen = len - state.writecb = cb + state.writecb = callback state.writing = true state.sync = true - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) - else if (writev) stream._writev(chunk, state.onwrite) - else stream._write(chunk, encoding, state.onwrite) + stream._write(chunk, encoding, state.onwrite) state.sync = false } - function onwriteError(stream, state, er, cb) { - --state.pendingcb - cb(er) - // Ensure callbacks are invoked even when autoDestroy is - // not enabled. Passing `er` here doesn't make sense since - // it's related to one specific write, not to the buffered - // writes. - errorBuffer(state) - // This can emit error, but error must always follow cb. - errorOrDestroy(stream, er) - } - function onwrite(stream, er) { - const state = stream._writableState - const sync = state.sync - const cb = state.writecb - if (typeof cb !== 'function') { - errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) - return + + // Return false if errored or destroyed in order to break + // any synchronous while(stream.write(data)) loops. + return ret && !state.errored && !state.destroyed +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len + state.writecb = cb + state.writing = true + state.sync = true + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) + else if (writev) stream._writev(chunk, state.onwrite) + else stream._write(chunk, encoding, state.onwrite) + state.sync = false +} +function onwriteError(stream, state, er, cb) { + --state.pendingcb + cb(er) + // Ensure callbacks are invoked even when autoDestroy is + // not enabled. Passing `er` here doesn't make sense since + // it's related to one specific write, not to the buffered + // writes. + errorBuffer(state) + // This can emit error, but error must always follow cb. + errorOrDestroy(stream, er) +} +function onwrite(stream, er) { + const state = stream._writableState + const sync = state.sync + const cb = state.writecb + if (typeof cb !== 'function') { + errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) + return + } + state.writing = false + state.writecb = null + state.length -= state.writelen + state.writelen = 0 + if (er) { + // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 + er.stack // eslint-disable-line no-unused-expressions + + if (!state.errored) { + state.errored = er } - state.writing = false - state.writecb = null - state.length -= state.writelen - state.writelen = 0 - if (er) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - er.stack // eslint-disable-line no-unused-expressions - - if (!state.errored) { - state.errored = er - } - - // In case of duplex streams we need to notify the readable side of the - // error. - if (stream._readableState && !stream._readableState.errored) { - stream._readableState.errored = er - } - if (sync) { - process.nextTick(onwriteError, stream, state, er, cb) - } else { - onwriteError(stream, state, er, cb) - } + + // In case of duplex streams we need to notify the readable side of the + // error. + if (stream._readableState && !stream._readableState.errored) { + stream._readableState.errored = er + } + if (sync) { + process.nextTick(onwriteError, stream, state, er, cb) } else { - if (state.buffered.length > state.bufferedIndex) { - clearBuffer(stream, state) - } - if (sync) { - // It is a common case that the callback passed to .write() is always - // the same. In that case, we do not schedule a new nextTick(), but - // rather just increase a counter, to improve performance and avoid - // memory allocations. - if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { - state.afterWriteTickInfo.count++ - } else { - state.afterWriteTickInfo = { - count: 1, - cb, - stream, - state - } - process.nextTick(afterWriteTick, state.afterWriteTickInfo) - } + onwriteError(stream, state, er, cb) + } + } else { + if (state.buffered.length > state.bufferedIndex) { + clearBuffer(stream, state) + } + if (sync) { + // It is a common case that the callback passed to .write() is always + // the same. In that case, we do not schedule a new nextTick(), but + // rather just increase a counter, to improve performance and avoid + // memory allocations. + if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { + state.afterWriteTickInfo.count++ } else { - afterWrite(stream, state, 1, cb) + state.afterWriteTickInfo = { + count: 1, + cb, + stream, + state + } + process.nextTick(afterWriteTick, state.afterWriteTickInfo) } + } else { + afterWrite(stream, state, 1, cb) } } - function afterWriteTick({ stream, state, count, cb }) { - state.afterWriteTickInfo = null - return afterWrite(stream, state, count, cb) +} +function afterWriteTick({ stream, state, count, cb }) { + state.afterWriteTickInfo = null + return afterWrite(stream, state, count, cb) +} +function afterWrite(stream, state, count, cb) { + const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain + if (needDrain) { + state.needDrain = false + stream.emit('drain') } - function afterWrite(stream, state, count, cb) { - const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain - if (needDrain) { - state.needDrain = false - stream.emit('drain') - } - while (count-- > 0) { - state.pendingcb-- - cb() - } - if (state.destroyed) { - errorBuffer(state) - } - finishMaybe(stream, state) + while (count-- > 0) { + state.pendingcb-- + cb() } - - // If there's something in the buffer waiting, then invoke callbacks. - function errorBuffer(state) { - if (state.writing) { - return - } - for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { - var _state$errored - const { chunk, callback } = state.buffered[n] - const len = state.objectMode ? 1 : chunk.length - state.length -= len - callback( - (_state$errored = state.errored) !== null && _state$errored !== undefined - ? _state$errored - : new ERR_STREAM_DESTROYED('write') - ) - } - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - var _state$errored2 - onfinishCallbacks[i]( - (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined - ? _state$errored2 - : new ERR_STREAM_DESTROYED('end') - ) - } - resetBuffer(state) + if (state.destroyed) { + errorBuffer(state) } - - // If there's something in the buffer waiting, then process it. - function clearBuffer(stream, state) { - if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { - return - } - const { buffered, bufferedIndex, objectMode } = state - const bufferedLength = buffered.length - bufferedIndex - if (!bufferedLength) { - return - } - let i = bufferedIndex - state.bufferProcessing = true - if (bufferedLength > 1 && stream._writev) { - state.pendingcb -= bufferedLength - 1 - const callback = state.allNoop - ? nop - : (err) => { - for (let n = i; n < buffered.length; ++n) { - buffered[n].callback(err) - } - } - // Make a copy of `buffered` if it's going to be used by `callback` above, - // since `doWrite` will mutate the array. - const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) - chunks.allBuffers = state.allBuffers - doWrite(stream, state, true, state.length, chunks, '', callback) + finishMaybe(stream, state) +} + +// If there's something in the buffer waiting, then invoke callbacks. +function errorBuffer(state) { + if (state.writing) { + return + } + for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { + var _state$errored + const { chunk, callback } = state.buffered[n] + const len = state.objectMode ? 1 : chunk.length + state.length -= len + callback( + (_state$errored = state.errored) !== null && _state$errored !== undefined + ? _state$errored + : new ERR_STREAM_DESTROYED('write') + ) + } + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + var _state$errored2 + onfinishCallbacks[i]( + (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined + ? _state$errored2 + : new ERR_STREAM_DESTROYED('end') + ) + } + resetBuffer(state) +} + +// If there's something in the buffer waiting, then process it. +function clearBuffer(stream, state) { + if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { + return + } + const { buffered, bufferedIndex, objectMode } = state + const bufferedLength = buffered.length - bufferedIndex + if (!bufferedLength) { + return + } + let i = bufferedIndex + state.bufferProcessing = true + if (bufferedLength > 1 && stream._writev) { + state.pendingcb -= bufferedLength - 1 + const callback = state.allNoop + ? nop + : (err) => { + for (let n = i; n < buffered.length; ++n) { + buffered[n].callback(err) + } + } + // Make a copy of `buffered` if it's going to be used by `callback` above, + // since `doWrite` will mutate the array. + const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) + chunks.allBuffers = state.allBuffers + doWrite(stream, state, true, state.length, chunks, '', callback) + resetBuffer(state) + } else { + do { + const { chunk, encoding, callback } = buffered[i] + buffered[i++] = null + const len = objectMode ? 1 : chunk.length + doWrite(stream, state, false, len, chunk, encoding, callback) + } while (i < buffered.length && !state.writing) + if (i === buffered.length) { resetBuffer(state) + } else if (i > 256) { + buffered.splice(0, i) + state.bufferedIndex = 0 } else { - do { - const { chunk, encoding, callback } = buffered[i] - buffered[i++] = null - const len = objectMode ? 1 : chunk.length - doWrite(stream, state, false, len, chunk, encoding, callback) - } while (i < buffered.length && !state.writing) - if (i === buffered.length) { - resetBuffer(state) - } else if (i > 256) { - buffered.splice(0, i) - state.bufferedIndex = 0 - } else { - state.bufferedIndex = i - } + state.bufferedIndex = i } - state.bufferProcessing = false } - Writable.prototype._write = function (chunk, encoding, cb) { - if (this._writev) { - this._writev( - [ - { - chunk, - encoding - } - ], - cb - ) - } else { - throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') + state.bufferProcessing = false +} +Writable.prototype._write = function (chunk, encoding, cb) { + if (this._writev) { + this._writev( + [ + { + chunk, + encoding + } + ], + cb + ) + } else { + throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') + } +} +Writable.prototype._writev = null +Writable.prototype.end = function (chunk, encoding, cb) { + const state = this._writableState + if (typeof chunk === 'function') { + cb = chunk + chunk = null + encoding = null + } else if (typeof encoding === 'function') { + cb = encoding + encoding = null + } + let err + if (chunk !== null && chunk !== undefined) { + const ret = _write(this, chunk, encoding) + if (ret instanceof Error) { + err = ret } } - Writable.prototype._writev = null - Writable.prototype.end = function (chunk, encoding, cb) { - const state = this._writableState - if (typeof chunk === 'function') { - cb = chunk - chunk = null - encoding = null - } else if (typeof encoding === 'function') { - cb = encoding - encoding = null - } - let err - if (chunk !== null && chunk !== undefined) { - const ret = _write(this, chunk, encoding) - if (ret instanceof Error) { - err = ret - } - } - - // .end() fully uncorks. - if (state.corked) { - state.corked = 1 - this.uncork() + + // .end() fully uncorks. + if (state.corked) { + state.corked = 1 + this.uncork() + } + if (err) { + // Do nothing... + } else if (!state.errored && !state.ending) { + // This is forgiving in terms of unnecessary calls to end() and can hide + // logic errors. However, usually such errors are harmless and causing a + // hard error can be disproportionately destructive. It is not always + // trivial for the user to determine whether end() needs to be called + // or not. + + state.ending = true + finishMaybe(this, state, true) + state.ended = true + } else if (state.finished) { + err = new ERR_STREAM_ALREADY_FINISHED('end') + } else if (state.destroyed) { + err = new ERR_STREAM_DESTROYED('end') + } + if (typeof cb === 'function') { + if (err || state.finished) { + process.nextTick(cb, err) + } else { + state[kOnFinished].push(cb) + } + } + return this +} +function needFinish(state) { + return ( + state.ending && + !state.destroyed && + state.constructed && + state.length === 0 && + !state.errored && + state.buffered.length === 0 && + !state.finished && + !state.writing && + !state.errorEmitted && + !state.closeEmitted + ) +} +function callFinal(stream, state) { + let called = false + function onFinish(err) { + if (called) { + errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) + return } + called = true + state.pendingcb-- if (err) { - // Do nothing... - } else if (!state.errored && !state.ending) { - // This is forgiving in terms of unnecessary calls to end() and can hide - // logic errors. However, usually such errors are harmless and causing a - // hard error can be disproportionately destructive. It is not always - // trivial for the user to determine whether end() needs to be called - // or not. - - state.ending = true - finishMaybe(this, state, true) - state.ended = true - } else if (state.finished) { - err = new ERR_STREAM_ALREADY_FINISHED('end') - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('end') - } - if (typeof cb === 'function') { - if (err || state.finished) { - process.nextTick(cb, err) - } else { - state[kOnFinished].push(cb) - } + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i](err) + } + errorOrDestroy(stream, err, state.sync) + } else if (needFinish(state)) { + state.prefinished = true + stream.emit('prefinish') + // Backwards compat. Don't check state.sync here. + // Some streams assume 'finish' will be emitted + // asynchronously relative to _final callback. + state.pendingcb++ + process.nextTick(finish, stream, state) + } + } + state.sync = true + state.pendingcb++ + try { + stream._final(onFinish) + } catch (err) { + onFinish(err) + } + state.sync = false +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.finalCalled = true + callFinal(stream, state) + } else { + state.prefinished = true + stream.emit('prefinish') } - return this } - function needFinish(state) { - return ( - state.ending && - !state.destroyed && - state.constructed && - state.length === 0 && - !state.errored && - state.buffered.length === 0 && - !state.finished && - !state.writing && - !state.errorEmitted && - !state.closeEmitted - ) - } - function callFinal(stream, state) { - let called = false - function onFinish(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) - return - } - called = true - state.pendingcb-- - if (err) { - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i](err) - } - errorOrDestroy(stream, err, state.sync) +} +function finishMaybe(stream, state, sync) { + if (needFinish(state)) { + prefinish(stream, state) + if (state.pendingcb === 0) { + if (sync) { + state.pendingcb++ + process.nextTick( + (stream, state) => { + if (needFinish(state)) { + finish(stream, state) + } else { + state.pendingcb-- + } + }, + stream, + state + ) } else if (needFinish(state)) { - state.prefinished = true - stream.emit('prefinish') - // Backwards compat. Don't check state.sync here. - // Some streams assume 'finish' will be emitted - // asynchronously relative to _final callback. state.pendingcb++ - process.nextTick(finish, stream, state) - } - } - state.sync = true - state.pendingcb++ - try { - stream._final(onFinish) - } catch (err) { - onFinish(err) - } - state.sync = false - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.finalCalled = true - callFinal(stream, state) - } else { - state.prefinished = true - stream.emit('prefinish') + finish(stream, state) } } } - function finishMaybe(stream, state, sync) { - if (needFinish(state)) { - prefinish(stream, state) - if (state.pendingcb === 0) { - if (sync) { - state.pendingcb++ - process.nextTick( - (stream, state) => { - if (needFinish(state)) { - finish(stream, state) - } else { - state.pendingcb-- - } - }, - stream, - state - ) - } else if (needFinish(state)) { - state.pendingcb++ - finish(stream, state) - } - } - } +} +function finish(stream, state) { + state.pendingcb-- + state.finished = true + const onfinishCallbacks = state[kOnFinished].splice(0) + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i]() } - function finish(stream, state) { - state.pendingcb-- - state.finished = true - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i]() - } - stream.emit('finish') - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well. - const rState = stream._readableState - const autoDestroy = - !rState || - (rState.autoDestroy && - // We don't expect the readable to ever 'end' - // if readable is explicitly set to false. - (rState.endEmitted || rState.readable === false)) - if (autoDestroy) { - stream.destroy() - } + stream.emit('finish') + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well. + const rState = stream._readableState + const autoDestroy = + !rState || + (rState.autoDestroy && + // We don't expect the readable to ever 'end' + // if readable is explicitly set to false. + (rState.endEmitted || rState.readable === false)) + if (autoDestroy) { + stream.destroy() + } + } +} +ObjectDefineProperties(Writable.prototype, { + closed: { + __proto__: null, + get() { + return this._writableState ? this._writableState.closed : false } - } - ObjectDefineProperties(Writable.prototype, { - closed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.closed : false - } + }, + destroyed: { + __proto__: null, + get() { + return this._writableState ? this._writableState.destroyed : false }, - destroyed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.destroyed : false - }, - set(value) { - // Backward compatibility, the user is explicitly managing destroyed. - if (this._writableState) { - this._writableState.destroyed = value - } + set(value) { + // Backward compatibility, the user is explicitly managing destroyed. + if (this._writableState) { + this._writableState.destroyed = value } + } + }, + writable: { + __proto__: null, + get() { + const w = this._writableState + // w.writable === false means that this is part of a Duplex stream + // where the writable side was disabled upon construction. + // Compat. The user might manually disable writable side through + // deprecated setter. + return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended }, - writable: { - __proto__: null, - get() { - const w = this._writableState - // w.writable === false means that this is part of a Duplex stream - // where the writable side was disabled upon construction. - // Compat. The user might manually disable writable side through - // deprecated setter. - return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended - }, - set(val) { - // Backwards compatible. - if (this._writableState) { - this._writableState.writable = !!val - } - } - }, - writableFinished: { - __proto__: null, - get() { - return this._writableState ? this._writableState.finished : false - } - }, - writableObjectMode: { - __proto__: null, - get() { - return this._writableState ? this._writableState.objectMode : false - } - }, - writableBuffer: { - __proto__: null, - get() { - return this._writableState && this._writableState.getBuffer() - } - }, - writableEnded: { - __proto__: null, - get() { - return this._writableState ? this._writableState.ending : false - } - }, - writableNeedDrain: { - __proto__: null, - get() { - const wState = this._writableState - if (!wState) return false - return !wState.destroyed && !wState.ending && wState.needDrain - } - }, - writableHighWaterMark: { - __proto__: null, - get() { - return this._writableState && this._writableState.highWaterMark - } - }, - writableCorked: { - __proto__: null, - get() { - return this._writableState ? this._writableState.corked : 0 - } - }, - writableLength: { - __proto__: null, - get() { - return this._writableState && this._writableState.length - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._writableState ? this._writableState.errored : null - } - }, - writableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._writableState.writable !== false && - (this._writableState.destroyed || this._writableState.errored) && - !this._writableState.finished - ) + set(val) { + // Backwards compatible. + if (this._writableState) { + this._writableState.writable = !!val } } - }) - const destroy = destroyImpl.destroy - Writable.prototype.destroy = function (err, cb) { - const state = this._writableState - - // Invoke pending callbacks. - if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { - process.nextTick(errorBuffer, state) + }, + writableFinished: { + __proto__: null, + get() { + return this._writableState ? this._writableState.finished : false } - destroy.call(this, err, cb) - return this - } - Writable.prototype._undestroy = destroyImpl.undestroy - Writable.prototype._destroy = function (err, cb) { - cb(err) - } - Writable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) - } - let webStreamsAdapters - - // Lazy to avoid circular references - function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters - } - Writable.fromWeb = function (writableStream, options) { - return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) - } - Writable.toWeb = function (streamWritable) { - return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) - } - - - /***/ }), - - /***/ 99639: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - /* eslint jsdoc/require-jsdoc: "error" */ - - - - const { - ArrayIsArray, - ArrayPrototypeIncludes, - ArrayPrototypeJoin, - ArrayPrototypeMap, - NumberIsInteger, - NumberIsNaN, - NumberMAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER, - NumberParseInt, - ObjectPrototypeHasOwnProperty, - RegExpPrototypeExec, - String, - StringPrototypeToUpperCase, - StringPrototypeTrim - } = __webpack_require__(26701) - const { - hideStackFrames, - codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } - } = __webpack_require__(4213) - const { normalizeEncoding } = __webpack_require__(72978) - const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(72978).types) - const signals = {} - - /** - * @param {*} value - * @returns {boolean} - */ - function isInt32(value) { - return value === (value | 0) - } - - /** - * @param {*} value - * @returns {boolean} - */ - function isUint32(value) { - return value === value >>> 0 - } - const octalReg = /^[0-7]+$/ - const modeDesc = 'must be a 32-bit unsigned integer or an octal string' - - /** - * Parse and validate values that will be converted into mode_t (the S_* - * constants). Only valid numbers and octal strings are allowed. They could be - * converted to 32-bit unsigned integers or non-negative signed integers in the - * C++ land, but any value higher than 0o777 will result in platform-specific - * behaviors. - * - * @param {*} value Values to be validated - * @param {string} name Name of the argument - * @param {number} [def] If specified, will be returned for invalid values - * @returns {number} - */ - function parseFileMode(value, name, def) { - if (typeof value === 'undefined') { - value = def + }, + writableObjectMode: { + __proto__: null, + get() { + return this._writableState ? this._writableState.objectMode : false } - if (typeof value === 'string') { - if (RegExpPrototypeExec(octalReg, value) === null) { - throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) - } - value = NumberParseInt(value, 8) + }, + writableBuffer: { + __proto__: null, + get() { + return this._writableState && this._writableState.getBuffer() } - validateUint32(value, name) - return value - } - - /** - * @callback validateInteger - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateInteger} */ - const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - }) - - /** - * @callback validateInt32 - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateInt32} */ - const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { - // The defaults for min and max correspond to the limits of 32-bit integers. - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + }, + writableEnded: { + __proto__: null, + get() { + return this._writableState ? this._writableState.ending : false } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + }, + writableNeedDrain: { + __proto__: null, + get() { + const wState = this._writableState + if (!wState) return false + return !wState.destroyed && !wState.ending && wState.needDrain } - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) + }, + writableHighWaterMark: { + __proto__: null, + get() { + return this._writableState && this._writableState.highWaterMark } - }) - - /** - * @callback validateUint32 - * @param {*} value - * @param {string} name - * @param {number|boolean} [positive=false] - * @returns {asserts value is number} - */ - - /** @type {validateUint32} */ - const validateUint32 = hideStackFrames((value, name, positive = false) => { - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + }, + writableCorked: { + __proto__: null, + get() { + return this._writableState ? this._writableState.corked : 0 } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + }, + writableLength: { + __proto__: null, + get() { + return this._writableState && this._writableState.length } - const min = positive ? 1 : 0 - // 2 ** 32 === 4294967296 - const max = 4294967295 - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) + }, + errored: { + __proto__: null, + enumerable: false, + get() { + return this._writableState ? this._writableState.errored : null } - }) - - /** - * @callback validateString - * @param {*} value - * @param {string} name - * @returns {asserts value is string} - */ - - /** @type {validateString} */ - function validateString(value, name) { - if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) - } - - /** - * @callback validateNumber - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - - /** @type {validateNumber} */ - function validateNumber(value, name, min = undefined, max) { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if ( - (min != null && value < min) || - (max != null && value > max) || - ((min != null || max != null) && NumberIsNaN(value)) - ) { - throw new ERR_OUT_OF_RANGE( - name, - `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, - value + }, + writableAborted: { + __proto__: null, + enumerable: false, + get: function () { + return !!( + this._writableState.writable !== false && + (this._writableState.destroyed || this._writableState.errored) && + !this._writableState.finished ) } } - - /** - * @callback validateOneOf - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} oneOf - */ - - /** @type {validateOneOf} */ - const validateOneOf = hideStackFrames((value, name, oneOf) => { - if (!ArrayPrototypeIncludes(oneOf, value)) { - const allowed = ArrayPrototypeJoin( - ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), - ', ' - ) - const reason = 'must be one of: ' + allowed - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } - }) - - /** - * @callback validateBoolean - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean} - */ - - /** @type {validateBoolean} */ - function validateBoolean(value, name) { - if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) +}) +const destroy = destroyImpl.destroy +Writable.prototype.destroy = function (err, cb) { + const state = this._writableState + + // Invoke pending callbacks. + if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { + process.nextTick(errorBuffer, state) + } + destroy.call(this, err, cb) + return this +} +Writable.prototype._undestroy = destroyImpl.undestroy +Writable.prototype._destroy = function (err, cb) { + cb(err) +} +Writable.prototype[EE.captureRejectionSymbol] = function (err) { + this.destroy(err) +} +let webStreamsAdapters + +// Lazy to avoid circular references +function lazyWebStreams() { + if (webStreamsAdapters === undefined) webStreamsAdapters = {} + return webStreamsAdapters +} +Writable.fromWeb = function (writableStream, options) { + return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) +} +Writable.toWeb = function (streamWritable) { + return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) +} + + +/***/ }), + +/***/ 99639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint jsdoc/require-jsdoc: "error" */ + + + +const { + ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, + ArrayPrototypeMap, + NumberIsInteger, + NumberIsNaN, + NumberMAX_SAFE_INTEGER, + NumberMIN_SAFE_INTEGER, + NumberParseInt, + ObjectPrototypeHasOwnProperty, + RegExpPrototypeExec, + String, + StringPrototypeToUpperCase, + StringPrototypeTrim +} = __webpack_require__(26701) +const { + hideStackFrames, + codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } +} = __webpack_require__(4213) +const { normalizeEncoding } = __webpack_require__(72978) +const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(72978).types) +const signals = {} + +/** + * @param {*} value + * @returns {boolean} + */ +function isInt32(value) { + return value === (value | 0) +} + +/** + * @param {*} value + * @returns {boolean} + */ +function isUint32(value) { + return value === value >>> 0 +} +const octalReg = /^[0-7]+$/ +const modeDesc = 'must be a 32-bit unsigned integer or an octal string' + +/** + * Parse and validate values that will be converted into mode_t (the S_* + * constants). Only valid numbers and octal strings are allowed. They could be + * converted to 32-bit unsigned integers or non-negative signed integers in the + * C++ land, but any value higher than 0o777 will result in platform-specific + * behaviors. + * + * @param {*} value Values to be validated + * @param {string} name Name of the argument + * @param {number} [def] If specified, will be returned for invalid values + * @returns {number} + */ +function parseFileMode(value, name, def) { + if (typeof value === 'undefined') { + value = def + } + if (typeof value === 'string') { + if (RegExpPrototypeExec(octalReg, value) === null) { + throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) + } + value = NumberParseInt(value, 8) + } + validateUint32(value, name) + return value +} + +/** + * @callback validateInteger + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateInteger} */ +const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { + if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) + if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) +}) + +/** + * @callback validateInt32 + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateInt32} */ +const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { + // The defaults for min and max correspond to the limits of 32-bit integers. + if (typeof value !== 'number') { + throw new ERR_INVALID_ARG_TYPE(name, 'number', value) } - - /** - * @param {any} options - * @param {string} key - * @param {boolean} defaultValue - * @returns {boolean} - */ - function getOwnPropertyValueOrDefault(options, key, defaultValue) { - return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] + if (!NumberIsInteger(value)) { + throw new ERR_OUT_OF_RANGE(name, 'an integer', value) } - - /** - * @callback validateObject - * @param {*} value - * @param {string} name - * @param {{ - * allowArray?: boolean, - * allowFunction?: boolean, - * nullable?: boolean - * }} [options] - */ - - /** @type {validateObject} */ - const validateObject = hideStackFrames((value, name, options = null) => { - const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) - const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) - const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) - if ( - (!nullable && value === null) || - (!allowArray && ArrayIsArray(value)) || - (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) - ) { - throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) - } - }) - - /** - * @callback validateDictionary - We are using the Web IDL Standard definition - * of "dictionary" here, which means any value - * whose Type is either Undefined, Null, or - * Object (which includes functions). - * @param {*} value - * @param {string} name - * @see https://webidl.spec.whatwg.org/#es-dictionary - * @see https://tc39.es/ecma262/#table-typeof-operator-results - */ - - /** @type {validateDictionary} */ - const validateDictionary = hideStackFrames((value, name) => { - if (value != null && typeof value !== 'object' && typeof value !== 'function') { - throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) - } - }) - - /** - * @callback validateArray - * @param {*} value - * @param {string} name - * @param {number} [minLength] - * @returns {asserts value is any[]} - */ - - /** @type {validateArray} */ - const validateArray = hideStackFrames((value, name, minLength = 0) => { - if (!ArrayIsArray(value)) { - throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) - } - if (value.length < minLength) { - const reason = `must be longer than ${minLength}` - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } - }) - - /** - * @callback validateStringArray - * @param {*} value - * @param {string} name - * @returns {asserts value is string[]} - */ - - /** @type {validateStringArray} */ - function validateStringArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateString(value[i], `${name}[${i}]`) - } + if (value < min || value > max) { + throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) } - - /** - * @callback validateBooleanArray - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean[]} - */ - - /** @type {validateBooleanArray} */ - function validateBooleanArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateBoolean(value[i], `${name}[${i}]`) - } +}) + +/** + * @callback validateUint32 + * @param {*} value + * @param {string} name + * @param {number|boolean} [positive=false] + * @returns {asserts value is number} + */ + +/** @type {validateUint32} */ +const validateUint32 = hideStackFrames((value, name, positive = false) => { + if (typeof value !== 'number') { + throw new ERR_INVALID_ARG_TYPE(name, 'number', value) } - - /** - * @param {*} signal - * @param {string} [name='signal'] - * @returns {asserts signal is keyof signals} - */ - function validateSignalName(signal, name = 'signal') { - validateString(signal, name) - if (signals[signal] === undefined) { - if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { - throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') - } - throw new ERR_UNKNOWN_SIGNAL(signal) - } + if (!NumberIsInteger(value)) { + throw new ERR_OUT_OF_RANGE(name, 'an integer', value) } - - /** - * @callback validateBuffer - * @param {*} buffer - * @param {string} [name='buffer'] - * @returns {asserts buffer is ArrayBufferView} - */ - - /** @type {validateBuffer} */ - const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { - if (!isArrayBufferView(buffer)) { - throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) - } - }) - - /** - * @param {string} data - * @param {string} encoding - */ - function validateEncoding(data, encoding) { - const normalizedEncoding = normalizeEncoding(encoding) - const length = data.length - if (normalizedEncoding === 'hex' && length % 2 !== 0) { - throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) - } + const min = positive ? 1 : 0 + // 2 ** 32 === 4294967296 + const max = 4294967295 + if (value < min || value > max) { + throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) } - - /** - * Check that the port number is not NaN when coerced to a number, - * is an integer and that it falls within the legal range of port numbers. - * @param {*} port - * @param {string} [name='Port'] - * @param {boolean} [allowZero=true] - * @returns {number} - */ - function validatePort(port, name = 'Port', allowZero = true) { - if ( - (typeof port !== 'number' && typeof port !== 'string') || - (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || - +port !== +port >>> 0 || - port > 0xffff || - (port === 0 && !allowZero) - ) { - throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) - } - return port | 0 +}) + +/** + * @callback validateString + * @param {*} value + * @param {string} name + * @returns {asserts value is string} + */ + +/** @type {validateString} */ +function validateString(value, name) { + if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) +} + +/** + * @callback validateNumber + * @param {*} value + * @param {string} name + * @param {number} [min] + * @param {number} [max] + * @returns {asserts value is number} + */ + +/** @type {validateNumber} */ +function validateNumber(value, name, min = undefined, max) { + if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) + if ( + (min != null && value < min) || + (max != null && value > max) || + ((min != null || max != null) && NumberIsNaN(value)) + ) { + throw new ERR_OUT_OF_RANGE( + name, + `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, + value + ) } - - /** - * @callback validateAbortSignal - * @param {*} signal - * @param {string} name - */ - - /** @type {validateAbortSignal} */ - const validateAbortSignal = hideStackFrames((signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } - }) - - /** - * @callback validateFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - - /** @type {validateFunction} */ - const validateFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) - }) - - /** - * @callback validatePlainFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - - /** @type {validatePlainFunction} */ - const validatePlainFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) - }) - - /** - * @callback validateUndefined - * @param {*} value - * @param {string} name - * @returns {asserts value is undefined} - */ - - /** @type {validateUndefined} */ - const validateUndefined = hideStackFrames((value, name) => { - if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) - }) - - /** - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} union - */ - function validateUnion(value, name, union) { - if (!ArrayPrototypeIncludes(union, value)) { - throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) - } +} + +/** + * @callback validateOneOf + * @template T + * @param {T} value + * @param {string} name + * @param {T[]} oneOf + */ + +/** @type {validateOneOf} */ +const validateOneOf = hideStackFrames((value, name, oneOf) => { + if (!ArrayPrototypeIncludes(oneOf, value)) { + const allowed = ArrayPrototypeJoin( + ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), + ', ' + ) + const reason = 'must be one of: ' + allowed + throw new ERR_INVALID_ARG_VALUE(name, value, reason) } - - /* - The rules for the Link header field are described here: - https://www.rfc-editor.org/rfc/rfc8288.html#section-3 - - This regex validates any string surrounded by angle brackets - (not necessarily a valid URI reference) followed by zero or more - link-params separated by semicolons. - */ - const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ - - /** - * @param {any} value - * @param {string} name - */ - function validateLinkHeaderFormat(value, name) { - if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { - throw new ERR_INVALID_ARG_VALUE( - name, - value, - 'must be an array or string of format "; rel=preload; as=style"' - ) - } +}) + +/** + * @callback validateBoolean + * @param {*} value + * @param {string} name + * @returns {asserts value is boolean} + */ + +/** @type {validateBoolean} */ +function validateBoolean(value, name) { + if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) +} + +/** + * @param {any} options + * @param {string} key + * @param {boolean} defaultValue + * @returns {boolean} + */ +function getOwnPropertyValueOrDefault(options, key, defaultValue) { + return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] +} + +/** + * @callback validateObject + * @param {*} value + * @param {string} name + * @param {{ + * allowArray?: boolean, + * allowFunction?: boolean, + * nullable?: boolean + * }} [options] + */ + +/** @type {validateObject} */ +const validateObject = hideStackFrames((value, name, options = null) => { + const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) + const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) + const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) + if ( + (!nullable && value === null) || + (!allowArray && ArrayIsArray(value)) || + (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) + ) { + throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) } - - /** - * @param {any} hints - * @return {string} - */ - function validateLinkHeaderValue(hints) { - if (typeof hints === 'string') { - validateLinkHeaderFormat(hints, 'hints') - return hints - } else if (ArrayIsArray(hints)) { - const hintsLength = hints.length - let result = '' - if (hintsLength === 0) { - return result - } - for (let i = 0; i < hintsLength; i++) { - const link = hints[i] - validateLinkHeaderFormat(link, 'hints') - result += link - if (i !== hintsLength - 1) { - result += ', ' - } - } - return result - } +}) + +/** + * @callback validateDictionary - We are using the Web IDL Standard definition + * of "dictionary" here, which means any value + * whose Type is either Undefined, Null, or + * Object (which includes functions). + * @param {*} value + * @param {string} name + * @see https://webidl.spec.whatwg.org/#es-dictionary + * @see https://tc39.es/ecma262/#table-typeof-operator-results + */ + +/** @type {validateDictionary} */ +const validateDictionary = hideStackFrames((value, name) => { + if (value != null && typeof value !== 'object' && typeof value !== 'function') { + throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) + } +}) + +/** + * @callback validateArray + * @param {*} value + * @param {string} name + * @param {number} [minLength] + * @returns {asserts value is any[]} + */ + +/** @type {validateArray} */ +const validateArray = hideStackFrames((value, name, minLength = 0) => { + if (!ArrayIsArray(value)) { + throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) + } + if (value.length < minLength) { + const reason = `must be longer than ${minLength}` + throw new ERR_INVALID_ARG_VALUE(name, value, reason) + } +}) + +/** + * @callback validateStringArray + * @param {*} value + * @param {string} name + * @returns {asserts value is string[]} + */ + +/** @type {validateStringArray} */ +function validateStringArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`) + } +} + +/** + * @callback validateBooleanArray + * @param {*} value + * @param {string} name + * @returns {asserts value is boolean[]} + */ + +/** @type {validateBooleanArray} */ +function validateBooleanArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`) + } +} + +/** + * @param {*} signal + * @param {string} [name='signal'] + * @returns {asserts signal is keyof signals} + */ +function validateSignalName(signal, name = 'signal') { + validateString(signal, name) + if (signals[signal] === undefined) { + if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { + throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') + } + throw new ERR_UNKNOWN_SIGNAL(signal) + } +} + +/** + * @callback validateBuffer + * @param {*} buffer + * @param {string} [name='buffer'] + * @returns {asserts buffer is ArrayBufferView} + */ + +/** @type {validateBuffer} */ +const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { + if (!isArrayBufferView(buffer)) { + throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) + } +}) + +/** + * @param {string} data + * @param {string} encoding + */ +function validateEncoding(data, encoding) { + const normalizedEncoding = normalizeEncoding(encoding) + const length = data.length + if (normalizedEncoding === 'hex' && length % 2 !== 0) { + throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) + } +} + +/** + * Check that the port number is not NaN when coerced to a number, + * is an integer and that it falls within the legal range of port numbers. + * @param {*} port + * @param {string} [name='Port'] + * @param {boolean} [allowZero=true] + * @returns {number} + */ +function validatePort(port, name = 'Port', allowZero = true) { + if ( + (typeof port !== 'number' && typeof port !== 'string') || + (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || + +port !== +port >>> 0 || + port > 0xffff || + (port === 0 && !allowZero) + ) { + throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) + } + return port | 0 +} + +/** + * @callback validateAbortSignal + * @param {*} signal + * @param {string} name + */ + +/** @type {validateAbortSignal} */ +const validateAbortSignal = hideStackFrames((signal, name) => { + if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { + throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) + } +}) + +/** + * @callback validateFunction + * @param {*} value + * @param {string} name + * @returns {asserts value is Function} + */ + +/** @type {validateFunction} */ +const validateFunction = hideStackFrames((value, name) => { + if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) +}) + +/** + * @callback validatePlainFunction + * @param {*} value + * @param {string} name + * @returns {asserts value is Function} + */ + +/** @type {validatePlainFunction} */ +const validatePlainFunction = hideStackFrames((value, name) => { + if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) +}) + +/** + * @callback validateUndefined + * @param {*} value + * @param {string} name + * @returns {asserts value is undefined} + */ + +/** @type {validateUndefined} */ +const validateUndefined = hideStackFrames((value, name) => { + if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) +}) + +/** + * @template T + * @param {T} value + * @param {string} name + * @param {T[]} union + */ +function validateUnion(value, name, union) { + if (!ArrayPrototypeIncludes(union, value)) { + throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) + } +} + +/* + The rules for the Link header field are described here: + https://www.rfc-editor.org/rfc/rfc8288.html#section-3 + + This regex validates any string surrounded by angle brackets + (not necessarily a valid URI reference) followed by zero or more + link-params separated by semicolons. +*/ +const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ + +/** + * @param {any} value + * @param {string} name + */ +function validateLinkHeaderFormat(value, name) { + if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { throw new ERR_INVALID_ARG_VALUE( - 'hints', - hints, + name, + value, 'must be an array or string of format "; rel=preload; as=style"' ) } - module.exports = { - isInt32, - isUint32, - parseFileMode, - validateArray, - validateStringArray, - validateBooleanArray, - validateBoolean, - validateBuffer, - validateDictionary, - validateEncoding, - validateFunction, - validateInt32, - validateInteger, - validateNumber, - validateObject, - validateOneOf, - validatePlainFunction, - validatePort, - validateSignalName, - validateString, - validateUint32, - validateUndefined, - validateUnion, - validateAbortSignal, - validateLinkHeaderValue - } - - - /***/ }), - - /***/ 79659: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const CustomStream = __webpack_require__(82192) - const promises = __webpack_require__(76201) - const originalDestroy = CustomStream.Readable.destroy - module.exports = CustomStream.Readable - - // Explicit export naming is needed for ESM - module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer - module.exports._isUint8Array = CustomStream._isUint8Array - module.exports.isDisturbed = CustomStream.isDisturbed - module.exports.isErrored = CustomStream.isErrored - module.exports.isReadable = CustomStream.isReadable - module.exports.Readable = CustomStream.Readable - module.exports.Writable = CustomStream.Writable - module.exports.Duplex = CustomStream.Duplex - module.exports.Transform = CustomStream.Transform - module.exports.PassThrough = CustomStream.PassThrough - module.exports.addAbortSignal = CustomStream.addAbortSignal - module.exports.finished = CustomStream.finished - module.exports.destroy = CustomStream.destroy - module.exports.destroy = originalDestroy - module.exports.pipeline = CustomStream.pipeline - module.exports.compose = CustomStream.compose - Object.defineProperty(CustomStream, 'promises', { - configurable: true, - enumerable: true, - get() { - return promises +} + +/** + * @param {any} hints + * @return {string} + */ +function validateLinkHeaderValue(hints) { + if (typeof hints === 'string') { + validateLinkHeaderFormat(hints, 'hints') + return hints + } else if (ArrayIsArray(hints)) { + const hintsLength = hints.length + let result = '' + if (hintsLength === 0) { + return result } - }) - module.exports.Stream = CustomStream.Stream - - // Allow default importing - module.exports["default"] = module.exports - - - /***/ }), - - /***/ 4213: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(72978) - - /* - This file is a reduced and adapted version of the main lib/internal/errors.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/errors.js - - Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) - with the upstream file. - */ - - const AggregateError = globalThis.AggregateError || CustomAggregateError - const kIsNodeError = Symbol('kIsNodeError') - const kTypes = [ - 'string', - 'function', - 'number', - 'object', - // Accept 'Function' and 'Object' as alternative to the lower cased version. - 'Function', - 'Object', - 'boolean', - 'bigint', - 'symbol' - ] - const classRegExp = /^([A-Z][a-z0-9]*)+$/ - const nodeInternalPrefix = '__node_internal_' - const codes = {} - function assert(value, message) { - if (!value) { - throw new codes.ERR_INTERNAL_ASSERTION(message) - } - } - - // Only use this for integers! Decimal numbers do not work with this function. - function addNumericalSeparator(val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` - } - function getMessage(key, msg, args) { - if (typeof msg === 'function') { - assert( - msg.length <= args.length, - // Default options do not count. - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` - ) - return msg(...args) + for (let i = 0; i < hintsLength; i++) { + const link = hints[i] + validateLinkHeaderFormat(link, 'hints') + result += link + if (i !== hintsLength - 1) { + result += ', ' + } } - const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length + return result + } + throw new ERR_INVALID_ARG_VALUE( + 'hints', + hints, + 'must be an array or string of format "; rel=preload; as=style"' + ) +} +module.exports = { + isInt32, + isUint32, + parseFileMode, + validateArray, + validateStringArray, + validateBooleanArray, + validateBoolean, + validateBuffer, + validateDictionary, + validateEncoding, + validateFunction, + validateInt32, + validateInteger, + validateNumber, + validateObject, + validateOneOf, + validatePlainFunction, + validatePort, + validateSignalName, + validateString, + validateUint32, + validateUndefined, + validateUnion, + validateAbortSignal, + validateLinkHeaderValue +} + + +/***/ }), + +/***/ 79659: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const CustomStream = __webpack_require__(82192) +const promises = __webpack_require__(76201) +const originalDestroy = CustomStream.Readable.destroy +module.exports = CustomStream.Readable + +// Explicit export naming is needed for ESM +module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer +module.exports._isUint8Array = CustomStream._isUint8Array +module.exports.isDisturbed = CustomStream.isDisturbed +module.exports.isErrored = CustomStream.isErrored +module.exports.isReadable = CustomStream.isReadable +module.exports.Readable = CustomStream.Readable +module.exports.Writable = CustomStream.Writable +module.exports.Duplex = CustomStream.Duplex +module.exports.Transform = CustomStream.Transform +module.exports.PassThrough = CustomStream.PassThrough +module.exports.addAbortSignal = CustomStream.addAbortSignal +module.exports.finished = CustomStream.finished +module.exports.destroy = CustomStream.destroy +module.exports.destroy = originalDestroy +module.exports.pipeline = CustomStream.pipeline +module.exports.compose = CustomStream.compose +Object.defineProperty(CustomStream, 'promises', { + configurable: true, + enumerable: true, + get() { + return promises + } +}) +module.exports.Stream = CustomStream.Stream + +// Allow default importing +module.exports["default"] = module.exports + + +/***/ }), + +/***/ 4213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(72978) + +/* + This file is a reduced and adapted version of the main lib/internal/errors.js file defined at + + https://github.com/nodejs/node/blob/master/lib/internal/errors.js + + Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) + with the upstream file. +*/ + +const AggregateError = globalThis.AggregateError || CustomAggregateError +const kIsNodeError = Symbol('kIsNodeError') +const kTypes = [ + 'string', + 'function', + 'number', + 'object', + // Accept 'Function' and 'Object' as alternative to the lower cased version. + 'Function', + 'Object', + 'boolean', + 'bigint', + 'symbol' +] +const classRegExp = /^([A-Z][a-z0-9]*)+$/ +const nodeInternalPrefix = '__node_internal_' +const codes = {} +function assert(value, message) { + if (!value) { + throw new codes.ERR_INTERNAL_ASSERTION(message) + } +} + +// Only use this for integers! Decimal numbers do not work with this function. +function addNumericalSeparator(val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} +function getMessage(key, msg, args) { + if (typeof msg === 'function') { assert( - expectedLength === args.length, - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` + msg.length <= args.length, + // Default options do not count. + `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` ) - if (args.length === 0) { - return msg - } - return format(msg, ...args) + return msg(...args) + } + const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length + assert( + expectedLength === args.length, + `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` + ) + if (args.length === 0) { + return msg + } + return format(msg, ...args) +} +function E(code, message, Base) { + if (!Base) { + Base = Error } - function E(code, message, Base) { - if (!Base) { - Base = Error + class NodeError extends Base { + constructor(...args) { + super(getMessage(code, message, args)) } - class NodeError extends Base { - constructor(...args) { - super(getMessage(code, message, args)) - } - toString() { - return `${this.name} [${code}]: ${this.message}` - } + toString() { + return `${this.name} [${code}]: ${this.message}` } - Object.defineProperties(NodeError.prototype, { - name: { - value: Base.name, - writable: true, - enumerable: false, - configurable: true + } + Object.defineProperties(NodeError.prototype, { + name: { + value: Base.name, + writable: true, + enumerable: false, + configurable: true + }, + toString: { + value() { + return `${this.name} [${code}]: ${this.message}` }, - toString: { - value() { - return `${this.name} [${code}]: ${this.message}` - }, - writable: true, - enumerable: false, - configurable: true - } - }) - NodeError.prototype.code = code - NodeError.prototype[kIsNodeError] = true - codes[code] = NodeError - } - function hideStackFrames(fn) { - // We rename the functions that will be hidden to cut off the stacktrace - // at the outermost one - const hidden = nodeInternalPrefix + fn.name - Object.defineProperty(fn, 'name', { - value: hidden - }) - return fn - } - function aggregateTwoErrors(innerError, outerError) { - if (innerError && outerError && innerError !== outerError) { - if (Array.isArray(outerError.errors)) { - // If `outerError` is already an `AggregateError`. - outerError.errors.push(innerError) - return outerError - } - const err = new AggregateError([outerError, innerError], outerError.message) - err.code = outerError.code - return err - } - return innerError || outerError - } - class AbortError extends Error { - constructor(message = 'The operation was aborted', options = undefined) { - if (options !== undefined && typeof options !== 'object') { - throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) - } - super(message, options) - this.code = 'ABORT_ERR' - this.name = 'AbortError' - } - } - E('ERR_ASSERTION', '%s', Error) - E( - 'ERR_INVALID_ARG_TYPE', - (name, expected, actual) => { - assert(typeof name === 'string', "'name' must be a string") - if (!Array.isArray(expected)) { - expected = [expected] - } - let msg = 'The ' - if (name.endsWith(' argument')) { - // For cases like 'first argument' - msg += `${name} ` + writable: true, + enumerable: false, + configurable: true + } + }) + NodeError.prototype.code = code + NodeError.prototype[kIsNodeError] = true + codes[code] = NodeError +} +function hideStackFrames(fn) { + // We rename the functions that will be hidden to cut off the stacktrace + // at the outermost one + const hidden = nodeInternalPrefix + fn.name + Object.defineProperty(fn, 'name', { + value: hidden + }) + return fn +} +function aggregateTwoErrors(innerError, outerError) { + if (innerError && outerError && innerError !== outerError) { + if (Array.isArray(outerError.errors)) { + // If `outerError` is already an `AggregateError`. + outerError.errors.push(innerError) + return outerError + } + const err = new AggregateError([outerError, innerError], outerError.message) + err.code = outerError.code + return err + } + return innerError || outerError +} +class AbortError extends Error { + constructor(message = 'The operation was aborted', options = undefined) { + if (options !== undefined && typeof options !== 'object') { + throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) + } + super(message, options) + this.code = 'ABORT_ERR' + this.name = 'AbortError' + } +} +E('ERR_ASSERTION', '%s', Error) +E( + 'ERR_INVALID_ARG_TYPE', + (name, expected, actual) => { + assert(typeof name === 'string', "'name' must be a string") + if (!Array.isArray(expected)) { + expected = [expected] + } + let msg = 'The ' + if (name.endsWith(' argument')) { + // For cases like 'first argument' + msg += `${name} ` + } else { + msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` + } + msg += 'must be ' + const types = [] + const instances = [] + const other = [] + for (const value of expected) { + assert(typeof value === 'string', 'All expected entries have to be of type string') + if (kTypes.includes(value)) { + types.push(value.toLowerCase()) + } else if (classRegExp.test(value)) { + instances.push(value) } else { - msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` - } - msg += 'must be ' - const types = [] - const instances = [] - const other = [] - for (const value of expected) { - assert(typeof value === 'string', 'All expected entries have to be of type string') - if (kTypes.includes(value)) { - types.push(value.toLowerCase()) - } else if (classRegExp.test(value)) { - instances.push(value) - } else { - assert(value !== 'object', 'The value "object" should be written as "Object"') - other.push(value) - } - } - - // Special handle `object` in case other instances are allowed to outline - // the differences between each other. - if (instances.length > 0) { - const pos = types.indexOf('object') - if (pos !== -1) { - types.splice(types, pos, 1) - instances.push('Object') - } - } - if (types.length > 0) { - switch (types.length) { - case 1: - msg += `of type ${types[0]}` - break - case 2: - msg += `one of type ${types[0]} or ${types[1]}` - break - default: { - const last = types.pop() - msg += `one of type ${types.join(', ')}, or ${last}` - } - } - if (instances.length > 0 || other.length > 0) { - msg += ' or ' - } + assert(value !== 'object', 'The value "object" should be written as "Object"') + other.push(value) } - if (instances.length > 0) { - switch (instances.length) { - case 1: - msg += `an instance of ${instances[0]}` - break - case 2: - msg += `an instance of ${instances[0]} or ${instances[1]}` - break - default: { - const last = instances.pop() - msg += `an instance of ${instances.join(', ')}, or ${last}` - } - } - if (other.length > 0) { - msg += ' or ' - } + } + + // Special handle `object` in case other instances are allowed to outline + // the differences between each other. + if (instances.length > 0) { + const pos = types.indexOf('object') + if (pos !== -1) { + types.splice(types, pos, 1) + instances.push('Object') } - switch (other.length) { - case 0: - break + } + if (types.length > 0) { + switch (types.length) { case 1: - if (other[0].toLowerCase() !== other[0]) { - msg += 'an ' - } - msg += `${other[0]}` + msg += `of type ${types[0]}` break case 2: - msg += `one of ${other[0]} or ${other[1]}` + msg += `one of type ${types[0]} or ${types[1]}` break default: { - const last = other.pop() - msg += `one of ${other.join(', ')}, or ${last}` + const last = types.pop() + msg += `one of type ${types.join(', ')}, or ${last}` } } - if (actual == null) { - msg += `. Received ${actual}` - } else if (typeof actual === 'function' && actual.name) { - msg += `. Received function ${actual.name}` - } else if (typeof actual === 'object') { - var _actual$constructor - if ( - (_actual$constructor = actual.constructor) !== null && - _actual$constructor !== undefined && - _actual$constructor.name - ) { - msg += `. Received an instance of ${actual.constructor.name}` - } else { - const inspected = inspect(actual, { - depth: -1 - }) - msg += `. Received ${inspected}` - } - } else { - let inspected = inspect(actual, { - colors: false - }) - if (inspected.length > 25) { - inspected = `${inspected.slice(0, 25)}...` - } - msg += `. Received type ${typeof actual} (${inspected})` + if (instances.length > 0 || other.length > 0) { + msg += ' or ' } - return msg - }, - TypeError - ) - E( - 'ERR_INVALID_ARG_VALUE', - (name, value, reason = 'is invalid') => { - let inspected = inspect(value) - if (inspected.length > 128) { - inspected = inspected.slice(0, 128) + '...' - } - const type = name.includes('.') ? 'property' : 'argument' - return `The ${type} '${name}' ${reason}. Received ${inspected}` - }, - TypeError - ) - E( - 'ERR_INVALID_RETURN_VALUE', - (input, name, value) => { - var _value$constructor - const type = - value !== null && - value !== undefined && - (_value$constructor = value.constructor) !== null && - _value$constructor !== undefined && - _value$constructor.name - ? `instance of ${value.constructor.name}` - : `type ${typeof value}` - return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` - }, - TypeError - ) - E( - 'ERR_MISSING_ARGS', - (...args) => { - assert(args.length > 0, 'At least one arg needs to be specified') - let msg - const len = args.length - args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') - switch (len) { + } + if (instances.length > 0) { + switch (instances.length) { case 1: - msg += `The ${args[0]} argument` + msg += `an instance of ${instances[0]}` break case 2: - msg += `The ${args[0]} and ${args[1]} arguments` - break - default: - { - const last = args.pop() - msg += `The ${args.join(', ')}, and ${last} arguments` - } + msg += `an instance of ${instances[0]} or ${instances[1]}` break - } - return `${msg} must be specified` - }, - TypeError - ) - E( - 'ERR_OUT_OF_RANGE', - (str, range, input) => { - assert(range, 'Missing "range" argument') - let received - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > 2n ** 32n || input < -(2n ** 32n)) { - received = addNumericalSeparator(received) - } - received += 'n' - } else { - received = inspect(input) - } - return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` - }, - RangeError - ) - E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) - E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) - E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) - E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) - E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) - E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) - E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) - E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) - E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) - E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) - E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) - module.exports = { - AbortError, - aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), - hideStackFrames, - codes - } - - - /***/ }), - - /***/ 26701: - /***/ ((module) => { - - "use strict"; - - - /* - This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js - - Don't try to replace with the original file and keep it up to date with the upstream file. - */ - module.exports = { - ArrayIsArray(self) { - return Array.isArray(self) - }, - ArrayPrototypeIncludes(self, el) { - return self.includes(el) - }, - ArrayPrototypeIndexOf(self, el) { - return self.indexOf(el) - }, - ArrayPrototypeJoin(self, sep) { - return self.join(sep) - }, - ArrayPrototypeMap(self, fn) { - return self.map(fn) - }, - ArrayPrototypePop(self, el) { - return self.pop(el) - }, - ArrayPrototypePush(self, el) { - return self.push(el) - }, - ArrayPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - Error, - FunctionPrototypeCall(fn, thisArgs, ...args) { - return fn.call(thisArgs, ...args) - }, - FunctionPrototypeSymbolHasInstance(self, instance) { - return Function.prototype[Symbol.hasInstance].call(self, instance) - }, - MathFloor: Math.floor, - Number, - NumberIsInteger: Number.isInteger, - NumberIsNaN: Number.isNaN, - NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, - NumberParseInt: Number.parseInt, - ObjectDefineProperties(self, props) { - return Object.defineProperties(self, props) - }, - ObjectDefineProperty(self, name, prop) { - return Object.defineProperty(self, name, prop) - }, - ObjectGetOwnPropertyDescriptor(self, name) { - return Object.getOwnPropertyDescriptor(self, name) - }, - ObjectKeys(obj) { - return Object.keys(obj) - }, - ObjectSetPrototypeOf(target, proto) { - return Object.setPrototypeOf(target, proto) - }, - Promise, - PromisePrototypeCatch(self, fn) { - return self.catch(fn) - }, - PromisePrototypeThen(self, thenFn, catchFn) { - return self.then(thenFn, catchFn) - }, - PromiseReject(err) { - return Promise.reject(err) - }, - ReflectApply: Reflect.apply, - RegExpPrototypeTest(self, value) { - return self.test(value) - }, - SafeSet: Set, - String, - StringPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - StringPrototypeToLowerCase(self) { - return self.toLowerCase() - }, - StringPrototypeToUpperCase(self) { - return self.toUpperCase() - }, - StringPrototypeTrim(self) { - return self.trim() - }, - Symbol, - SymbolFor: Symbol.for, - SymbolAsyncIterator: Symbol.asyncIterator, - SymbolHasInstance: Symbol.hasInstance, - SymbolIterator: Symbol.iterator, - TypedArrayPrototypeSet(self, buf, len) { - return self.set(buf, len) - }, - Uint8Array - } - - - /***/ }), - - /***/ 72978: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const bufferModule = __webpack_require__(2486) - const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor - const Blob = globalThis.Blob || bufferModule.Blob - /* eslint-disable indent */ - const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - // eslint-disable-next-line indent - return b instanceof Blob - } - : function isBlob(b) { - return false - } - /* eslint-enable indent */ - - // This is a simplified version of AggregateError - class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) - } - let message = '' - for (let i = 0; i < errors.length; i++) { - message += ` ${errors[i].stack}\n` - } - super(message) - this.name = 'AggregateError' - this.errors = errors - } - } - module.exports = { - AggregateError, - kEmptyObject: Object.freeze({}), - once(callback) { - let called = false - return function (...args) { - if (called) { - return + default: { + const last = instances.pop() + msg += `an instance of ${instances.join(', ')}, or ${last}` } - called = true - callback.apply(this, args) } - }, - createDeferredPromise: function () { - let resolve - let reject - - // eslint-disable-next-line promise/param-names - const promise = new Promise((res, rej) => { - resolve = res - reject = rej - }) - return { - promise, - resolve, - reject + if (other.length > 0) { + msg += ' or ' } - }, - promisify(fn) { - return new Promise((resolve, reject) => { - fn((err, ...args) => { - if (err) { - return reject(err) - } - return resolve(...args) - }) - }) - }, - debuglog() { - return function () {} - }, - format(format, ...args) { - // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args - return format.replace(/%([sdifj])/g, function (...[_unused, type]) { - const replacement = args.shift() - if (type === 'f') { - return replacement.toFixed(6) - } else if (type === 'j') { - return JSON.stringify(replacement) - } else if (type === 's' && typeof replacement === 'object') { - const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' - return `${ctor} {}`.trim() - } else { - return replacement.toString() + } + switch (other.length) { + case 0: + break + case 1: + if (other[0].toLowerCase() !== other[0]) { + msg += 'an ' } - }) - }, - inspect(value) { - // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options - switch (typeof value) { - case 'string': - if (value.includes("'")) { - if (!value.includes('"')) { - return `"${value}"` - } else if (!value.includes('`') && !value.includes('${')) { - return `\`${value}\`` - } - } - return `'${value}'` - case 'number': - if (isNaN(value)) { - return 'NaN' - } else if (Object.is(value, -0)) { - return String(value) - } - return value - case 'bigint': - return `${String(value)}n` - case 'boolean': - case 'undefined': - return String(value) - case 'object': - return '{}' + msg += `${other[0]}` + break + case 2: + msg += `one of ${other[0]} or ${other[1]}` + break + default: { + const last = other.pop() + msg += `one of ${other.join(', ')}, or ${last}` } - }, - types: { - isAsyncFunction(fn) { - return fn instanceof AsyncFunction - }, - isArrayBufferView(arr) { - return ArrayBuffer.isView(arr) + } + if (actual == null) { + msg += `. Received ${actual}` + } else if (typeof actual === 'function' && actual.name) { + msg += `. Received function ${actual.name}` + } else if (typeof actual === 'object') { + var _actual$constructor + if ( + (_actual$constructor = actual.constructor) !== null && + _actual$constructor !== undefined && + _actual$constructor.name + ) { + msg += `. Received an instance of ${actual.constructor.name}` + } else { + const inspected = inspect(actual, { + depth: -1 + }) + msg += `. Received ${inspected}` } - }, - isBlob - } - module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') - - - /***/ }), - - /***/ 82192: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* replacement start */ - - const { Buffer } = __webpack_require__(2486) - - /* replacement end */ - // 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') - const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(26701) - const { - promisify: { custom: customPromisify } - } = __webpack_require__(72978) - const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(57395) - const { - codes: { ERR_ILLEGAL_CONSTRUCTOR } - } = __webpack_require__(4213) - const compose = __webpack_require__(65729) - const { pipeline } = __webpack_require__(33939) - const { destroyer } = __webpack_require__(92573) - const eos = __webpack_require__(24597) - const internalBuffer = {} - const promises = __webpack_require__(76201) - const utils = __webpack_require__(46342) - const Stream = (module.exports = __webpack_require__(2854).Stream) - Stream.isDisturbed = utils.isDisturbed - Stream.isErrored = utils.isErrored - Stream.isReadable = utils.isReadable - Stream.Readable = __webpack_require__(3845) - for (const key of ObjectKeys(streamReturningOperators)) { - const op = streamReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return Stream.Readable.from(ReflectApply(op, this, args)) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) - } - for (const key of ObjectKeys(promiseReturningOperators)) { - const op = promiseReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() + } else { + let inspected = inspect(actual, { + colors: false + }) + if (inspected.length > 25) { + inspected = `${inspected.slice(0, 25)}...` } - return ReflectApply(op, this, args) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) - } - Stream.Writable = __webpack_require__(12657) - Stream.Duplex = __webpack_require__(35960) - Stream.Transform = __webpack_require__(57425) - Stream.PassThrough = __webpack_require__(38368) - Stream.pipeline = pipeline - const { addAbortSignal } = __webpack_require__(29975) - Stream.addAbortSignal = addAbortSignal - Stream.finished = eos - Stream.destroy = destroyer - Stream.compose = compose - ObjectDefineProperty(Stream, 'promises', { - __proto__: null, - configurable: true, - enumerable: true, - get() { - return promises - } - }) - ObjectDefineProperty(pipeline, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.pipeline + msg += `. Received type ${typeof actual} (${inspected})` } - }) - ObjectDefineProperty(eos, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.finished + return msg + }, + TypeError +) +E( + 'ERR_INVALID_ARG_VALUE', + (name, value, reason = 'is invalid') => { + let inspected = inspect(value) + if (inspected.length > 128) { + inspected = inspected.slice(0, 128) + '...' } - }) - - // Backwards-compat with node 0.4.x - Stream.Stream = Stream - Stream._isUint8Array = function isUint8Array(value) { - return value instanceof Uint8Array - } - Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - } - - - /***/ }), - - /***/ 76201: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - "use strict"; - - - const { ArrayPrototypePop, Promise } = __webpack_require__(26701) - const { isIterable, isNodeStream, isWebStream } = __webpack_require__(46342) - const { pipelineImpl: pl } = __webpack_require__(33939) - const { finished } = __webpack_require__(24597) - __webpack_require__(82192) - function pipeline(...streams) { - return new Promise((resolve, reject) => { - let signal - let end - const lastArg = streams[streams.length - 1] - if ( - lastArg && - typeof lastArg === 'object' && - !isNodeStream(lastArg) && - !isIterable(lastArg) && - !isWebStream(lastArg) - ) { - const options = ArrayPrototypePop(streams) - signal = options.signal - end = options.end - } - pl( - streams, - (err, value) => { - if (err) { - reject(err) - } else { - resolve(value) - } - }, + const type = name.includes('.') ? 'property' : 'argument' + return `The ${type} '${name}' ${reason}. Received ${inspected}` + }, + TypeError +) +E( + 'ERR_INVALID_RETURN_VALUE', + (input, name, value) => { + var _value$constructor + const type = + value !== null && + value !== undefined && + (_value$constructor = value.constructor) !== null && + _value$constructor !== undefined && + _value$constructor.name + ? `instance of ${value.constructor.name}` + : `type ${typeof value}` + return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` + }, + TypeError +) +E( + 'ERR_MISSING_ARGS', + (...args) => { + assert(args.length > 0, 'At least one arg needs to be specified') + let msg + const len = args.length + args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') + switch (len) { + case 1: + msg += `The ${args[0]} argument` + break + case 2: + msg += `The ${args[0]} and ${args[1]} arguments` + break + default: { - signal, - end + const last = args.pop() + msg += `The ${args.join(', ')}, and ${last} arguments` } - ) - }) - } - module.exports = { - finished, - pipeline - } - - - /***/ }), - - /***/ 71674: - /***/ ((module) => { - - var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; - var XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string'; - - function Generator(options) { - this._options = options = options || {}; - - var prefixes = options.prefixes || {}; - this._prefixByIri = {}; - var prefixIris = []; - for (var prefix in prefixes) { - var iri = prefixes[prefix]; - if (isString(iri)) { - this._prefixByIri[iri] = prefix; - prefixIris.push(iri); - } - } - var iriList = prefixIris.join('|').replace(/[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); - this._prefixRegex = new RegExp('^(' + iriList + ')([a-zA-Z][\\-_a-zA-Z0-9]*)$'); - this._usedPrefixes = {}; - this._sparqlStar = options.sparqlStar; - this._indent = isString(options.indent) ? options.indent : ' '; - this._newline = isString(options.newline) ? options.newline : '\n'; - this._explicitDatatype = Boolean(options.explicitDatatype); - } - - // Converts the parsed query object into a SPARQL query - Generator.prototype.toQuery = function (q) { - var query = ''; - - if (q.queryType) - query += q.queryType.toUpperCase() + ' '; - if (q.reduced) - query += 'REDUCED '; - if (q.distinct) - query += 'DISTINCT '; - - if (q.variables){ - query += mapJoin(q.variables, undefined, function (variable) { - return isTerm(variable) ? this.toEntity(variable) : - '(' + this.toExpression(variable.expression) + ' AS ' + variableToString(variable.variable) + ')'; - }, this) + ' '; - } - else if (q.template) - query += this.group(q.template, true) + this._newline; - - if (q.from) - query += this.graphs('FROM ', q.from.default) + this.graphs('FROM NAMED ', q.from.named); - if (q.where) - query += 'WHERE ' + this.group(q.where, true) + this._newline; - - if (q.updates) - query += mapJoin(q.updates, ';' + this._newline, this.toUpdate, this); - - if (q.group) - query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { - var result = isTerm(it.expression) - ? this.toEntity(it.expression) - : '(' + this.toExpression(it.expression) + ')'; - return it.variable ? '(' + result + ' AS ' + variableToString(it.variable) + ')' : result; - }, this) + this._newline; - if (q.having) - query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; - if (q.order) - query += 'ORDER BY ' + mapJoin(q.order, undefined, function (it) { - var expr = '(' + this.toExpression(it.expression) + ')'; - return !it.descending ? expr : 'DESC ' + expr; - }, this) + this._newline; - - if (q.offset) - query += 'OFFSET ' + q.offset + this._newline; - if (q.limit) - query += 'LIMIT ' + q.limit + this._newline; - - if (q.values) - query += this.values(q); - - // stringify prefixes at the end to mark used ones - query = this.baseAndPrefixes(q) + query; - return query.trim(); - }; - - Generator.prototype.baseAndPrefixes = function (q) { - var base = q.base ? ('BASE <' + q.base + '>' + this._newline) : ''; - var prefixes = ''; - for (var key in q.prefixes) { - if (this._options.allPrefixes || this._usedPrefixes[key]) - prefixes += 'PREFIX ' + key + ': <' + q.prefixes[key] + '>' + this._newline; - } - return base + prefixes; - }; - - // Converts the parsed SPARQL pattern into a SPARQL pattern - Generator.prototype.toPattern = function (pattern) { - var type = pattern.type || (pattern instanceof Array) && 'array' || - (pattern.subject && pattern.predicate && pattern.object ? 'triple' : ''); - if (!(type in this)) - throw new Error('Unknown entry type: ' + type); - return this[type](pattern); - }; - - Generator.prototype.triple = function (t) { - return this.toEntity(t.subject) + ' ' + this.toEntity(t.predicate) + ' ' + this.toEntity(t.object) + '.'; - }; - - Generator.prototype.array = function (items) { - return mapJoin(items, this._newline, this.toPattern, this); - }; - - Generator.prototype.bgp = function (bgp) { - return this.encodeTriples(bgp.triples); - }; - - Generator.prototype.encodeTriples = function (triples) { - if (!triples.length) - return ''; - - var parts = [], subject = undefined, predicate = undefined; - for (var i = 0; i < triples.length; i++) { - var triple = triples[i]; - // Triple with different subject - if (!equalTerms(triple.subject, subject)) { - // Terminate previous triple - if (subject) - parts.push('.' + this._newline); - subject = triple.subject; - predicate = triple.predicate; - parts.push(this.toEntity(subject), ' ', this.toEntity(predicate)); - } - // Triple with same subject but different predicate - else if (!equalTerms(triple.predicate, predicate)) { - predicate = triple.predicate; - parts.push(';' + this._newline, this._indent, this.toEntity(predicate)); - } - // Triple with same subject and predicate - else { - parts.push(','); - } - parts.push(' ', this.toEntity(triple.object)); + break } - parts.push('.'); - - return parts.join(''); - } - - Generator.prototype.graph = function (graph) { - return 'GRAPH ' + this.toEntity(graph.name) + ' ' + this.group(graph); - }; - - Generator.prototype.graphs = function (keyword, graphs) { - return !graphs || graphs.length === 0 ? '' : - mapJoin(graphs, '', function (g) { return keyword + this.toEntity(g) + this._newline; }, this) - } - - Generator.prototype.group = function (group, inline) { - group = inline !== true ? this.array(group.patterns || group.triples) - : this.toPattern(group.type !== 'group' ? group : group.patterns); - return group.indexOf(this._newline) === -1 ? '{ ' + group + ' }' : '{' + this._newline + this.indent(group) + this._newline + '}'; - }; - - Generator.prototype.query = function (query) { - return this.toQuery(query); - }; - - Generator.prototype.filter = function (filter) { - return 'FILTER(' + this.toExpression(filter.expression) + ')'; - }; - - Generator.prototype.bind = function (bind) { - return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + variableToString(bind.variable) + ')'; - }; - - Generator.prototype.optional = function (optional) { - return 'OPTIONAL ' + this.group(optional); - }; - - Generator.prototype.union = function (union) { - return mapJoin(union.patterns, this._newline + 'UNION' + this._newline, function (p) { return this.group(p, true); }, this); - }; - - Generator.prototype.minus = function (minus) { - return 'MINUS ' + this.group(minus); - }; - - Generator.prototype.values = function (valuesList) { - // Gather unique keys - var keys = Object.keys(valuesList.values.reduce(function (keyHash, values) { - for (var key in values) keyHash[key] = true; - return keyHash; - }, {})); - // Check whether simple syntax can be used - var lparen, rparen; - if (keys.length === 1) { - lparen = rparen = ''; + return `${msg} must be specified` + }, + TypeError +) +E( + 'ERR_OUT_OF_RANGE', + (str, range, input) => { + assert(range, 'Missing "range" argument') + let received + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > 2n ** 32n || input < -(2n ** 32n)) { + received = addNumericalSeparator(received) + } + received += 'n' } else { - lparen = '('; - rparen = ')'; - } - // Create value rows - return 'VALUES ' + lparen + keys.join(' ') + rparen + ' {' + this._newline + - mapJoin(valuesList.values, this._newline, function (values) { - return ' ' + lparen + mapJoin(keys, undefined, function (key) { - return values[key] ? this.toEntity(values[key]) : 'UNDEF'; - }, this) + rparen; - }, this) + this._newline + '}'; - }; - - Generator.prototype.service = function (service) { - return 'SERVICE ' + (service.silent ? 'SILENT ' : '') + this.toEntity(service.name) + ' ' + - this.group(service); - }; - - // Converts the parsed expression object into a SPARQL expression - Generator.prototype.toExpression = function (expr) { - if (isTerm(expr)) { - return this.toEntity(expr); - } - switch (expr.type.toLowerCase()) { - case 'aggregate': - return expr.aggregation.toUpperCase() + - '(' + (expr.distinct ? 'DISTINCT ' : '') + this.toExpression(expr.expression) + - (typeof expr.separator === 'string' ? '; SEPARATOR = ' + '"' + expr.separator.replace(escape, escapeReplacer) + '"' : '') + ')'; - case 'functioncall': - return this.toEntity(expr.function) + '(' + mapJoin(expr.args, ', ', this.toExpression, this) + ')'; - case 'operation': - var operator = expr.operator.toUpperCase(), args = expr.args || []; - switch (expr.operator.toLowerCase()) { - // Infix operators - case '<': - case '>': - case '>=': - case '<=': - case '&&': - case '||': - case '=': - case '!=': - case '+': - case '-': - case '*': - case '/': - return (isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + - ' ' + operator + ' ' + - (isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); - // Unary operators - case '!': - return '!(' + this.toExpression(args[0]) + ')'; - case 'uplus': - return '+(' + this.toExpression(args[0]) + ')'; - case 'uminus': - return '-(' + this.toExpression(args[0]) + ')'; - // IN and NOT IN - case 'notin': - operator = 'NOT IN'; - case 'in': - return this.toExpression(args[0]) + ' ' + operator + - '(' + (isString(args[1]) ? args[1] : mapJoin(args[1], ', ', this.toExpression, this)) + ')'; - // EXISTS and NOT EXISTS - case 'notexists': - operator = 'NOT EXISTS'; - case 'exists': - return operator + ' ' + this.group(args[0], true); - // Other expressions - default: - return operator + '(' + mapJoin(args, ', ', this.toExpression, this) + ')'; - } - default: - throw new Error('Unknown expression type: ' + expr.type); + received = inspect(input) } - }; - - // Converts the parsed entity (or property path) into a SPARQL entity - Generator.prototype.toEntity = function (value) { - if (isTerm(value)) { - switch (value.termType) { - // variable, * selector, or blank node - case 'Wildcard': - return '*'; - case 'Variable': - return variableToString(value); - case 'BlankNode': - return '_:' + value.value; - // literal - case 'Literal': - var lexical = value.value || '', language = value.language || '', datatype = value.datatype; - value = '"' + lexical.replace(escape, escapeReplacer) + '"'; - if (language){ - value += '@' + language; - } else if (datatype) { - // Abbreviate literals when possible - if (!this._explicitDatatype) { - switch (datatype.value) { - case XSD_STRING: - return value; - case XSD_INTEGER: - if (/^\d+$/.test(lexical)) - // Add space to avoid confusion with decimals in broken parsers - return lexical + ' '; - } - } - value += '^^' + this.encodeIRI(datatype.value); - } - return value; - case 'Quad': - if (!this._sparqlStar) - throw new Error('SPARQL* support is not enabled'); - - if (value.graph && value.graph.termType !== "DefaultGraph") { - return '<< GRAPH ' + - this.toEntity(value.graph) + - ' { ' + - this.toEntity(value.subject) + ' ' + - this.toEntity(value.predicate) + ' ' + - this.toEntity(value.object) + - ' } ' + - ' >>' - } - else { - return ( - '<< ' + - this.toEntity(value.subject) + ' ' + - this.toEntity(value.predicate) + ' ' + - this.toEntity(value.object) + - ' >>' - ); - } - // IRI - default: - return this.encodeIRI(value.value); + return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` + }, + RangeError +) +E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) +E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) +E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) +E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) +E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) +E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) +E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) +E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) +E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) +E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) +E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) +module.exports = { + AbortError, + aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), + hideStackFrames, + codes +} + + +/***/ }), + +/***/ 26701: +/***/ ((module) => { + +"use strict"; + + +/* + This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at + + https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js + + Don't try to replace with the original file and keep it up to date with the upstream file. +*/ +module.exports = { + ArrayIsArray(self) { + return Array.isArray(self) + }, + ArrayPrototypeIncludes(self, el) { + return self.includes(el) + }, + ArrayPrototypeIndexOf(self, el) { + return self.indexOf(el) + }, + ArrayPrototypeJoin(self, sep) { + return self.join(sep) + }, + ArrayPrototypeMap(self, fn) { + return self.map(fn) + }, + ArrayPrototypePop(self, el) { + return self.pop(el) + }, + ArrayPrototypePush(self, el) { + return self.push(el) + }, + ArrayPrototypeSlice(self, start, end) { + return self.slice(start, end) + }, + Error, + FunctionPrototypeCall(fn, thisArgs, ...args) { + return fn.call(thisArgs, ...args) + }, + FunctionPrototypeSymbolHasInstance(self, instance) { + return Function.prototype[Symbol.hasInstance].call(self, instance) + }, + MathFloor: Math.floor, + Number, + NumberIsInteger: Number.isInteger, + NumberIsNaN: Number.isNaN, + NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, + NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, + NumberParseInt: Number.parseInt, + ObjectDefineProperties(self, props) { + return Object.defineProperties(self, props) + }, + ObjectDefineProperty(self, name, prop) { + return Object.defineProperty(self, name, prop) + }, + ObjectGetOwnPropertyDescriptor(self, name) { + return Object.getOwnPropertyDescriptor(self, name) + }, + ObjectKeys(obj) { + return Object.keys(obj) + }, + ObjectSetPrototypeOf(target, proto) { + return Object.setPrototypeOf(target, proto) + }, + Promise, + PromisePrototypeCatch(self, fn) { + return self.catch(fn) + }, + PromisePrototypeThen(self, thenFn, catchFn) { + return self.then(thenFn, catchFn) + }, + PromiseReject(err) { + return Promise.reject(err) + }, + ReflectApply: Reflect.apply, + RegExpPrototypeTest(self, value) { + return self.test(value) + }, + SafeSet: Set, + String, + StringPrototypeSlice(self, start, end) { + return self.slice(start, end) + }, + StringPrototypeToLowerCase(self) { + return self.toLowerCase() + }, + StringPrototypeToUpperCase(self) { + return self.toUpperCase() + }, + StringPrototypeTrim(self) { + return self.trim() + }, + Symbol, + SymbolFor: Symbol.for, + SymbolAsyncIterator: Symbol.asyncIterator, + SymbolHasInstance: Symbol.hasInstance, + SymbolIterator: Symbol.iterator, + TypedArrayPrototypeSet(self, buf, len) { + return self.set(buf, len) + }, + Uint8Array +} + + +/***/ }), + +/***/ 72978: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const bufferModule = __webpack_require__(2486) +const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor +const Blob = globalThis.Blob || bufferModule.Blob +/* eslint-disable indent */ +const isBlob = + typeof Blob !== 'undefined' + ? function isBlob(b) { + // eslint-disable-next-line indent + return b instanceof Blob + } + : function isBlob(b) { + return false + } +/* eslint-enable indent */ + +// This is a simplified version of AggregateError +class AggregateError extends Error { + constructor(errors) { + if (!Array.isArray(errors)) { + throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) + } + let message = '' + for (let i = 0; i < errors.length; i++) { + message += ` ${errors[i].stack}\n` + } + super(message) + this.name = 'AggregateError' + this.errors = errors + } +} +module.exports = { + AggregateError, + kEmptyObject: Object.freeze({}), + once(callback) { + let called = false + return function (...args) { + if (called) { + return + } + called = true + callback.apply(this, args) + } + }, + createDeferredPromise: function () { + let resolve + let reject + + // eslint-disable-next-line promise/param-names + const promise = new Promise((res, rej) => { + resolve = res + reject = rej + }) + return { + promise, + resolve, + reject + } + }, + promisify(fn) { + return new Promise((resolve, reject) => { + fn((err, ...args) => { + if (err) { + return reject(err) + } + return resolve(...args) + }) + }) + }, + debuglog() { + return function () {} + }, + format(format, ...args) { + // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args + return format.replace(/%([sdifj])/g, function (...[_unused, type]) { + const replacement = args.shift() + if (type === 'f') { + return replacement.toFixed(6) + } else if (type === 'j') { + return JSON.stringify(replacement) + } else if (type === 's' && typeof replacement === 'object') { + const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' + return `${ctor} {}`.trim() + } else { + return replacement.toString() } + }) + }, + inspect(value) { + // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options + switch (typeof value) { + case 'string': + if (value.includes("'")) { + if (!value.includes('"')) { + return `"${value}"` + } else if (!value.includes('`') && !value.includes('${')) { + return `\`${value}\`` + } + } + return `'${value}'` + case 'number': + if (isNaN(value)) { + return 'NaN' + } else if (Object.is(value, -0)) { + return String(value) + } + return value + case 'bigint': + return `${String(value)}n` + case 'boolean': + case 'undefined': + return String(value) + case 'object': + return '{}' + } + }, + types: { + isAsyncFunction(fn) { + return fn instanceof AsyncFunction + }, + isArrayBufferView(arr) { + return ArrayBuffer.isView(arr) + } + }, + isBlob +} +module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') + + +/***/ }), + +/***/ 82192: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* replacement start */ + +const { Buffer } = __webpack_require__(2486) + +/* replacement end */ +// 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') +const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(26701) +const { + promisify: { custom: customPromisify } +} = __webpack_require__(72978) +const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(57395) +const { + codes: { ERR_ILLEGAL_CONSTRUCTOR } +} = __webpack_require__(4213) +const compose = __webpack_require__(65729) +const { pipeline } = __webpack_require__(33939) +const { destroyer } = __webpack_require__(92573) +const eos = __webpack_require__(24597) +const internalBuffer = {} +const promises = __webpack_require__(76201) +const utils = __webpack_require__(46342) +const Stream = (module.exports = __webpack_require__(2854).Stream) +Stream.isDisturbed = utils.isDisturbed +Stream.isErrored = utils.isErrored +Stream.isReadable = utils.isReadable +Stream.Readable = __webpack_require__(3845) +for (const key of ObjectKeys(streamReturningOperators)) { + const op = streamReturningOperators[key] + function fn(...args) { + if (new.target) { + throw ERR_ILLEGAL_CONSTRUCTOR() + } + return Stream.Readable.from(ReflectApply(op, this, args)) + } + ObjectDefineProperty(fn, 'name', { + __proto__: null, + value: op.name + }) + ObjectDefineProperty(fn, 'length', { + __proto__: null, + value: op.length + }) + ObjectDefineProperty(Stream.Readable.prototype, key, { + __proto__: null, + value: fn, + enumerable: false, + configurable: true, + writable: true + }) +} +for (const key of ObjectKeys(promiseReturningOperators)) { + const op = promiseReturningOperators[key] + function fn(...args) { + if (new.target) { + throw ERR_ILLEGAL_CONSTRUCTOR() } - // property path + return ReflectApply(op, this, args) + } + ObjectDefineProperty(fn, 'name', { + __proto__: null, + value: op.name + }) + ObjectDefineProperty(fn, 'length', { + __proto__: null, + value: op.length + }) + ObjectDefineProperty(Stream.Readable.prototype, key, { + __proto__: null, + value: fn, + enumerable: false, + configurable: true, + writable: true + }) +} +Stream.Writable = __webpack_require__(12657) +Stream.Duplex = __webpack_require__(35960) +Stream.Transform = __webpack_require__(57425) +Stream.PassThrough = __webpack_require__(38368) +Stream.pipeline = pipeline +const { addAbortSignal } = __webpack_require__(29975) +Stream.addAbortSignal = addAbortSignal +Stream.finished = eos +Stream.destroy = destroyer +Stream.compose = compose +ObjectDefineProperty(Stream, 'promises', { + __proto__: null, + configurable: true, + enumerable: true, + get() { + return promises + } +}) +ObjectDefineProperty(pipeline, customPromisify, { + __proto__: null, + enumerable: true, + get() { + return promises.pipeline + } +}) +ObjectDefineProperty(eos, customPromisify, { + __proto__: null, + enumerable: true, + get() { + return promises.finished + } +}) + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream +Stream._isUint8Array = function isUint8Array(value) { + return value instanceof Uint8Array +} +Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) +} + + +/***/ }), + +/***/ 76201: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { ArrayPrototypePop, Promise } = __webpack_require__(26701) +const { isIterable, isNodeStream, isWebStream } = __webpack_require__(46342) +const { pipelineImpl: pl } = __webpack_require__(33939) +const { finished } = __webpack_require__(24597) +__webpack_require__(82192) +function pipeline(...streams) { + return new Promise((resolve, reject) => { + let signal + let end + const lastArg = streams[streams.length - 1] + if ( + lastArg && + typeof lastArg === 'object' && + !isNodeStream(lastArg) && + !isIterable(lastArg) && + !isWebStream(lastArg) + ) { + const options = ArrayPrototypePop(streams) + signal = options.signal + end = options.end + } + pl( + streams, + (err, value) => { + if (err) { + reject(err) + } else { + resolve(value) + } + }, + { + signal, + end + } + ) + }) +} +module.exports = { + finished, + pipeline +} + + +/***/ }), + +/***/ 71674: +/***/ ((module) => { + +var XSD_INTEGER = 'http://www.w3.org/2001/XMLSchema#integer'; +var XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string'; + +function Generator(options) { + this._options = options = options || {}; + + var prefixes = options.prefixes || {}; + this._prefixByIri = {}; + var prefixIris = []; + for (var prefix in prefixes) { + var iri = prefixes[prefix]; + if (isString(iri)) { + this._prefixByIri[iri] = prefix; + prefixIris.push(iri); + } + } + var iriList = prefixIris.join('|').replace(/[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); + this._prefixRegex = new RegExp('^(' + iriList + ')([a-zA-Z][\\-_a-zA-Z0-9]*)$'); + this._usedPrefixes = {}; + this._sparqlStar = options.sparqlStar; + this._indent = isString(options.indent) ? options.indent : ' '; + this._newline = isString(options.newline) ? options.newline : '\n'; + this._explicitDatatype = Boolean(options.explicitDatatype); +} + +// Converts the parsed query object into a SPARQL query +Generator.prototype.toQuery = function (q) { + var query = ''; + + if (q.queryType) + query += q.queryType.toUpperCase() + ' '; + if (q.reduced) + query += 'REDUCED '; + if (q.distinct) + query += 'DISTINCT '; + + if (q.variables){ + query += mapJoin(q.variables, undefined, function (variable) { + return isTerm(variable) ? this.toEntity(variable) : + '(' + this.toExpression(variable.expression) + ' AS ' + variableToString(variable.variable) + ')'; + }, this) + ' '; + } + else if (q.template) + query += this.group(q.template, true) + this._newline; + + if (q.from) + query += this.graphs('FROM ', q.from.default) + this.graphs('FROM NAMED ', q.from.named); + if (q.where) + query += 'WHERE ' + this.group(q.where, true) + this._newline; + + if (q.updates) + query += mapJoin(q.updates, ';' + this._newline, this.toUpdate, this); + + if (q.group) + query += 'GROUP BY ' + mapJoin(q.group, undefined, function (it) { + var result = isTerm(it.expression) + ? this.toEntity(it.expression) + : '(' + this.toExpression(it.expression) + ')'; + return it.variable ? '(' + result + ' AS ' + variableToString(it.variable) + ')' : result; + }, this) + this._newline; + if (q.having) + query += 'HAVING (' + mapJoin(q.having, undefined, this.toExpression, this) + ')' + this._newline; + if (q.order) + query += 'ORDER BY ' + mapJoin(q.order, undefined, function (it) { + var expr = '(' + this.toExpression(it.expression) + ')'; + return !it.descending ? expr : 'DESC ' + expr; + }, this) + this._newline; + + if (q.offset) + query += 'OFFSET ' + q.offset + this._newline; + if (q.limit) + query += 'LIMIT ' + q.limit + this._newline; + + if (q.values) + query += this.values(q); + + // stringify prefixes at the end to mark used ones + query = this.baseAndPrefixes(q) + query; + return query.trim(); +}; + +Generator.prototype.baseAndPrefixes = function (q) { + var base = q.base ? ('BASE <' + q.base + '>' + this._newline) : ''; + var prefixes = ''; + for (var key in q.prefixes) { + if (this._options.allPrefixes || this._usedPrefixes[key]) + prefixes += 'PREFIX ' + key + ': <' + q.prefixes[key] + '>' + this._newline; + } + return base + prefixes; +}; + +// Converts the parsed SPARQL pattern into a SPARQL pattern +Generator.prototype.toPattern = function (pattern) { + var type = pattern.type || (pattern instanceof Array) && 'array' || + (pattern.subject && pattern.predicate && pattern.object ? 'triple' : ''); + if (!(type in this)) + throw new Error('Unknown entry type: ' + type); + return this[type](pattern); +}; + +Generator.prototype.triple = function (t) { + return this.toEntity(t.subject) + ' ' + this.toEntity(t.predicate) + ' ' + this.toEntity(t.object) + '.'; +}; + +Generator.prototype.array = function (items) { + return mapJoin(items, this._newline, this.toPattern, this); +}; + +Generator.prototype.bgp = function (bgp) { + return this.encodeTriples(bgp.triples); +}; + +Generator.prototype.encodeTriples = function (triples) { + if (!triples.length) + return ''; + + var parts = [], subject = undefined, predicate = undefined; + for (var i = 0; i < triples.length; i++) { + var triple = triples[i]; + // Triple with different subject + if (!equalTerms(triple.subject, subject)) { + // Terminate previous triple + if (subject) + parts.push('.' + this._newline); + subject = triple.subject; + predicate = triple.predicate; + parts.push(this.toEntity(subject), ' ', this.toEntity(predicate)); + } + // Triple with same subject but different predicate + else if (!equalTerms(triple.predicate, predicate)) { + predicate = triple.predicate; + parts.push(';' + this._newline, this._indent, this.toEntity(predicate)); + } + // Triple with same subject and predicate else { - var items = value.items.map(this.toEntity, this), path = value.pathType; - switch (path) { - // prefix operator - case '^': - case '!': - return path + items[0]; - // postfix operator - case '*': + parts.push(','); + } + parts.push(' ', this.toEntity(triple.object)); + } + parts.push('.'); + + return parts.join(''); +} + +Generator.prototype.graph = function (graph) { + return 'GRAPH ' + this.toEntity(graph.name) + ' ' + this.group(graph); +}; + +Generator.prototype.graphs = function (keyword, graphs) { + return !graphs || graphs.length === 0 ? '' : + mapJoin(graphs, '', function (g) { return keyword + this.toEntity(g) + this._newline; }, this) +} + +Generator.prototype.group = function (group, inline) { + group = inline !== true ? this.array(group.patterns || group.triples) + : this.toPattern(group.type !== 'group' ? group : group.patterns); + return group.indexOf(this._newline) === -1 ? '{ ' + group + ' }' : '{' + this._newline + this.indent(group) + this._newline + '}'; +}; + +Generator.prototype.query = function (query) { + return this.toQuery(query); +}; + +Generator.prototype.filter = function (filter) { + return 'FILTER(' + this.toExpression(filter.expression) + ')'; +}; + +Generator.prototype.bind = function (bind) { + return 'BIND(' + this.toExpression(bind.expression) + ' AS ' + variableToString(bind.variable) + ')'; +}; + +Generator.prototype.optional = function (optional) { + return 'OPTIONAL ' + this.group(optional); +}; + +Generator.prototype.union = function (union) { + return mapJoin(union.patterns, this._newline + 'UNION' + this._newline, function (p) { return this.group(p, true); }, this); +}; + +Generator.prototype.minus = function (minus) { + return 'MINUS ' + this.group(minus); +}; + +Generator.prototype.values = function (valuesList) { + // Gather unique keys + var keys = Object.keys(valuesList.values.reduce(function (keyHash, values) { + for (var key in values) keyHash[key] = true; + return keyHash; + }, {})); + // Check whether simple syntax can be used + var lparen, rparen; + if (keys.length === 1) { + lparen = rparen = ''; + } else { + lparen = '('; + rparen = ')'; + } + // Create value rows + return 'VALUES ' + lparen + keys.join(' ') + rparen + ' {' + this._newline + + mapJoin(valuesList.values, this._newline, function (values) { + return ' ' + lparen + mapJoin(keys, undefined, function (key) { + return values[key] ? this.toEntity(values[key]) : 'UNDEF'; + }, this) + rparen; + }, this) + this._newline + '}'; +}; + +Generator.prototype.service = function (service) { + return 'SERVICE ' + (service.silent ? 'SILENT ' : '') + this.toEntity(service.name) + ' ' + + this.group(service); +}; + +// Converts the parsed expression object into a SPARQL expression +Generator.prototype.toExpression = function (expr) { + if (isTerm(expr)) { + return this.toEntity(expr); + } + switch (expr.type.toLowerCase()) { + case 'aggregate': + return expr.aggregation.toUpperCase() + + '(' + (expr.distinct ? 'DISTINCT ' : '') + this.toExpression(expr.expression) + + (typeof expr.separator === 'string' ? '; SEPARATOR = ' + '"' + expr.separator.replace(escape, escapeReplacer) + '"' : '') + ')'; + case 'functioncall': + return this.toEntity(expr.function) + '(' + mapJoin(expr.args, ', ', this.toExpression, this) + ')'; + case 'operation': + var operator = expr.operator.toUpperCase(), args = expr.args || []; + switch (expr.operator.toLowerCase()) { + // Infix operators + case '<': + case '>': + case '>=': + case '<=': + case '&&': + case '||': + case '=': + case '!=': case '+': - case '?': - return '(' + items[0] + path + ')'; - // infix operator + case '-': + case '*': + case '/': + return (isTerm(args[0]) ? this.toEntity(args[0]) : '(' + this.toExpression(args[0]) + ')') + + ' ' + operator + ' ' + + (isTerm(args[1]) ? this.toEntity(args[1]) : '(' + this.toExpression(args[1]) + ')'); + // Unary operators + case '!': + return '!(' + this.toExpression(args[0]) + ')'; + case 'uplus': + return '+(' + this.toExpression(args[0]) + ')'; + case 'uminus': + return '-(' + this.toExpression(args[0]) + ')'; + // IN and NOT IN + case 'notin': + operator = 'NOT IN'; + case 'in': + return this.toExpression(args[0]) + ' ' + operator + + '(' + (isString(args[1]) ? args[1] : mapJoin(args[1], ', ', this.toExpression, this)) + ')'; + // EXISTS and NOT EXISTS + case 'notexists': + operator = 'NOT EXISTS'; + case 'exists': + return operator + ' ' + this.group(args[0], true); + // Other expressions default: - return '(' + items.join(path) + ')'; + return operator + '(' + mapJoin(args, ', ', this.toExpression, this) + ')'; } - } - }; - var escape = /["\\\t\n\r\b\f]/g, - escapeReplacer = function (c) { return escapeReplacements[c]; }, - escapeReplacements = { '\\': '\\\\', '"': '\\"', '\t': '\\t', - '\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f' }; - - // Represent the IRI, as a prefixed name when possible - Generator.prototype.encodeIRI = function (iri) { - var prefixMatch = this._prefixRegex.exec(iri); - if (prefixMatch) { - var prefix = this._prefixByIri[prefixMatch[1]]; - this._usedPrefixes[prefix] = true; - return prefix + ':' + prefixMatch[2]; - } - return '<' + iri + '>'; - }; - - // Converts the parsed update object into a SPARQL update clause - Generator.prototype.toUpdate = function (update) { - switch (update.type || update.updateType) { - case 'load': - return 'LOAD' + (update.source ? ' ' + this.toEntity(update.source) : '') + - (update.destination ? ' INTO GRAPH ' + this.toEntity(update.destination) : ''); - case 'insert': - return 'INSERT DATA ' + this.group(update.insert, true); - case 'delete': - return 'DELETE DATA ' + this.group(update.delete, true); - case 'deletewhere': - return 'DELETE WHERE ' + this.group(update.delete, true); - case 'insertdelete': - return (update.graph ? 'WITH ' + this.toEntity(update.graph) + this._newline : '') + - (update.delete.length ? 'DELETE ' + this.group(update.delete, true) + this._newline : '') + - (update.insert.length ? 'INSERT ' + this.group(update.insert, true) + this._newline : '') + - (update.using ? this.graphs('USING ', update.using.default) : '') + - (update.using ? this.graphs('USING NAMED ', update.using.named) : '') + - 'WHERE ' + this.group(update.where, true); - case 'add': - case 'copy': - case 'move': - return update.type.toUpperCase()+ ' ' + (update.silent ? 'SILENT ' : '') + (update.source.default ? 'DEFAULT' : this.toEntity(update.source.name)) + - ' TO ' + this.toEntity(update.destination.name); - case 'create': - case 'clear': - case 'drop': - return update.type.toUpperCase() + (update.silent ? ' SILENT ' : ' ') + ( - update.graph.default ? 'DEFAULT' : - update.graph.named ? 'NAMED' : - update.graph.all ? 'ALL' : - ('GRAPH ' + this.toEntity(update.graph.name)) - ); default: - throw new Error('Unknown update query type: ' + update.type); - } - }; - - // Indents each line of the string - Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._indent); } - - function variableToString(variable){ - return '?' + variable.value; - } - - // Checks whether the object is a string - function isString(object) { return typeof object === 'string'; } - - // Checks whether the object is a Term - function isTerm(object) { - return typeof object.termType === 'string'; - } - - // Checks whether term1 and term2 are equivalent without `.equals()` prototype method - function equalTerms(term1, term2) { - if (!term1 || !isTerm(term1)) { return false; } - if (!term2 || !isTerm(term2)) { return false; } - if (term1.termType !== term2.termType) { return false; } - switch (term1.termType) { - case 'Literal': - return term1.value === term2.value - && term1.language === term2.language - && equalTerms(term1.datatype, term2.datatype); - case 'Quad': - return equalTerms(term1.subject, term2.subject) - && equalTerms(term1.predicate, term2.predicate) - && equalTerms(term1.object, term2.object) - && equalTerms(term1.graph, term2.graph); - default: - return term1.value === term2.value; + throw new Error('Unknown expression type: ' + expr.type); + } +}; + +// Converts the parsed entity (or property path) into a SPARQL entity +Generator.prototype.toEntity = function (value) { + if (isTerm(value)) { + switch (value.termType) { + // variable, * selector, or blank node + case 'Wildcard': + return '*'; + case 'Variable': + return variableToString(value); + case 'BlankNode': + return '_:' + value.value; + // literal + case 'Literal': + var lexical = value.value || '', language = value.language || '', datatype = value.datatype; + value = '"' + lexical.replace(escape, escapeReplacer) + '"'; + if (language){ + value += '@' + language; + } else if (datatype) { + // Abbreviate literals when possible + if (!this._explicitDatatype) { + switch (datatype.value) { + case XSD_STRING: + return value; + case XSD_INTEGER: + if (/^\d+$/.test(lexical)) + // Add space to avoid confusion with decimals in broken parsers + return lexical + ' '; + } + } + value += '^^' + this.encodeIRI(datatype.value); + } + return value; + case 'Quad': + if (!this._sparqlStar) + throw new Error('SPARQL* support is not enabled'); + + if (value.graph && value.graph.termType !== "DefaultGraph") { + return '<< GRAPH ' + + this.toEntity(value.graph) + + ' { ' + + this.toEntity(value.subject) + ' ' + + this.toEntity(value.predicate) + ' ' + + this.toEntity(value.object) + + ' } ' + + ' >>' + } + else { + return ( + '<< ' + + this.toEntity(value.subject) + ' ' + + this.toEntity(value.predicate) + ' ' + + this.toEntity(value.object) + + ' >>' + ); + } + // IRI + default: + return this.encodeIRI(value.value); + } + } + // property path + else { + var items = value.items.map(this.toEntity, this), path = value.pathType; + switch (path) { + // prefix operator + case '^': + case '!': + return path + items[0]; + // postfix operator + case '*': + case '+': + case '?': + return '(' + items[0] + path + ')'; + // infix operator + default: + return '(' + items.join(path) + ')'; } } - - // Maps the array with the given function, and joins the results using the separator - function mapJoin(array, sep, func, self) { - return array.map(func, self).join(isString(sep) ? sep : ' '); +}; +var escape = /["\\\t\n\r\b\f]/g, + escapeReplacer = function (c) { return escapeReplacements[c]; }, + escapeReplacements = { '\\': '\\\\', '"': '\\"', '\t': '\\t', + '\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f' }; + +// Represent the IRI, as a prefixed name when possible +Generator.prototype.encodeIRI = function (iri) { + var prefixMatch = this._prefixRegex.exec(iri); + if (prefixMatch) { + var prefix = this._prefixByIri[prefixMatch[1]]; + this._usedPrefixes[prefix] = true; + return prefix + ':' + prefixMatch[2]; + } + return '<' + iri + '>'; +}; + +// Converts the parsed update object into a SPARQL update clause +Generator.prototype.toUpdate = function (update) { + switch (update.type || update.updateType) { + case 'load': + return 'LOAD' + (update.source ? ' ' + this.toEntity(update.source) : '') + + (update.destination ? ' INTO GRAPH ' + this.toEntity(update.destination) : ''); + case 'insert': + return 'INSERT DATA ' + this.group(update.insert, true); + case 'delete': + return 'DELETE DATA ' + this.group(update.delete, true); + case 'deletewhere': + return 'DELETE WHERE ' + this.group(update.delete, true); + case 'insertdelete': + return (update.graph ? 'WITH ' + this.toEntity(update.graph) + this._newline : '') + + (update.delete.length ? 'DELETE ' + this.group(update.delete, true) + this._newline : '') + + (update.insert.length ? 'INSERT ' + this.group(update.insert, true) + this._newline : '') + + (update.using ? this.graphs('USING ', update.using.default) : '') + + (update.using ? this.graphs('USING NAMED ', update.using.named) : '') + + 'WHERE ' + this.group(update.where, true); + case 'add': + case 'copy': + case 'move': + return update.type.toUpperCase()+ ' ' + (update.silent ? 'SILENT ' : '') + (update.source.default ? 'DEFAULT' : this.toEntity(update.source.name)) + + ' TO ' + this.toEntity(update.destination.name); + case 'create': + case 'clear': + case 'drop': + return update.type.toUpperCase() + (update.silent ? ' SILENT ' : ' ') + ( + update.graph.default ? 'DEFAULT' : + update.graph.named ? 'NAMED' : + update.graph.all ? 'ALL' : + ('GRAPH ' + this.toEntity(update.graph.name)) + ); + default: + throw new Error('Unknown update query type: ' + update.type); } - - /** - * @param options { - * allPrefixes: boolean, - * indentation: string, - * newline: string - * } - */ - module.exports = function SparqlGenerator(options = {}) { - return { - stringify: function (query) { - var currentOptions = Object.create(options); - currentOptions.prefixes = query.prefixes; - return new Generator(currentOptions).toQuery(query); - }, - createGenerator: function() { return new Generator(options); } - }; - }; - - - /***/ }), - - /***/ 23474: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - /* provided dependency */ var console = __webpack_require__(80292); - /* parser generated by jison 0.4.18 */ - /* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) +}; + +// Indents each line of the string +Generator.prototype.indent = function(text) { return text.replace(/^/gm, this._indent); } + +function variableToString(variable){ + return '?' + variable.value; +} + +// Checks whether the object is a string +function isString(object) { return typeof object === 'string'; } + +// Checks whether the object is a Term +function isTerm(object) { + return typeof object.termType === 'string'; +} + +// Checks whether term1 and term2 are equivalent without `.equals()` prototype method +function equalTerms(term1, term2) { + if (!term1 || !isTerm(term1)) { return false; } + if (!term2 || !isTerm(term2)) { return false; } + if (term1.termType !== term2.termType) { return false; } + switch (term1.termType) { + case 'Literal': + return term1.value === term2.value + && term1.language === term2.language + && equalTerms(term1.datatype, term2.datatype); + case 'Quad': + return equalTerms(term1.subject, term2.subject) + && equalTerms(term1.predicate, term2.predicate) + && equalTerms(term1.object, term2.object) + && equalTerms(term1.graph, term2.graph); + default: + return term1.value === term2.value; + } +} + +// Maps the array with the given function, and joins the results using the separator +function mapJoin(array, sep, func, self) { + return array.map(func, self).join(isString(sep) ? sep : ' '); +} + +/** + * @param options { + * allPrefixes: boolean, + * indentation: string, + * newline: string + * } + */ +module.exports = function SparqlGenerator(options = {}) { + return { + stringify: function (query) { + var currentOptions = Object.create(options); + currentOptions.prefixes = query.prefixes; + return new Generator(currentOptions).toQuery(query); + }, + createGenerator: function() { return new Generator(options); } + }; +}; + + +/***/ }), + +/***/ 23474: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* provided dependency */ var console = __webpack_require__(80292); +/* parser generated by jison 0.4.18 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, } - */ - var SparqlParser = (function(){ - var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],$V1=[2,247],$V2=[100,110,113,115,116,123,126,131,329,330,331,332,333],$V3=[2,409],$V4=[1,18],$V5=[1,27],$V6=[13,16,45,197,224,229,308],$V7=[28,29,53],$V8=[28,53],$V9=[1,42],$Va=[1,45],$Vb=[1,41],$Vc=[1,44],$Vd=[123,126],$Ve=[1,67],$Vf=[39,45,87],$Vg=[13,16,45,197,224,308],$Vh=[1,87],$Vi=[2,281],$Vj=[1,86],$Vk=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vl=[6,28,29,53,63,70,73,81,83,85],$Vm=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],$Vn=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],$Vo=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],$Vp=[13,16,308],$Vq=[112,132,327,334],$Vr=[13,16,112,132,308],$Vs=[1,111],$Vt=[1,117],$Vu=[112,132,327,328,334],$Vv=[13,16,112,132,308,328],$Vw=[28,29,45,53,87],$Vx=[1,138],$Vy=[1,151],$Vz=[1,128],$VA=[1,127],$VB=[1,129],$VC=[1,140],$VD=[1,141],$VE=[1,142],$VF=[1,143],$VG=[1,144],$VH=[1,145],$VI=[1,147],$VJ=[1,148],$VK=[2,457],$VL=[1,158],$VM=[1,159],$VN=[1,160],$VO=[1,152],$VP=[1,153],$VQ=[1,156],$VR=[1,171],$VS=[1,172],$VT=[1,173],$VU=[1,174],$VV=[1,175],$VW=[1,176],$VX=[1,167],$VY=[1,168],$VZ=[1,169],$V_=[1,170],$V$=[1,157],$V01=[1,166],$V11=[1,161],$V21=[1,162],$V31=[1,163],$V41=[1,164],$V51=[1,165],$V61=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],$V71=[1,195],$V81=[6,31,73,81,83,85],$V91=[2,285],$Va1=[1,199],$Vb1=[1,201],$Vc1=[6,31,70,73,81,83,85],$Vd1=[2,283],$Ve1=[1,207],$Vf1=[1,218],$Vg1=[1,223],$Vh1=[1,219],$Vi1=[1,225],$Vj1=[1,226],$Vk1=[1,224],$Vl1=[6,63,70,73,81,83,85],$Vm1=[1,236],$Vn1=[2,334],$Vo1=[1,243],$Vp1=[1,241],$Vq1=[6,193],$Vr1=[2,349],$Vs1=[2,339],$Vt1=[28,128],$Vu1=[47,48,193,272],$Vv1=[47,48,193,242,272],$Vw1=[47,48,193,242,246,272],$Vx1=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],$Vy1=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],$Vz1=[1,271],$VA1=[1,270],$VB1=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],$VC1=[1,281],$VD1=[1,280],$VE1=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],$VF1=[45,89],$VG1=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],$VH1=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$VI1=[31,89],$VJ1=[48,87],$VK1=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],$VL1=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],$VM1=[1,313],$VN1=[6,85],$VO1=[6,31,81,83,85],$VP1=[2,361],$VQ1=[2,353],$VR1=[1,343],$VS1=[31,112,335],$VT1=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$VU1=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],$VV1=[6,109,193],$VW1=[31,112],$VX1=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],$VY1=[1,390],$VZ1=[1,391],$V_1=[13,16,87,197,308,314],$V$1=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],$V02=[1,417],$V12=[1,418],$V22=[13,16,48,197,229,308],$V32=[6,31,85],$V42=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$V52=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],$V62=[29,31,85,112,159,160,161,163,164],$V72=[1,443],$V82=[1,444],$V92=[1,449],$Va2=[31,112,193,232,318,335],$Vb2=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vc2=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Vd2=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Ve2=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$Vf2=[31,45],$Vg2=[1,507],$Vh2=[1,508],$Vi2=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],$Vj2=[29,31,85,112,159,160,161,163,164,335],$Vk2=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$Vl2=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Vm2=[2,352],$Vn2=[13,16,197,308,314],$Vo2=[1,565],$Vp2=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$Vq2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vr2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],$Vs2=[13,16,87,308],$Vt2=[2,364],$Vu2=[29,31,85,112,159,160,161,163,164,193,232,318,335],$Vv2=[31,112,193,232,272,318,335],$Vw2=[2,359],$Vx2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$Vy2=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],$Vz2=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$VA2=[2,347]; - var parser = {trace: function trace () { }, - yy: {}, - symbols_: {"error":2,"QueryOrUpdate":3,"Prologue":4,"QueryOrUpdate_group0":5,"EOF":6,"Query":7,"Qry":8,"Query_option0":9,"Prologue_repetition0":10,"BaseDecl":11,"BASE":12,"IRIREF":13,"PrefixDecl":14,"PREFIX":15,"PNAME_NS":16,"SelectClauseWildcard":17,"Qry_repetition0":18,"WhereClause":19,"SolutionModifierNoGroup":20,"SelectClauseVars":21,"Qry_repetition1":22,"SolutionModifier":23,"CONSTRUCT":24,"ConstructTemplate":25,"Qry_repetition2":26,"Qry_repetition3":27,"WHERE":28,"{":29,"Qry_option0":30,"}":31,"DESCRIBE":32,"Qry_group0":33,"Qry_repetition4":34,"Qry_option1":35,"ASK":36,"Qry_repetition5":37,"SelectClauseBase":38,"*":39,"SelectClauseVars_repetition_plus0":40,"SELECT":41,"SelectClauseBase_option0":42,"SelectClauseItem":43,"Var":44,"(":45,"Expression":46,"AS":47,")":48,"SubSelect":49,"SubSelect_option0":50,"SubSelect_option1":51,"DatasetClause":52,"FROM":53,"DatasetClause_option0":54,"iri":55,"WhereClause_option0":56,"GroupGraphPattern":57,"SolutionModifier_option0":58,"SolutionModifierNoGroup_option0":59,"SolutionModifierNoGroup_option1":60,"SolutionModifierNoGroup_option2":61,"GroupClause":62,"GROUP":63,"BY":64,"GroupClause_repetition_plus0":65,"GroupCondition":66,"BuiltInCall":67,"FunctionCall":68,"HavingClause":69,"HAVING":70,"HavingClause_repetition_plus0":71,"OrderClause":72,"ORDER":73,"OrderClause_repetition_plus0":74,"OrderCondition":75,"ASC":76,"BrackettedExpression":77,"DESC":78,"Constraint":79,"LimitOffsetClauses":80,"LIMIT":81,"INTEGER":82,"OFFSET":83,"ValuesClause":84,"VALUES":85,"InlineData":86,"VAR":87,"InlineData_repetition0":88,"NIL":89,"InlineData_repetition1":90,"InlineData_repetition_plus2":91,"InlineData_repetition3":92,"DataBlock":93,"DataBlockValueList":94,"DataBlockValueList_repetition_plus0":95,"Update":96,"Update_repetition0":97,"Update1":98,"Update_option0":99,"LOAD":100,"Update1_option0":101,"Update1_option1":102,"Update1_group0":103,"Update1_option2":104,"GraphRefAll":105,"Update1_group1":106,"Update1_option3":107,"GraphOrDefault":108,"TO":109,"CREATE":110,"Update1_option4":111,"GRAPH":112,"INSERTDATA":113,"QuadPattern":114,"DELETEDATA":115,"DELETEWHERE":116,"Update1_option5":117,"InsertDeleteClause":118,"Update1_repetition0":119,"IntoGraphClause":120,"INTO":121,"GraphRef":122,"DELETE":123,"InsertDeleteClause_option0":124,"InsertClause":125,"INSERT":126,"UsingClause":127,"USING":128,"UsingClause_option0":129,"WithClause":130,"WITH":131,"DEFAULT":132,"GraphOrDefault_option0":133,"GraphRefAll_group0":134,"Quads":135,"Quads_option0":136,"Quads_repetition0":137,"QuadsNotTriples":138,"VarOrIri":139,"QuadsNotTriples_option0":140,"QuadsNotTriples_option1":141,"QuadsNotTriples_option2":142,"TriplesTemplate":143,"TriplesTemplate_repetition0":144,"TriplesSameSubject":145,"TriplesTemplate_option0":146,"GroupGraphPatternSub":147,"GroupGraphPatternSub_option0":148,"GroupGraphPatternSub_repetition0":149,"GroupGraphPatternSubTail":150,"GraphPatternNotTriples":151,"GroupGraphPatternSubTail_option0":152,"GroupGraphPatternSubTail_option1":153,"TriplesBlock":154,"TriplesBlock_repetition0":155,"TriplesSameSubjectPath":156,"TriplesBlock_option0":157,"GroupOrUnionGraphPattern":158,"OPTIONAL":159,"MINUS":160,"SERVICE":161,"GraphPatternNotTriples_option0":162,"FILTER":163,"BIND":164,"InlineDataOneVar":165,"InlineDataFull":166,"InlineDataOneVar_repetition0":167,"InlineDataFull_repetition0":168,"InlineDataFull_repetition_plus1":169,"InlineDataFull_repetition2":170,"DataBlockValue":171,"Literal":172,"QuotedTriple":173,"UNDEF":174,"GroupOrUnionGraphPattern_repetition0":175,"ArgList":176,"ArgList_option0":177,"ArgList_repetition0":178,"ExpressionList":179,"ExpressionList_repetition0":180,"ConstructTemplate_option0":181,"ConstructTriples":182,"ConstructTriples_repetition0":183,"ConstructTriples_option0":184,"VarOrTermOrQuotedTP":185,"PropertyListNotEmpty":186,"TriplesNode":187,"PropertyList":188,"PropertyList_option0":189,"VerbObjectList":190,"PropertyListNotEmpty_repetition0":191,"SemiOptionalVerbObjectList":192,";":193,"SemiOptionalVerbObjectList_option0":194,"Verb":195,"ObjectList":196,"a":197,"ObjectList_repetition0":198,"Object":199,"GraphNode":200,"Object_option0":201,"PropertyListPathNotEmpty":202,"TriplesNodePath":203,"TriplesSameSubjectPath_option0":204,"O":205,"PropertyListPathNotEmpty_repetition0":206,"PropertyListPathNotEmptyTail":207,"O_group0":208,"ObjectListPath":209,"ObjectListPath_repetition0":210,"ObjectPath":211,"GraphNodePath":212,"ObjectPath_option0":213,"Path":214,"Path_repetition0":215,"PathSequence":216,"PathSequence_repetition0":217,"PathEltOrInverse":218,"PathElt":219,"PathPrimary":220,"PathElt_option0":221,"PathEltOrInverse_option0":222,"IriOrA":223,"!":224,"PathNegatedPropertySet":225,"PathOneInPropertySet":226,"PathNegatedPropertySet_repetition0":227,"PathNegatedPropertySet_option0":228,"^":229,"TriplesNode_repetition_plus0":230,"[":231,"]":232,"TriplesNodePath_repetition_plus0":233,"VarOrTermOrQuotedTPExpr":234,"VarOrTerm":235,"GraphTerm":236,"BlankNode":237,"ConditionalOrExpression":238,"ConditionalAndExpression":239,"ConditionalOrExpression_repetition0":240,"ConditionalOrExpressionTail":241,"||":242,"RelationalExpression":243,"ConditionalAndExpression_repetition0":244,"ConditionalAndExpressionTail":245,"&&":246,"NumericExpression":247,"RelationalExpression_group0":248,"RelationalExpression_option0":249,"IN":250,"MultiplicativeExpression":251,"NumericExpression_repetition0":252,"AdditiveExpressionTail":253,"AdditiveExpressionTail_group0":254,"NumericLiteralPositive":255,"AdditiveExpressionTail_repetition0":256,"NumericLiteralNegative":257,"AdditiveExpressionTail_repetition1":258,"UnaryExpression":259,"MultiplicativeExpression_repetition0":260,"MultiplicativeExpressionTail":261,"MultiplicativeExpressionTail_group0":262,"+":263,"PrimaryExpression":264,"-":265,"ExprQuotedTP":266,"Aggregate":267,"FUNC_ARITY0":268,"FUNC_ARITY1":269,"FUNC_ARITY1_SPARQL_STAR":270,"FUNC_ARITY2":271,",":272,"FUNC_ARITY3":273,"FUNC_ARITY3_SPARQL_STAR":274,"BuiltInCall_group0":275,"BOUND":276,"BNODE":277,"BuiltInCall_option0":278,"EXISTS":279,"COUNT":280,"Aggregate_option0":281,"Aggregate_group0":282,"FUNC_AGGREGATE":283,"Aggregate_option1":284,"GROUP_CONCAT":285,"Aggregate_option2":286,"Aggregate_option3":287,"GroupConcatSeparator":288,"SEPARATOR":289,"=":290,"String":291,"LANGTAG":292,"^^":293,"DECIMAL":294,"DOUBLE":295,"BOOLEAN":296,"INTEGER_POSITIVE":297,"DECIMAL_POSITIVE":298,"DOUBLE_POSITIVE":299,"INTEGER_NEGATIVE":300,"DECIMAL_NEGATIVE":301,"DOUBLE_NEGATIVE":302,"STRING_LITERAL1":303,"STRING_LITERAL2":304,"STRING_LITERAL_LONG1":305,"STRING_LITERAL_LONG2":306,"PrefixedName":307,"PNAME_LN":308,"BLANK_NODE_LABEL":309,"ANON":310,"QuotedTP":311,"<<":312,"qtSubjectOrObject":313,">>":314,"DataValueTerm":315,"AnnotationPattern":316,"{|":317,"|}":318,"AnnotationPatternPath":319,"ExprVarOrTerm":320,"QueryOrUpdate_group0_option0":321,"Prologue_repetition0_group0":322,"Qry_group0_repetition_plus0":323,"SelectClauseBase_option0_group0":324,"DISTINCT":325,"REDUCED":326,"NAMED":327,"SILENT":328,"CLEAR":329,"DROP":330,"ADD":331,"MOVE":332,"COPY":333,"ALL":334,".":335,"UNION":336,"|":337,"/":338,"PathElt_option0_group0":339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,"NOT":346,"CONCAT":347,"COALESCE":348,"SUBSTR":349,"REGEX":350,"REPLACE":351,"$accept":0,"$end":1}, - terminals_: {2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"}, - productions_: [0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { - /* this == yyval */ - - var $0 = $$.length - 1; - switch (yystate) { - case 1: - - // Set parser options - $$[$0-1] = $$[$0-1] || {}; - if (Parser.base) - $$[$0-1].base = Parser.base; - Parser.base = ''; - $$[$0-1].prefixes = Parser.prefixes; - Parser.prefixes = null; - - if (Parser.pathOnly) { - if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { - return $$[$0-1] - } - throw new Error('Received full SPARQL query in path only mode'); - } else if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { - throw new Error('Received only path in full SPARQL mode'); - } - - // Ensure that blank nodes are not used across INSERT DATA clauses - if ($$[$0-1].type === 'update') { - const insertBnodesAll = {}; - for (const update of $$[$0-1].updates) { - if (update.updateType === 'insert') { - // Collect bnodes for current insert clause - const insertBnodes = {}; - for (const operation of update.insert) { - if (operation.type === 'bgp' || operation.type === 'graph') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'BlankNode') - insertBnodes[triple.subject.value] = true; - if (triple.predicate.termType === 'BlankNode') - insertBnodes[triple.predicate.value] = true; - if (triple.object.termType === 'BlankNode') - insertBnodes[triple.object.value] = true; - } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var SparqlParser = (function(){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],$V1=[2,247],$V2=[100,110,113,115,116,123,126,131,329,330,331,332,333],$V3=[2,409],$V4=[1,18],$V5=[1,27],$V6=[13,16,45,197,224,229,308],$V7=[28,29,53],$V8=[28,53],$V9=[1,42],$Va=[1,45],$Vb=[1,41],$Vc=[1,44],$Vd=[123,126],$Ve=[1,67],$Vf=[39,45,87],$Vg=[13,16,45,197,224,308],$Vh=[1,87],$Vi=[2,281],$Vj=[1,86],$Vk=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vl=[6,28,29,53,63,70,73,81,83,85],$Vm=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],$Vn=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],$Vo=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],$Vp=[13,16,308],$Vq=[112,132,327,334],$Vr=[13,16,112,132,308],$Vs=[1,111],$Vt=[1,117],$Vu=[112,132,327,328,334],$Vv=[13,16,112,132,308,328],$Vw=[28,29,45,53,87],$Vx=[1,138],$Vy=[1,151],$Vz=[1,128],$VA=[1,127],$VB=[1,129],$VC=[1,140],$VD=[1,141],$VE=[1,142],$VF=[1,143],$VG=[1,144],$VH=[1,145],$VI=[1,147],$VJ=[1,148],$VK=[2,457],$VL=[1,158],$VM=[1,159],$VN=[1,160],$VO=[1,152],$VP=[1,153],$VQ=[1,156],$VR=[1,171],$VS=[1,172],$VT=[1,173],$VU=[1,174],$VV=[1,175],$VW=[1,176],$VX=[1,167],$VY=[1,168],$VZ=[1,169],$V_=[1,170],$V$=[1,157],$V01=[1,166],$V11=[1,161],$V21=[1,162],$V31=[1,163],$V41=[1,164],$V51=[1,165],$V61=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],$V71=[1,195],$V81=[6,31,73,81,83,85],$V91=[2,285],$Va1=[1,199],$Vb1=[1,201],$Vc1=[6,31,70,73,81,83,85],$Vd1=[2,283],$Ve1=[1,207],$Vf1=[1,218],$Vg1=[1,223],$Vh1=[1,219],$Vi1=[1,225],$Vj1=[1,226],$Vk1=[1,224],$Vl1=[6,63,70,73,81,83,85],$Vm1=[1,236],$Vn1=[2,334],$Vo1=[1,243],$Vp1=[1,241],$Vq1=[6,193],$Vr1=[2,349],$Vs1=[2,339],$Vt1=[28,128],$Vu1=[47,48,193,272],$Vv1=[47,48,193,242,272],$Vw1=[47,48,193,242,246,272],$Vx1=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],$Vy1=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],$Vz1=[1,271],$VA1=[1,270],$VB1=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],$VC1=[1,281],$VD1=[1,280],$VE1=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],$VF1=[45,89],$VG1=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],$VH1=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$VI1=[31,89],$VJ1=[48,87],$VK1=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],$VL1=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],$VM1=[1,313],$VN1=[6,85],$VO1=[6,31,81,83,85],$VP1=[2,361],$VQ1=[2,353],$VR1=[1,343],$VS1=[31,112,335],$VT1=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$VU1=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],$VV1=[6,109,193],$VW1=[31,112],$VX1=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],$VY1=[1,390],$VZ1=[1,391],$V_1=[13,16,87,197,308,314],$V$1=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],$V02=[1,417],$V12=[1,418],$V22=[13,16,48,197,229,308],$V32=[6,31,85],$V42=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$V52=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],$V62=[29,31,85,112,159,160,161,163,164],$V72=[1,443],$V82=[1,444],$V92=[1,449],$Va2=[31,112,193,232,318,335],$Vb2=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vc2=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Vd2=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Ve2=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$Vf2=[31,45],$Vg2=[1,507],$Vh2=[1,508],$Vi2=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],$Vj2=[29,31,85,112,159,160,161,163,164,335],$Vk2=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$Vl2=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],$Vm2=[2,352],$Vn2=[13,16,197,308,314],$Vo2=[1,565],$Vp2=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$Vq2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$Vr2=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],$Vs2=[13,16,87,308],$Vt2=[2,364],$Vu2=[29,31,85,112,159,160,161,163,164,193,232,318,335],$Vv2=[31,112,193,232,272,318,335],$Vw2=[2,359],$Vx2=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],$Vy2=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],$Vz2=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],$VA2=[2,347]; +var parser = {trace: function trace () { }, +yy: {}, +symbols_: {"error":2,"QueryOrUpdate":3,"Prologue":4,"QueryOrUpdate_group0":5,"EOF":6,"Query":7,"Qry":8,"Query_option0":9,"Prologue_repetition0":10,"BaseDecl":11,"BASE":12,"IRIREF":13,"PrefixDecl":14,"PREFIX":15,"PNAME_NS":16,"SelectClauseWildcard":17,"Qry_repetition0":18,"WhereClause":19,"SolutionModifierNoGroup":20,"SelectClauseVars":21,"Qry_repetition1":22,"SolutionModifier":23,"CONSTRUCT":24,"ConstructTemplate":25,"Qry_repetition2":26,"Qry_repetition3":27,"WHERE":28,"{":29,"Qry_option0":30,"}":31,"DESCRIBE":32,"Qry_group0":33,"Qry_repetition4":34,"Qry_option1":35,"ASK":36,"Qry_repetition5":37,"SelectClauseBase":38,"*":39,"SelectClauseVars_repetition_plus0":40,"SELECT":41,"SelectClauseBase_option0":42,"SelectClauseItem":43,"Var":44,"(":45,"Expression":46,"AS":47,")":48,"SubSelect":49,"SubSelect_option0":50,"SubSelect_option1":51,"DatasetClause":52,"FROM":53,"DatasetClause_option0":54,"iri":55,"WhereClause_option0":56,"GroupGraphPattern":57,"SolutionModifier_option0":58,"SolutionModifierNoGroup_option0":59,"SolutionModifierNoGroup_option1":60,"SolutionModifierNoGroup_option2":61,"GroupClause":62,"GROUP":63,"BY":64,"GroupClause_repetition_plus0":65,"GroupCondition":66,"BuiltInCall":67,"FunctionCall":68,"HavingClause":69,"HAVING":70,"HavingClause_repetition_plus0":71,"OrderClause":72,"ORDER":73,"OrderClause_repetition_plus0":74,"OrderCondition":75,"ASC":76,"BrackettedExpression":77,"DESC":78,"Constraint":79,"LimitOffsetClauses":80,"LIMIT":81,"INTEGER":82,"OFFSET":83,"ValuesClause":84,"VALUES":85,"InlineData":86,"VAR":87,"InlineData_repetition0":88,"NIL":89,"InlineData_repetition1":90,"InlineData_repetition_plus2":91,"InlineData_repetition3":92,"DataBlock":93,"DataBlockValueList":94,"DataBlockValueList_repetition_plus0":95,"Update":96,"Update_repetition0":97,"Update1":98,"Update_option0":99,"LOAD":100,"Update1_option0":101,"Update1_option1":102,"Update1_group0":103,"Update1_option2":104,"GraphRefAll":105,"Update1_group1":106,"Update1_option3":107,"GraphOrDefault":108,"TO":109,"CREATE":110,"Update1_option4":111,"GRAPH":112,"INSERTDATA":113,"QuadPattern":114,"DELETEDATA":115,"DELETEWHERE":116,"Update1_option5":117,"InsertDeleteClause":118,"Update1_repetition0":119,"IntoGraphClause":120,"INTO":121,"GraphRef":122,"DELETE":123,"InsertDeleteClause_option0":124,"InsertClause":125,"INSERT":126,"UsingClause":127,"USING":128,"UsingClause_option0":129,"WithClause":130,"WITH":131,"DEFAULT":132,"GraphOrDefault_option0":133,"GraphRefAll_group0":134,"Quads":135,"Quads_option0":136,"Quads_repetition0":137,"QuadsNotTriples":138,"VarOrIri":139,"QuadsNotTriples_option0":140,"QuadsNotTriples_option1":141,"QuadsNotTriples_option2":142,"TriplesTemplate":143,"TriplesTemplate_repetition0":144,"TriplesSameSubject":145,"TriplesTemplate_option0":146,"GroupGraphPatternSub":147,"GroupGraphPatternSub_option0":148,"GroupGraphPatternSub_repetition0":149,"GroupGraphPatternSubTail":150,"GraphPatternNotTriples":151,"GroupGraphPatternSubTail_option0":152,"GroupGraphPatternSubTail_option1":153,"TriplesBlock":154,"TriplesBlock_repetition0":155,"TriplesSameSubjectPath":156,"TriplesBlock_option0":157,"GroupOrUnionGraphPattern":158,"OPTIONAL":159,"MINUS":160,"SERVICE":161,"GraphPatternNotTriples_option0":162,"FILTER":163,"BIND":164,"InlineDataOneVar":165,"InlineDataFull":166,"InlineDataOneVar_repetition0":167,"InlineDataFull_repetition0":168,"InlineDataFull_repetition_plus1":169,"InlineDataFull_repetition2":170,"DataBlockValue":171,"Literal":172,"QuotedTriple":173,"UNDEF":174,"GroupOrUnionGraphPattern_repetition0":175,"ArgList":176,"ArgList_option0":177,"ArgList_repetition0":178,"ExpressionList":179,"ExpressionList_repetition0":180,"ConstructTemplate_option0":181,"ConstructTriples":182,"ConstructTriples_repetition0":183,"ConstructTriples_option0":184,"VarOrTermOrQuotedTP":185,"PropertyListNotEmpty":186,"TriplesNode":187,"PropertyList":188,"PropertyList_option0":189,"VerbObjectList":190,"PropertyListNotEmpty_repetition0":191,"SemiOptionalVerbObjectList":192,";":193,"SemiOptionalVerbObjectList_option0":194,"Verb":195,"ObjectList":196,"a":197,"ObjectList_repetition0":198,"Object":199,"GraphNode":200,"Object_option0":201,"PropertyListPathNotEmpty":202,"TriplesNodePath":203,"TriplesSameSubjectPath_option0":204,"O":205,"PropertyListPathNotEmpty_repetition0":206,"PropertyListPathNotEmptyTail":207,"O_group0":208,"ObjectListPath":209,"ObjectListPath_repetition0":210,"ObjectPath":211,"GraphNodePath":212,"ObjectPath_option0":213,"Path":214,"Path_repetition0":215,"PathSequence":216,"PathSequence_repetition0":217,"PathEltOrInverse":218,"PathElt":219,"PathPrimary":220,"PathElt_option0":221,"PathEltOrInverse_option0":222,"IriOrA":223,"!":224,"PathNegatedPropertySet":225,"PathOneInPropertySet":226,"PathNegatedPropertySet_repetition0":227,"PathNegatedPropertySet_option0":228,"^":229,"TriplesNode_repetition_plus0":230,"[":231,"]":232,"TriplesNodePath_repetition_plus0":233,"VarOrTermOrQuotedTPExpr":234,"VarOrTerm":235,"GraphTerm":236,"BlankNode":237,"ConditionalOrExpression":238,"ConditionalAndExpression":239,"ConditionalOrExpression_repetition0":240,"ConditionalOrExpressionTail":241,"||":242,"RelationalExpression":243,"ConditionalAndExpression_repetition0":244,"ConditionalAndExpressionTail":245,"&&":246,"NumericExpression":247,"RelationalExpression_group0":248,"RelationalExpression_option0":249,"IN":250,"MultiplicativeExpression":251,"NumericExpression_repetition0":252,"AdditiveExpressionTail":253,"AdditiveExpressionTail_group0":254,"NumericLiteralPositive":255,"AdditiveExpressionTail_repetition0":256,"NumericLiteralNegative":257,"AdditiveExpressionTail_repetition1":258,"UnaryExpression":259,"MultiplicativeExpression_repetition0":260,"MultiplicativeExpressionTail":261,"MultiplicativeExpressionTail_group0":262,"+":263,"PrimaryExpression":264,"-":265,"ExprQuotedTP":266,"Aggregate":267,"FUNC_ARITY0":268,"FUNC_ARITY1":269,"FUNC_ARITY1_SPARQL_STAR":270,"FUNC_ARITY2":271,",":272,"FUNC_ARITY3":273,"FUNC_ARITY3_SPARQL_STAR":274,"BuiltInCall_group0":275,"BOUND":276,"BNODE":277,"BuiltInCall_option0":278,"EXISTS":279,"COUNT":280,"Aggregate_option0":281,"Aggregate_group0":282,"FUNC_AGGREGATE":283,"Aggregate_option1":284,"GROUP_CONCAT":285,"Aggregate_option2":286,"Aggregate_option3":287,"GroupConcatSeparator":288,"SEPARATOR":289,"=":290,"String":291,"LANGTAG":292,"^^":293,"DECIMAL":294,"DOUBLE":295,"BOOLEAN":296,"INTEGER_POSITIVE":297,"DECIMAL_POSITIVE":298,"DOUBLE_POSITIVE":299,"INTEGER_NEGATIVE":300,"DECIMAL_NEGATIVE":301,"DOUBLE_NEGATIVE":302,"STRING_LITERAL1":303,"STRING_LITERAL2":304,"STRING_LITERAL_LONG1":305,"STRING_LITERAL_LONG2":306,"PrefixedName":307,"PNAME_LN":308,"BLANK_NODE_LABEL":309,"ANON":310,"QuotedTP":311,"<<":312,"qtSubjectOrObject":313,">>":314,"DataValueTerm":315,"AnnotationPattern":316,"{|":317,"|}":318,"AnnotationPatternPath":319,"ExprVarOrTerm":320,"QueryOrUpdate_group0_option0":321,"Prologue_repetition0_group0":322,"Qry_group0_repetition_plus0":323,"SelectClauseBase_option0_group0":324,"DISTINCT":325,"REDUCED":326,"NAMED":327,"SILENT":328,"CLEAR":329,"DROP":330,"ADD":331,"MOVE":332,"COPY":333,"ALL":334,".":335,"UNION":336,"|":337,"/":338,"PathElt_option0_group0":339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,"NOT":346,"CONCAT":347,"COALESCE":348,"SUBSTR":349,"REGEX":350,"REPLACE":351,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"}, +productions_: [0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: + + // Set parser options + $$[$0-1] = $$[$0-1] || {}; + if (Parser.base) + $$[$0-1].base = Parser.base; + Parser.base = ''; + $$[$0-1].prefixes = Parser.prefixes; + Parser.prefixes = null; + + if (Parser.pathOnly) { + if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { + return $$[$0-1] + } + throw new Error('Received full SPARQL query in path only mode'); + } else if ($$[$0-1].type === 'path' || 'termType' in $$[$0-1]) { + throw new Error('Received only path in full SPARQL mode'); + } + + // Ensure that blank nodes are not used across INSERT DATA clauses + if ($$[$0-1].type === 'update') { + const insertBnodesAll = {}; + for (const update of $$[$0-1].updates) { + if (update.updateType === 'insert') { + // Collect bnodes for current insert clause + const insertBnodes = {}; + for (const operation of update.insert) { + if (operation.type === 'bgp' || operation.type === 'graph') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'BlankNode') + insertBnodes[triple.subject.value] = true; + if (triple.predicate.termType === 'BlankNode') + insertBnodes[triple.predicate.value] = true; + if (triple.object.termType === 'BlankNode') + insertBnodes[triple.object.value] = true; } } - - // Check if the inserting bnodes don't clash with bnodes from a previous insert clause - for (const bnode of Object.keys(insertBnodes)) { - if (insertBnodesAll[bnode]) { - throw new Error('Detected reuse blank node across different INSERT DATA clauses'); - } - insertBnodesAll[bnode] = true; + } + + // Check if the inserting bnodes don't clash with bnodes from a previous insert clause + for (const bnode of Object.keys(insertBnodes)) { + if (insertBnodesAll[bnode]) { + throw new Error('Detected reuse blank node across different INSERT DATA clauses'); } + insertBnodesAll[bnode] = true; } } } - return $$[$0-1]; - - break; - case 2: - this.$ = { ...$$[$0-1], ...$$[$0], type: 'query' }; - break; - case 4: - - Parser.base = resolveIRI($$[$0]) - - break; - case 5: - - if (!Parser.prefixes) Parser.prefixes = {}; - $$[$0-1] = $$[$0-1].substr(0, $$[$0-1].length - 1); - $$[$0] = resolveIRI($$[$0]); - Parser.prefixes[$$[$0-1]] = $$[$0]; - - break; - case 6: - this.$ = { ...$$[$0-3], ...groupDatasets($$[$0-2]), ...$$[$0-1], ...$$[$0] }; - break; - case 7: - - // Check for projection of ungrouped variable - if (!Parser.skipValidation) { - const counts = flatten($$[$0-3].variables.map(vars => getAggregatesOfExpression(vars.expression))) - .some(agg => agg.aggregation === "count" && !(agg.expression instanceof Wildcard)); - if (counts || $$[$0].group) { - for (const selectVar of $$[$0-3].variables) { - if (selectVar.termType === "Variable") { - if (!$$[$0].group || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(selectVar))) { - throw Error("Projection of ungrouped variable (?" + getExpressionId(selectVar) + ")"); - } - } else if (getAggregatesOfExpression(selectVar.expression).length === 0) { - const usedVars = getVariablesFromExpression(selectVar.expression); - for (const usedVar of usedVars) { - if (!$$[$0].group || !$$[$0].group.map || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(usedVar))) { - throw Error("Use of ungrouped variable in projection of operation (?" + getExpressionId(usedVar) + ")"); - } + } + return $$[$0-1]; + +break; +case 2: +this.$ = { ...$$[$0-1], ...$$[$0], type: 'query' }; +break; +case 4: + + Parser.base = resolveIRI($$[$0]) + +break; +case 5: + + if (!Parser.prefixes) Parser.prefixes = {}; + $$[$0-1] = $$[$0-1].substr(0, $$[$0-1].length - 1); + $$[$0] = resolveIRI($$[$0]); + Parser.prefixes[$$[$0-1]] = $$[$0]; + +break; +case 6: +this.$ = { ...$$[$0-3], ...groupDatasets($$[$0-2]), ...$$[$0-1], ...$$[$0] }; +break; +case 7: + + // Check for projection of ungrouped variable + if (!Parser.skipValidation) { + const counts = flatten($$[$0-3].variables.map(vars => getAggregatesOfExpression(vars.expression))) + .some(agg => agg.aggregation === "count" && !(agg.expression instanceof Wildcard)); + if (counts || $$[$0].group) { + for (const selectVar of $$[$0-3].variables) { + if (selectVar.termType === "Variable") { + if (!$$[$0].group || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(selectVar))) { + throw Error("Projection of ungrouped variable (?" + getExpressionId(selectVar) + ")"); + } + } else if (getAggregatesOfExpression(selectVar.expression).length === 0) { + const usedVars = getVariablesFromExpression(selectVar.expression); + for (const usedVar of usedVars) { + if (!$$[$0].group || !$$[$0].group.map || !$$[$0].group.map(groupVar => getExpressionId(groupVar)).includes(getExpressionId(usedVar))) { + throw Error("Use of ungrouped variable in projection of operation (?" + getExpressionId(usedVar) + ")"); } } } } } - // Check if id of each AS-selected column is not yet bound by subquery - const subqueries = $$[$0-1].where.filter(w => w.type === "query"); - if (subqueries.length > 0) { - const selectedVarIds = $$[$0-3].variables.filter(v => v.variable && v.variable.value).map(v => v.variable.value); - const subqueryIds = flatten(subqueries.map(sub => sub.variables)).map(v => v.value || v.variable.value); - for (const selectedVarId of selectedVarIds) { - if (subqueryIds.indexOf(selectedVarId) >= 0) { - throw Error("Target id of 'AS' (?" + selectedVarId + ") already used in subquery"); - } - } - } - this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]) - - break; - case 8: - this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 9: - this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-2] = ($$[$0-2] ? $$[$0-2].triples : []) }, groupDatasets($$[$0-5]), { where: [ { type: 'bgp', triples: appendAllTo([], $$[$0-2]) } ] }, $$[$0]); - break; - case 10: - this.$ = extend({ queryType: 'DESCRIBE', variables: $$[$0-3] === '*' ? [new Wildcard()] : $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 11: - this.$ = extend({ queryType: 'ASK' }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); - break; - case 12: - this.$ = extend($$[$0-1], {variables: [new Wildcard()]}); - break; - case 13: - - // Check if id of each selected column is different - const selectedVarIds = $$[$0].map(v => v.value || v.variable.value); - const duplicates = getDuplicatesInArray(selectedVarIds); - if (duplicates.length > 0) { - throw Error("Two or more of the resulting columns have the same name (?" + duplicates[0] + ")"); - } - - this.$ = extend($$[$0-1], { variables: $$[$0] }) - - break; - case 14: - this.$ = extend({ queryType: 'SELECT'}, $$[$0] && ($$[$0-1] = lowercase($$[$0]), $$[$0] = {}, $$[$0][$$[$0-1]] = true, $$[$0])); - break; - case 16: case 27: - this.$ = expression($$[$0-3], { variable: $$[$0-1] }); - break; - case 17: case 18: - this.$ = extend($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], { type: 'query' }); - break; - case 19: case 58: - this.$ = { iri: $$[$0], named: !!$$[$0-1] }; - break; - case 20: - this.$ = { where: $$[$0].patterns }; - break; - case 21: - this.$ = extend($$[$0-1], $$[$0]); - break; - case 22: - this.$ = extend($$[$0-2], $$[$0-1], $$[$0]); - break; - case 23: - this.$ = { group: $$[$0] }; - break; - case 24: case 25: case 28: case 31: case 33: case 34: - this.$ = expression($$[$0]); - break; - case 26: - this.$ = expression($$[$0-1]); - break; - case 29: - this.$ = { having: $$[$0] }; - break; - case 30: - this.$ = { order: $$[$0] }; - break; - case 32: - this.$ = expression($$[$0], { descending: true }); - break; - case 35: - this.$ = { limit: toInt($$[$0]) }; - break; - case 36: - this.$ = { offset: toInt($$[$0]) }; - break; - case 37: - this.$ = { limit: toInt($$[$0-2]), offset: toInt($$[$0]) }; - break; - case 38: - this.$ = { limit: toInt($$[$0]), offset: toInt($$[$0-2]) }; - break; - case 39: case 43: - this.$ = { type: 'values', values: $$[$0] }; - break; - case 40: case 84: - this.$ = $$[$0-1].map(v => ({ [$$[$0-3]]: v })); - break; - case 41: case 85: - this.$ = $$[$0-1].map(() => ({})); - break; - case 42: case 86: - - var length = $$[$0-4].length; - $$[$0-4] = $$[$0-4].map(toVar); - this.$ = $$[$0-1].map(function (values) { - if (values.length !== length) - throw Error('Inconsistent VALUES length'); - var valuesObject = {}; - for(var i = 0; i el.type === "bind")) { - const index = $$[$0-1].indexOf(binding); - const boundVars = new Set(); - //Collect all bounded variables before the binding - for (const el of $$[$0-1].slice(0, index)) { - if (el.type === "group" || el.type === "bgp") { - getBoundVarsFromGroupGraphPattern(el).forEach(boundVar => boundVars.add(boundVar)); - } - } - // If binding with a non-free variable, throw error - if (boundVars.has(binding.variable.value)) { - throw Error("Variable used to bind is already bound (?" + binding.variable.value + ")"); - } - } - this.$ = { type: 'group', patterns: $$[$0-1] } - - break; - case 71: - this.$ = $$[$0-1] ? unionAll([$$[$0-1]], $$[$0]) : unionAll($$[$0]); - break; - case 72: - this.$ = $$[$0] ? [$$[$0-2], $$[$0]] : $$[$0-2]; - break; - case 75: - this.$ = extend($$[$0], { type: 'optional' }); - break; - case 76: - this.$ = extend($$[$0], { type: 'minus' }); - break; - case 77: - this.$ = extend($$[$0], { type: 'graph', name: $$[$0-1] }); - break; - case 78: - this.$ = extend($$[$0], { type: 'service', name: $$[$0-1], silent: !!$$[$0-2] }); - break; - case 79: - this.$ = { type: 'filter', expression: $$[$0] }; - break; - case 80: - this.$ = { type: 'bind', variable: $$[$0-1], expression: $$[$0-3] }; - break; - case 89: - this.$ = ensureSparqlStar($$[$0]); - break; - case 90: - this.$ = undefined; - break; - case 91: - this.$ = $$[$0-1].length ? { type: 'union', patterns: unionAll($$[$0-1].map(degroupSingle), [degroupSingle($$[$0])]) } : $$[$0]; - break; - case 95: - this.$ = { ...$$[$0], function: $$[$0-1] }; - break; - case 96: - this.$ = { type: 'functionCall', args: [] }; - break; - case 97: - this.$ = { type: 'functionCall', args: appendTo($$[$0-2], $$[$0-1]), distinct: !!$$[$0-3] }; - break; - case 98: case 115: case 128: case 247: case 249: case 251: case 253: case 255: case 263: case 267: case 297: case 299: case 303: case 307: case 328: case 341: case 349: case 355: case 361: case 367: case 369: case 373: case 375: case 379: case 381: case 385: case 391: case 395: case 401: case 405: case 409: case 411: case 420: case 428: case 430: case 440: case 444: case 446: case 448: - this.$ = []; - break; - case 99: - this.$ = appendTo($$[$0-2], $$[$0-1]); - break; - case 101: - this.$ = unionAll($$[$0-2], [$$[$0-1]]); - break; - case 102: case 112: - this.$ = applyAnnotations($$[$0].map(t => extend(triple($$[$0-1]), t))); - break; - case 103: - this.$ = applyAnnotations(appendAllTo($$[$0].map(t => extend(triple($$[$0-1].entity), t)), $$[$0-1].triples)) /* the subject is a blank node, possibly with more triples */; - break; - case 105: - this.$ = unionAll([$$[$0-1]], $$[$0]); - break; - case 106: - this.$ = unionAll($$[$0]); - break; - case 107: - this.$ = objectListToTriples($$[$0-1], $$[$0]); - break; - case 109: case 237: - this.$ = Parser.factory.namedNode(RDF_TYPE); - break; - case 110: case 118: - this.$ = appendTo($$[$0-1], $$[$0]); - break; - case 111: - this.$ = $$[$0] ? { annotation: $$[$0], object: $$[$0-1] } : $$[$0-1]; - break; - case 113: - this.$ = !$$[$0] ? $$[$0-1].triples : applyAnnotations(appendAllTo($$[$0].map(t => extend(triple($$[$0-1].entity), t)), $$[$0-1].triples)) /* the subject is a blank node, possibly with more triples */; - break; - case 114: - this.$ = objectListToTriples(...$$[$0-1], $$[$0]); - break; - case 116: - this.$ = objectListToTriples(...$$[$0]); - break; - case 117: case 159: case 163: - this.$ = [$$[$0-1], $$[$0]]; - break; - case 119: - this.$ = $$[$0] ? { object: $$[$0-1], annotation: $$[$0] } : $$[$0-1];; - break; - case 120: - this.$ = $$[$0-1].length ? path('|',appendTo($$[$0-1], $$[$0])) : $$[$0]; - break; - case 121: - this.$ = $$[$0-1].length ? path('/', appendTo($$[$0-1], $$[$0])) : $$[$0]; - break; - case 122: - this.$ = $$[$0] ? path($$[$0], [$$[$0-1]]) : $$[$0-1]; - break; - case 123: - this.$ = $$[$0-1] ? path($$[$0-1], [$$[$0]]) : $$[$0];; - break; - case 125: case 131: - this.$ = path($$[$0-1], [$$[$0]]); - break; - case 129: - this.$ = path('|', appendTo($$[$0-2], $$[$0-1])); - break; - case 132: case 134: - this.$ = createList($$[$0-1]); - break; - case 133: case 135: - this.$ = createAnonymousObject($$[$0-1]); - break; - case 140: - this.$ = { entity: $$[$0], triples: [] }; - break; - case 145: - this.$ = toVar($$[$0]); - break; - case 149: - this.$ = Parser.factory.namedNode(RDF_NIL); - break; - case 151: case 153: case 158: case 162: - this.$ = createOperationTree($$[$0-1], $$[$0]); - break; - case 152: - this.$ = ['||', $$[$0]]; - break; - case 154: - this.$ = ['&&', $$[$0]]; - break; - case 156: - this.$ = operation($$[$0-1], [$$[$0-2], $$[$0]]); - break; - case 157: - this.$ = operation($$[$0-2] ? 'notin' : 'in', [$$[$0-3], $$[$0]]); - break; - case 160: - this.$ = ['+', createOperationTree($$[$0-1], $$[$0])]; - break; - case 161: - - var negatedLiteral = createTypedLiteral($$[$0-1].value.replace('-', ''), $$[$0-1].datatype); - this.$ = ['-', createOperationTree(negatedLiteral, $$[$0])]; - - break; - case 164: - this.$ = operation('UPLUS', [$$[$0]]); - break; - case 165: - this.$ = operation($$[$0-1], [$$[$0]]); - break; - case 166: - this.$ = operation('UMINUS', [$$[$0]]); - break; - case 177: - this.$ = operation(lowercase($$[$0-1])); - break; - case 178: - this.$ = operation(lowercase($$[$0-3]), [$$[$0-1]]); - break; - case 179: - this.$ = ensureSparqlStar(operation(lowercase($$[$0-3]), [$$[$0-1]])); - break; - case 180: - this.$ = operation(lowercase($$[$0-5]), [$$[$0-3], $$[$0-1]]); - break; - case 181: - this.$ = operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]]); - break; - case 182: - this.$ = ensureSparqlStar(operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]])); - break; - case 183: - this.$ = operation(lowercase($$[$0-1]), $$[$0]); - break; - case 184: - this.$ = operation('bound', [toVar($$[$0-1])]); - break; - case 185: - this.$ = operation($$[$0-1], []); - break; - case 186: - this.$ = operation($$[$0-3], [$$[$0-1]]); - break; - case 187: - this.$ = operation($$[$0-2] ? 'notexists' :'exists', [degroupSingle($$[$0])]); - break; - case 188: case 189: - this.$ = expression($$[$0-1], { type: 'aggregate', aggregation: lowercase($$[$0-4]), distinct: !!$$[$0-2] }); - break; - case 190: - this.$ = expression($$[$0-2], { type: 'aggregate', aggregation: lowercase($$[$0-5]), distinct: !!$$[$0-3], separator: typeof $$[$0-1] === 'string' ? $$[$0-1] : ' ' }); - break; - case 192: - this.$ = createTypedLiteral($$[$0]); - break; - case 193: - this.$ = createLangLiteral($$[$0-1], lowercase($$[$0].substr(1))); - break; - case 194: - this.$ = createTypedLiteral($$[$0-2], $$[$0]); - break; - case 195: case 204: - this.$ = createTypedLiteral($$[$0], XSD_INTEGER); - break; - case 196: case 205: - this.$ = createTypedLiteral($$[$0], XSD_DECIMAL); - break; - case 197: case 206: - this.$ = createTypedLiteral(lowercase($$[$0]), XSD_DOUBLE); - break; - case 200: - this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_BOOLEAN); - break; - case 201: - this.$ = createTypedLiteral($$[$0].substr(1), XSD_INTEGER); - break; - case 202: - this.$ = createTypedLiteral($$[$0].substr(1), XSD_DECIMAL); - break; - case 203: - this.$ = createTypedLiteral($$[$0].substr(1).toLowerCase(), XSD_DOUBLE); - break; - case 207: case 208: - this.$ = unescapeString($$[$0], 1); - break; - case 209: case 210: - this.$ = unescapeString($$[$0], 3); - break; - case 211: - this.$ = Parser.factory.namedNode(resolveIRI($$[$0])); - break; - case 213: - - var namePos = $$[$0].indexOf(':'), - prefix = $$[$0].substr(0, namePos), - expansion = Parser.prefixes[prefix]; - if (!expansion) throw new Error('Unknown prefix: ' + prefix); - var uriString = resolveIRI(expansion + $$[$0].substr(namePos + 1)); - this.$ = Parser.factory.namedNode(uriString); - - break; - case 214: - - $$[$0] = $$[$0].substr(0, $$[$0].length - 1); - if (!($$[$0] in Parser.prefixes)) throw new Error('Unknown prefix: ' + $$[$0]); - var uriString = resolveIRI(Parser.prefixes[$$[$0]]); - this.$ = Parser.factory.namedNode(uriString); - - break; - case 215: - this.$ = blank($$[$0].replace(/^(_:)/,''));; - break; - case 216: - this.$ = blank(); - break; - case 217: case 218: case 232: - this.$ = ensureSparqlStar(nestedTriple($$[$0-3], $$[$0-2], $$[$0-1])); - break; - case 230: case 231: - this.$ = ensureSparqlStar($$[$0-1]); - break; - case 248: case 250: case 252: case 254: case 256: case 260: case 264: case 268: case 270: case 292: case 294: case 296: case 298: case 300: case 302: case 304: case 306: case 329: case 342: case 356: case 368: case 370: case 372: case 374: case 392: case 402: case 425: case 427: case 429: case 431: case 441: case 445: case 447: case 449: - $$[$0-1].push($$[$0]); - break; - case 259: case 269: case 291: case 293: case 295: case 301: case 305: case 371: case 424: case 426: - this.$ = [$$[$0]]; - break; - case 308: - $$[$0-3].push($$[$0-2]); - break; - case 350: case 362: case 376: case 380: case 382: case 386: case 396: case 406: case 410: case 412: case 421: - $$[$0-2].push($$[$0-1]); - break; - } - }, - table: [o($V0,$V1,{3:1,4:2,10:3}),{1:[3]},o($V2,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,24:[1,13],32:[1,14],36:[1,15],41:$V4}),o([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:$V5},{6:[2,239]},o($V6,[2,411],{216:28,217:29}),o($V7,[2,249],{18:30}),o($V7,[2,251],{22:31}),o($V8,[2,255],{25:32,27:33,29:[1,34]}),{13:$V9,16:$Va,33:35,39:[1,37],44:39,55:40,87:$Vb,139:38,307:43,308:$Vc,323:36},o($V7,[2,267],{37:46}),o($Vd,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:$Ve,87:$Vb},o($Vf,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),o($V0,[2,248]),o($V0,[2,245]),o($V0,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},o([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),o($Vg,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:$Vh,29:$Vi,52:84,53:$Vj,56:85},{19:88,28:$Vh,29:$Vi,52:89,53:$Vj,56:85},o($V7,[2,253],{26:90}),{28:[1,91],52:92,53:$Vj},o($Vk,[2,385],{181:93,182:94,183:95,31:[2,383]}),o($Vl,[2,263],{34:96}),o($Vl,[2,261],{44:39,55:40,307:43,139:97,13:$V9,16:$Va,87:$Vb,308:$Vc}),o($Vl,[2,262]),o($Vm,[2,259]),o($Vn,[2,143]),o($Vn,[2,144]),o([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),o($Vo,[2,211]),o($Vo,[2,212]),o($Vo,[2,213]),o($Vo,[2,214]),{19:98,28:$Vh,29:$Vi,52:99,53:$Vj,56:85},{6:[2,309],99:100,193:[1,101]},o($Vp,[2,311],{101:102,328:[1,103]}),o($Vq,[2,317],{104:104,328:[1,105]}),o($Vr,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:$Vs,114:110},{29:$Vs,114:112},{29:$Vs,114:113},{118:114,123:[1,115],125:116,126:$Vt},o($Vu,[2,315]),o($Vu,[2,316]),o($Vv,[2,319]),o($Vv,[2,320]),o($Vv,[2,321]),o($Vd,[2,327]),{13:$V9,16:$Va,55:118,307:43,308:$Vc},o($V7,[2,12]),o($V7,[2,13],{44:66,43:119,45:$Ve,87:$Vb}),o($Vw,[2,269]),o($Vw,[2,15]),{13:$V9,16:$Va,44:136,45:$Vx,46:120,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vf,[2,14]),o($Vf,[2,274]),o($Vf,[2,271]),o($Vf,[2,272]),o($V0,[2,4]),{13:[1,177]},o($V61,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},o($V6,[2,410]),o([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:$V9,16:$Va,45:[1,193],55:194,197:$V71,219:189,220:190,223:191,224:[1,192],307:43,308:$Vc},o($Vg,[2,419]),o($V81,$V91,{20:196,59:197,69:198,70:$Va1}),o($V7,[2,250]),{29:$Vb1,57:200},o($Vp,[2,279],{54:202,327:[1,203]}),{29:[2,282]},o($Vc1,$Vd1,{23:204,58:205,62:206,63:$Ve1}),o($V7,[2,252]),{19:208,28:$Vh,29:$Vi,52:209,53:$Vj,56:85},{29:[1,210]},o($V8,[2,256]),{31:[1,211]},{31:[2,384]},{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,145:212,172:221,185:213,187:214,231:$Vh1,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl1,[2,265],{56:85,35:227,52:228,19:229,28:$Vh,29:$Vi,53:$Vj}),o($Vm,[2,260]),o($Vc1,$Vd1,{58:205,62:206,23:230,63:$Ve1}),o($V7,[2,268]),{6:[2,45]},o($V0,$V1,{10:3,4:231}),{13:$V9,16:$Va,55:232,307:43,308:$Vc},o($Vp,[2,312]),{105:233,112:$Vm1,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},o($Vq,[2,318]),o($Vp,$Vn1,{108:240,133:242,112:$Vo1,132:$Vp1}),o($Vr,[2,323]),{112:[1,244]},{112:[2,325]},o($Vq1,[2,50]),o($Vk,$Vr1,{135:245,136:246,143:247,144:248,31:$Vs1,112:$Vs1}),o($Vq1,[2,51]),o($Vq1,[2,52]),o($Vt1,[2,328],{119:249}),{29:$Vs,114:250},o($Vt1,[2,56]),{29:$Vs,114:251},o($Vd,[2,59]),o($Vw,[2,270]),{47:[1,252]},o($Vu1,[2,150]),o($Vv1,[2,428],{240:253}),o($Vw1,[2,430],{244:254}),o($Vw1,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),o($Vx1,[2,440],{252:264}),o($Vy1,[2,448],{260:265}),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:266,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:267,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:268,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vy1,[2,167]),o($Vy1,[2,168]),o($Vy1,[2,169]),o($Vy1,[2,170],{176:269,45:$Vz1,89:$VA1}),o($Vy1,[2,171]),o($Vy1,[2,172]),o($Vy1,[2,173]),o($Vy1,[2,174]),{13:$V9,16:$Va,44:136,45:$Vx,46:272,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:$VC1,89:$VD1,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},o($VE1,[2,192],{292:[1,286],293:[1,287]}),o($VE1,[2,195]),o($VE1,[2,196]),o($VE1,[2,197]),o($VE1,[2,198]),o($VE1,[2,199]),o($VE1,[2,200]),{13:$V9,16:$Va,44:39,55:40,82:$Vy,87:$Vb,139:289,172:291,255:154,257:155,266:290,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},o($VF1,[2,452]),o($VF1,[2,453]),o($VF1,[2,454]),o($VF1,[2,455]),o($VF1,[2,456]),{279:[2,458]},o($VG1,[2,207]),o($VG1,[2,208]),o($VG1,[2,209]),o($VG1,[2,210]),o($VE1,[2,201]),o($VE1,[2,202]),o($VE1,[2,203]),o($VE1,[2,204]),o($VE1,[2,205]),o($VE1,[2,206]),o($V0,[2,5]),o($VH1,[2,297],{88:295}),o($VI1,[2,299],{90:296}),{48:[1,297],87:[1,298]},o($VJ1,[2,301]),o($V61,[2,43]),o($V61,[2,82]),o($V61,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},o($V6,[2,412]),o($VK1,[2,123]),o($VK1,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),o($VL1,[2,124]),{13:$V9,16:$Va,45:[1,311],55:194,89:[1,310],197:$V71,223:312,225:308,226:309,229:$VM1,307:43,308:$Vc},o($V6,$V3,{215:10,214:314}),o($VL1,[2,236]),o($VL1,[2,237]),o($VN1,[2,6]),o($VO1,[2,287],{60:315,72:316,73:[1,317]}),o($V81,[2,286]),{13:$V9,16:$Va,45:$Vx,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o([6,31,63,70,73,81,83,85],[2,20]),o($Vk,$VP1,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:$VQ1,31:$VQ1,85:$VQ1,112:$VQ1,159:$VQ1,160:$VQ1,161:$VQ1,163:$VQ1,164:$VQ1,41:$V4}),{13:$V9,16:$Va,55:331,307:43,308:$Vc},o($Vp,[2,280]),o($VN1,[2,7]),o($V81,$V91,{59:197,69:198,20:332,70:$Va1}),o($Vc1,[2,284]),{64:[1,333]},o($Vc1,$Vd1,{58:205,62:206,23:334,63:$Ve1}),o($V7,[2,254]),o($Vk,$Vr1,{144:248,30:335,143:336,31:[2,257]}),o($V7,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:339,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VS1,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:$V9,16:$Va,87:$Vb,197:$VR1,308:$Vc}),o($VT1,[2,227]),o($VT1,[2,228]),o($VT1,[2,229]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,200:348,230:347,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:352,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VT1,[2,146]),o($VT1,[2,147]),o($VT1,[2,148]),o($VT1,[2,149]),{13:$V9,16:$Va,44:354,55:355,82:$Vy,87:$Vb,172:357,237:356,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:358,312:$Vk1,313:353},o($VU1,[2,215]),o($VU1,[2,216]),o($Vc1,$Vd1,{58:205,62:206,23:359,63:$Ve1}),o($Vl,[2,264]),o($Vl1,[2,266]),o($VN1,[2,11]),o($V2,[2,308],{6:[2,310]}),o($Vq1,[2,313],{102:360,120:361,121:[1,362]}),o($Vq1,[2,47]),o($Vq1,[2,63]),o($Vq1,[2,64]),{13:$V9,16:$Va,55:363,307:43,308:$Vc},o($Vq1,[2,336]),o($Vq1,[2,337]),o($Vq1,[2,338]),{109:[1,364]},o($VV1,[2,60]),{13:$V9,16:$Va,55:365,307:43,308:$Vc},o($Vp,[2,335]),{13:$V9,16:$Va,55:366,307:43,308:$Vc},{31:[1,367]},o($VW1,[2,341],{137:368}),o($VW1,[2,340]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,145:369,172:221,185:213,187:214,231:$Vh1,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},{28:[1,370],127:371,128:[1,372]},o($Vt1,[2,330],{124:373,125:374,126:$Vt}),o($Vt1,[2,57]),{44:375,87:$Vb},o($Vu1,[2,151],{241:376,242:[1,377]}),o($Vv1,[2,153],{245:378,246:[1,379]}),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,247:380,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{250:[1,381]},o($VX1,[2,432]),o($VX1,[2,433]),o($VX1,[2,434]),o($VX1,[2,435]),o($VX1,[2,436]),o($VX1,[2,437]),{250:[2,439]},o([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW}),o($Vx1,[2,162],{261:388,262:389,39:$VY1,338:$VZ1}),o($Vy1,[2,164]),o($Vy1,[2,165]),o($Vy1,[2,166]),o($VB1,[2,95]),o($VB1,[2,96]),o($VX1,[2,377],{177:392,325:[1,393]}),{48:[1,394]},o($VB1,[2,177]),{13:$V9,16:$Va,44:136,45:$Vx,46:395,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:396,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:397,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:398,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:399,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,183]),o($VB1,[2,98]),o($VX1,[2,381],{180:400}),{87:[1,401]},o($VB1,[2,185]),{13:$V9,16:$Va,44:136,45:$Vx,46:402,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{29:$Vb1,57:403},o($VE1,[2,193]),{13:$V9,16:$Va,55:404,307:43,308:$Vc},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,195:405,197:$VR1,307:43,308:$Vc},o($V_1,[2,233]),o($V_1,[2,234]),o($V_1,[2,235]),o($V$1,[2,459],{281:406,325:[1,407]}),o($VX1,[2,463],{284:408,325:[1,409]}),o($VX1,[2,465],{286:410,325:[1,411]}),{13:$V9,16:$Va,31:[1,412],55:414,82:$Vy,171:413,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,419],89:[1,420]},{29:[1,421]},o($VJ1,[2,302]),o($VH1,[2,367],{167:422}),o($VI1,[2,369],{168:423}),{48:[1,424],87:[1,425]},o($VJ1,[2,371]),o($VK1,[2,122]),o($VK1,[2,417]),o($VK1,[2,413]),o($VK1,[2,414]),o($VK1,[2,415]),o($VL1,[2,125]),o($VL1,[2,127]),o($VL1,[2,128]),o($V22,[2,420],{227:426}),o($VL1,[2,130]),{13:$V9,16:$Va,55:194,197:$V71,223:427,307:43,308:$Vc},{48:[1,428]},o($V32,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),o($VO1,[2,288]),{64:[1,433]},o($V81,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:$V9,16:$Va,45:$Vx,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($V42,[2,293]),o($V52,[2,92]),o($V52,[2,93]),o($V52,[2,94]),{45:$Vz1,89:$VA1,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:$Vh,29:$Vi,56:85},{19:438,28:$Vh,29:$Vi,56:85},o($V62,[2,355],{149:439}),o($V62,[2,354]),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,156:440,172:221,185:441,203:442,231:$V82,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl,[2,19]),o($V32,[2,21]),{13:$V9,16:$Va,44:450,45:$V92,55:323,65:445,66:446,67:447,68:448,87:$Vb,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VN1,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},o($Vk,[2,386],{31:[2,388]}),o($VS1,[2,102]),o($Va2,[2,391],{191:452}),o($Vk,[2,395],{196:453,198:454}),o($Vk,[2,108]),o($Vk,[2,109]),o($VS1,[2,103]),o($VS1,[2,104]),o($VS1,[2,390]),{13:$V9,16:$Va,44:215,45:$Vf1,48:[1,455],55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,200:456,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vb2,[2,424]),o($Vc2,[2,136]),o($Vc2,[2,137]),o($Vd2,[2,140]),{232:[1,457]},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,195:458,197:$VR1,307:43,308:$Vc},o($V_1,[2,219]),o($V_1,[2,220]),o($V_1,[2,221]),o($V_1,[2,222]),o($V_1,[2,223]),o($VN1,[2,10]),o($Vq1,[2,46]),o($Vq1,[2,314]),{112:$Vm1,122:459},o($Vq1,[2,62]),o($Vp,$Vn1,{133:242,108:460,112:$Vo1,132:$Vp1}),o($VV1,[2,61]),o($Vq1,[2,49]),o([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},o($VW1,[2,351],{146:463,335:[1,464]}),{29:$Vb1,57:465},o($Vt1,[2,329]),o($Vp,[2,332],{129:466,327:[1,467]}),o($Vt1,[2,55]),o($Vt1,[2,331]),{48:[1,468]},o($Vv1,[2,429]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vw1,[2,431]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,243:470,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vw1,[2,156]),{45:$VC1,89:$VD1,179:471},o($Vx1,[2,441]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,251:472,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vy1,[2,444],{256:473}),o($Vy1,[2,446],{258:474}),o($VX1,[2,442]),o($VX1,[2,443]),o($Vy1,[2,449]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,255:154,257:155,259:475,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,450]),o($VX1,[2,451]),o($VX1,[2,379],{178:476}),o($VX1,[2,378]),o([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:$V9,16:$Va,44:136,45:$Vx,46:482,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{48:[1,483]},{48:[1,484]},o($VB1,[2,187]),o($VE1,[2,194]),{13:$V9,16:$Va,44:39,55:40,82:$Vy,87:$Vb,139:289,172:291,255:154,257:155,266:290,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,320:485},{13:$V9,16:$Va,39:[1,487],44:136,45:$Vx,46:488,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,282:486,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($V$1,[2,460]),{13:$V9,16:$Va,44:136,45:$Vx,46:489,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,464]),{13:$V9,16:$Va,44:136,45:$Vx,46:490,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,466]),o($V61,[2,40]),o($VH1,[2,298]),o($Ve2,[2,87]),o($Ve2,[2,88]),o($Ve2,[2,89]),o($Ve2,[2,90]),{13:$V9,16:$Va,55:492,82:$Vy,172:493,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,311:494,312:$Vk1,315:491},o($V61,[2,41]),o($VI1,[2,300]),o($Vf2,[2,303],{92:495}),{13:$V9,16:$Va,31:[1,496],55:414,82:$Vy,171:497,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,498],89:[1,499]},{29:[1,500]},o($VJ1,[2,372]),{13:$V9,16:$Va,48:[2,422],55:194,197:$V71,223:312,226:502,228:501,229:$VM1,307:43,308:$Vc},o($VL1,[2,131]),o($VL1,[2,126]),o($V32,[2,22]),o($V32,[2,290]),{82:[1,503]},{82:[1,504]},{13:$V9,16:$Va,44:510,45:$Vx,55:323,67:321,68:322,74:505,75:506,76:$Vg2,77:320,78:$Vh2,79:509,87:$Vb,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($V42,[2,294]),o($Vi2,[2,69]),o($Vi2,[2,70]),o($V81,$V91,{59:197,69:198,20:511,70:$Va1}),o($Vc1,$Vd1,{58:205,62:206,23:512,63:$Ve1}),{29:[2,375],31:[2,71],84:522,85:$V5,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},o($V62,[2,363],{157:524,335:[1,525]}),o($V6,$V3,{215:10,202:526,205:527,208:528,214:529,44:530,87:$Vb}),o($Vj2,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,87:$Vb}),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,212:534,231:$V82,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($V6,$V3,{215:10,205:527,208:528,214:529,44:530,202:537,87:$Vb}),o($Vc1,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:$V9,16:$Va,45:$V92,87:$Vb,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($Vk2,[2,291]),o($Vk2,[2,24]),o($Vk2,[2,25]),{13:$V9,16:$Va,44:136,45:$Vx,46:539,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vk2,[2,28]),o($Vc1,$Vd1,{58:205,62:206,23:540,63:$Ve1}),o([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),o($Va2,[2,107]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,199:543,200:544,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl2,[2,132]),o($Vb2,[2,425]),o($Vl2,[2,133]),{13:$V9,16:$Va,44:354,55:355,82:$Vy,87:$Vb,172:357,237:356,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:358,312:$Vk1,313:545},o($Vq1,[2,54]),o($Vq1,[2,48]),o($VW1,[2,342]),{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:546,307:43,308:$Vc},o($VW1,[2,68]),o($Vk,[2,350],{31:$Vm2,112:$Vm2}),o($Vq1,[2,53]),{13:$V9,16:$Va,55:547,307:43,308:$Vc},o($Vp,[2,333]),o($Vw,[2,16]),o($Vv1,[2,152]),o($Vw1,[2,154]),o($Vw1,[2,157]),o($Vx1,[2,159]),o($Vx1,[2,160],{262:389,261:548,39:$VY1,338:$VZ1}),o($Vx1,[2,161],{262:389,261:549,39:$VY1,338:$VZ1}),o($Vy1,[2,163]),{13:$V9,16:$Va,44:136,45:$Vx,46:550,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,178]),o($VB1,[2,179]),{13:$V9,16:$Va,44:136,45:$Vx,46:551,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:552,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:553,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{48:[1,554],272:[1,555]},o($VB1,[2,184]),o($VB1,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:$V9,16:$Va,55:194,197:$V71,223:562,307:43,308:$Vc},o($Vn2,[2,224]),o($Vn2,[2,225]),o($Vn2,[2,226]),{31:[1,563],45:$Vo2,94:564},o($V61,[2,84]),o($VH1,[2,368]),o($V61,[2,85]),o($VI1,[2,370]),o($Vf2,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},o($V32,[2,35],{83:[1,569]}),o($V32,[2,36],{81:[1,570]}),o($VO1,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:$V9,16:$Va,45:$Vx,76:$Vg2,78:$Vh2,87:$Vb,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($Vp2,[2,295]),{45:$Vx,77:572},{45:$Vx,77:573},o($Vp2,[2,33]),o($Vp2,[2,34]),{31:[2,275],50:574,84:575,85:$V5},{31:[2,277],51:576,84:577,85:$V5},o($V62,[2,356]),o($Vq2,[2,357],{152:578,335:[1,579]}),o($Vr2,[2,74]),{29:$Vb1,57:580},{29:$Vb1,57:581},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:582,307:43,308:$Vc},o($Vs2,[2,365],{162:583,328:[1,584]}),{13:$V9,16:$Va,45:$Vx,55:323,67:321,68:322,77:320,79:585,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{45:[1,586]},o($Vr2,[2,81]),{29:$Vb1,57:587},o($V62,[2,73]),o($Vk,[2,362],{29:$Vt2,31:$Vt2,85:$Vt2,112:$Vt2,159:$Vt2,160:$Vt2,161:$Vt2,163:$Vt2,164:$Vt2}),o($Vj2,[2,112]),o($Vu2,[2,401],{206:588}),o($Vk,[2,405],{209:589,210:590}),o($Vk,[2,403]),o($Vk,[2,404]),o($Vj2,[2,113]),o($Vj2,[2,400]),{13:$V9,16:$Va,44:215,45:$V72,48:[1,591],55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,212:592,231:$V82,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vb2,[2,426]),o($Vd2,[2,138]),o($Vd2,[2,139]),{232:[1,593]},o($Vk2,[2,292]),{47:[1,595],48:[1,594]},o($VN1,[2,9]),o($Va2,[2,392]),o($Va2,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:$V9,16:$Va,87:$Vb,197:$VR1,308:$Vc}),o($Va2,[2,110],{272:[1,598]}),o($Vv2,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},o($Vt1,[2,58]),o($Vy1,[2,445]),o($Vy1,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},o($VB1,[2,99]),o($VX1,[2,382]),o([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),o($VB1,[2,188]),o($VB1,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:$V9,16:$Va,55:492,82:$Vy,172:493,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,311:494,312:$Vk1,315:611},o($V61,[2,42]),o($Vf2,[2,304]),{13:$V9,16:$Va,55:414,82:$Vy,95:612,171:613,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,614],45:$Vo2,94:615},o($VL1,[2,129]),o($V22,[2,421]),{82:[1,616]},{82:[1,617]},o($Vp2,[2,296]),o($Vp2,[2,31]),o($Vp2,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},o($Vk,$VP1,{155:330,153:618,154:619,29:$Vw2,31:$Vw2,85:$Vw2,112:$Vw2,159:$Vw2,160:$Vw2,161:$Vw2,163:$Vw2,164:$Vw2}),o($Vq2,[2,358]),o($Vr2,[2,75]),o($Vr2,[2,76]),{29:$Vb1,57:620},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:621,307:43,308:$Vc},o($Vs2,[2,366]),o($Vr2,[2,79]),{13:$V9,16:$Va,44:136,45:$Vx,46:622,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vr2,[2,91],{336:[1,623]}),o([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),o($Vu2,[2,117]),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,211:626,212:627,231:$V82,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($VT1,[2,134]),o($Vb2,[2,427]),o($VT1,[2,135]),o($Vk2,[2,26]),{44:628,87:$Vb},o($Va2,[2,106]),o($Va2,[2,394]),o($Vk,[2,396]),o($Vv2,[2,111]),o($Vv2,[2,398]),{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:629,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VU1,[2,217]),o($Vk,$Vr1,{144:248,140:630,143:631,31:[2,343]}),o($VB1,[2,97]),o($VX1,[2,380]),o($VB1,[2,180]),{13:$V9,16:$Va,44:136,45:$Vx,46:632,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:633,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,190]),{290:[1,634]},{314:[1,635]},{13:$V9,16:$Va,48:[1,636],55:414,82:$Vy,171:637,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},o($Vx2,[2,305]),o($V61,[2,86]),o($Vf2,[2,374]),o($V32,[2,37]),o($V32,[2,38]),o($V62,[2,72]),o($V62,[2,360]),o($Vr2,[2,77]),{29:$Vb1,57:638},{47:[1,639]},{29:[2,376]},o($Vu2,[2,402]),o($Vu2,[2,115],{215:10,208:528,214:529,44:530,205:640,13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,87:$Vb}),o($Vu2,[2,118],{272:[1,641]}),o($Vy2,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:$VX,304:$VY,305:$VZ,306:$V_},o($Ve2,[2,218]),o($Vf2,[2,44]),o($Vx2,[2,306]),o($Vr2,[2,78]),{44:651,87:$Vb},o($Vu2,[2,116]),o($Vk,[2,406]),o($Vy2,[2,119]),o($Vy2,[2,408]),o($V6,$V3,{215:10,205:527,208:528,214:529,44:530,202:652,87:$Vb}),o($Vk2,[2,27]),o($Vv2,[2,230]),o($Vz2,[2,345],{141:653,335:[1,654]}),o($VB1,[2,181]),o($VB1,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},o($Vk,$Vr1,{144:248,142:657,143:658,31:$VA2,112:$VA2}),o($Vz2,[2,346]),o($Vr2,[2,80]),o($Vy2,[2,231]),o($VW1,[2,67]),o($VW1,[2,348])], - defaultActions: {5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]}, - parseError: function parseError (str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - var error = new Error(str); - error.hash = hash; - throw error; - } - }, - parse: function parse(input) { - var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; - } - } - lexer.setInput(input, sharedState.yy); - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { - lexer.yylloc = {}; - } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - _token_stack: - var lex = function () { - var token; - token = lexer.lex() || EOF; - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - }; - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); - } - this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected - }); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - sharedState.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } } - return true; - }}; - - /* - SPARQL parser in the Jison parser generator format. - */ - - var Wildcard = (__webpack_require__(21465)/* .Wildcard */ .R); - - // Common namespaces and entities - var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - RDF_TYPE = RDF + 'type', - RDF_FIRST = RDF + 'first', - RDF_REST = RDF + 'rest', - RDF_NIL = RDF + 'nil', - XSD = 'http://www.w3.org/2001/XMLSchema#', - XSD_INTEGER = XSD + 'integer', - XSD_DECIMAL = XSD + 'decimal', - XSD_DOUBLE = XSD + 'double', - XSD_BOOLEAN = XSD + 'boolean'; - - var base = '', basePath = '', baseRoot = ''; - - // Returns a lowercase version of the given string - function lowercase(string) { - return string.toLowerCase(); - } - - // Appends the item to the array and returns the array - function appendTo(array, item) { - return array.push(item), array; - } - - // Appends the items to the array and returns the array - function appendAllTo(array, items) { - return array.push.apply(array, items), array; - } - - // Extends a base object with properties of other objects - function extend(base) { - if (!base) base = {}; - for (var i = 1, l = arguments.length, arg; i < l && (arg = arguments[i] || {}); i++) - for (var name in arg) - base[name] = arg[name]; - return base; - } - - // Creates an array that contains all items of the given arrays - function unionAll() { - var union = []; - for (var i = 0, l = arguments.length; i < l; i++) - union = union.concat.apply(union, arguments[i]); - return union; - } - - // Resolves an IRI against a base path - function resolveIRI(iri) { - // Strip off possible angular brackets - if (iri[0] === '<') - iri = iri.substring(1, iri.length - 1); - // Return absolute IRIs unmodified - if (/^[a-z]+:/i.test(iri)) - return iri; - if (!Parser.base) - throw new Error('Cannot resolve relative IRI ' + iri + ' because no base IRI was set.'); - if (base !== Parser.base) { - base = Parser.base; - basePath = base.replace(/[^\/:]*$/, ''); - baseRoot = base.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]; - } - switch (iri[0]) { - // An empty relative IRI indicates the base IRI - case undefined: - return base; - // Resolve relative fragment IRIs against the base IRI - case '#': - return base + iri; - // Resolve relative query string IRIs by replacing the query string - case '?': - return base.replace(/(?:\?.*)?$/, iri); - // Resolve root relative IRIs at the root of the base IRI - case '/': - return baseRoot + iri; - // Resolve all other IRIs at the base IRI's path - default: - return basePath + iri; - } - } - - // If the item is a variable, ensures it starts with a question mark - function toVar(variable) { - if (variable) { - var first = variable[0]; - if (first === '?' || first === '$') return Parser.factory.variable(variable.substr(1)); - } - return variable; - } - - // Creates an operation with the given name and arguments - function operation(operatorName, args) { - return { type: 'operation', operator: operatorName, args: args || [] }; - } - - // Creates an expression with the given type and attributes - function expression(expr, attr) { - var expression = { expression: expr === '*'? new Wildcard() : expr }; - if (attr) - for (var a in attr) - expression[a] = attr[a]; - return expression; - } - - // Creates a path with the given type and items - function path(type, items) { - return { type: 'path', pathType: type, items: items }; - } - - // Transforms a list of operations types and arguments into a tree of operations - function createOperationTree(initialExpression, operationList) { - for (var i = 0, l = operationList.length, item; i < l && (item = operationList[i]); i++) - initialExpression = operation(item[0], [initialExpression, item[1]]); - return initialExpression; - } - - // Group datasets by default and named - function groupDatasets(fromClauses, groupName) { - var defaults = [], named = [], l = fromClauses.length, fromClause, group = {}; - if (!l) - return null; - for (var i = 0; i < l && (fromClause = fromClauses[i]); i++) - (fromClause.named ? named : defaults).push(fromClause.iri); - group[groupName || 'from'] = { default: defaults, named: named }; - return group; - } - - // Converts the string to a number - function toInt(string) { - return parseInt(string, 10); - } - - // Transforms a possibly single group into its patterns - function degroupSingle(group) { - return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group; - } - - // Creates a literal with the given value and type - function createTypedLiteral(value, type) { - if (type && type.termType !== 'NamedNode'){ - type = Parser.factory.namedNode(type); - } - return Parser.factory.literal(value, type); - } - - // Creates a literal with the given value and language - function createLangLiteral(value, lang) { - return Parser.factory.literal(value, lang); - } - - function nestedTriple(subject, predicate, object) { - - // TODO: Remove this when it is caught by the grammar - if (!('termType' in predicate)) { - throw new Error('Nested triples cannot contain paths'); - } - - return Parser.factory.quad(subject, predicate, object); - } - - // Creates a triple with the given subject, predicate, and object - function triple(subject, predicate, object, annotations) { - var triple = {}; - if (subject != null) triple.subject = subject; - if (predicate != null) triple.predicate = predicate; - if (object != null) triple.object = object; - if (annotations != null) triple.annotations = annotations; - return triple; - } - - // Creates a new blank node - function blank(name) { - if (typeof name === 'string') { // Only use name if a name is given - if (name.startsWith('e_')) return Parser.factory.blankNode(name); - return Parser.factory.blankNode('e_' + name); - } - return Parser.factory.blankNode('g_' + blankId++); - }; - var blankId = 0; - Parser._resetBlanks = function () { blankId = 0; } - - // Regular expression and replacement strings to escape strings - var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g, - escapeReplacements = { '\\': '\\', "'": "'", '"': '"', - 't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' }, - partialSurrogatesWithoutEndpoint = /[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/, - fromCharCode = String.fromCharCode; - - // Translates escape codes in the string into their textual equivalent - function unescapeString(string, trimLength) { - string = string.substring(trimLength, string.length - trimLength); - try { - string = string.replace(escapeSequence, function (sequence, unicode4, unicode8, escapedChar) { - var charCode; - if (unicode4) { - charCode = parseInt(unicode4, 16); - if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance - return fromCharCode(charCode); - } - else if (unicode8) { - charCode = parseInt(unicode8, 16); - if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance - if (charCode < 0xFFFF) return fromCharCode(charCode); - return fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF)); - } - else { - var replacement = escapeReplacements[escapedChar]; - if (!replacement) throw new Error(); - return replacement; - } - }); + // Check if id of each AS-selected column is not yet bound by subquery + const subqueries = $$[$0-1].where.filter(w => w.type === "query"); + if (subqueries.length > 0) { + const selectedVarIds = $$[$0-3].variables.filter(v => v.variable && v.variable.value).map(v => v.variable.value); + const subqueryIds = flatten(subqueries.map(sub => sub.variables)).map(v => v.value || v.variable.value); + for (const selectedVarId of selectedVarIds) { + if (subqueryIds.indexOf(selectedVarId) >= 0) { + throw Error("Target id of 'AS' (?" + selectedVarId + ") already used in subquery"); + } + } + } + this.$ = extend($$[$0-3], groupDatasets($$[$0-2]), $$[$0-1], $$[$0]) + +break; +case 8: +this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 9: +this.$ = extend({ queryType: 'CONSTRUCT', template: $$[$0-2] = ($$[$0-2] ? $$[$0-2].triples : []) }, groupDatasets($$[$0-5]), { where: [ { type: 'bgp', triples: appendAllTo([], $$[$0-2]) } ] }, $$[$0]); +break; +case 10: +this.$ = extend({ queryType: 'DESCRIBE', variables: $$[$0-3] === '*' ? [new Wildcard()] : $$[$0-3] }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 11: +this.$ = extend({ queryType: 'ASK' }, groupDatasets($$[$0-2]), $$[$0-1], $$[$0]); +break; +case 12: +this.$ = extend($$[$0-1], {variables: [new Wildcard()]}); +break; +case 13: + + // Check if id of each selected column is different + const selectedVarIds = $$[$0].map(v => v.value || v.variable.value); + const duplicates = getDuplicatesInArray(selectedVarIds); + if (duplicates.length > 0) { + throw Error("Two or more of the resulting columns have the same name (?" + duplicates[0] + ")"); } - catch (error) { return ''; } - - // Test for invalid unicode surrogate pairs - if (partialSurrogatesWithoutEndpoint.exec(string)) { - throw new Error('Invalid unicode codepoint of surrogate pair without corresponding codepoint in ' + string); - } - - return string; - } - - // Creates a list, collecting its (possibly blank) items and triples associated with those items - function createList(objects) { - var list = blank(), head = list, listItems = [], listTriples, triples = []; - objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); }); - - // Build an RDF list out of the items - for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) - listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]), - listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)); - - // Return the list's identifier, its triples, and the triples associated with its items - return { entity: list, triples: appendAllTo(listTriples, triples) }; - } - - // Creates a blank node identifier, collecting triples with that blank node as subject - function createAnonymousObject(propertyList) { - var entity = blank(); - return { - entity: entity, - triples: propertyList.map(function (t) { return extend(triple(entity), t); }) - }; - } - - // Collects all (possibly blank) objects, and triples that have them as subject - function objectListToTriples(predicate, objectList, otherTriples) { - var objects = [], triples = []; - objectList.forEach(function (l) { - let annotation = null; - if (l.annotation) { - annotation = l.annotation - l = l.object; - } - objects.push(triple(null, predicate, l.entity, annotation)); - appendAllTo(triples, l.triples); + + this.$ = extend($$[$0-1], { variables: $$[$0] }) + +break; +case 14: +this.$ = extend({ queryType: 'SELECT'}, $$[$0] && ($$[$0-1] = lowercase($$[$0]), $$[$0] = {}, $$[$0][$$[$0-1]] = true, $$[$0])); +break; +case 16: case 27: +this.$ = expression($$[$0-3], { variable: $$[$0-1] }); +break; +case 17: case 18: +this.$ = extend($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], { type: 'query' }); +break; +case 19: case 58: +this.$ = { iri: $$[$0], named: !!$$[$0-1] }; +break; +case 20: +this.$ = { where: $$[$0].patterns }; +break; +case 21: +this.$ = extend($$[$0-1], $$[$0]); +break; +case 22: +this.$ = extend($$[$0-2], $$[$0-1], $$[$0]); +break; +case 23: +this.$ = { group: $$[$0] }; +break; +case 24: case 25: case 28: case 31: case 33: case 34: +this.$ = expression($$[$0]); +break; +case 26: +this.$ = expression($$[$0-1]); +break; +case 29: +this.$ = { having: $$[$0] }; +break; +case 30: +this.$ = { order: $$[$0] }; +break; +case 32: +this.$ = expression($$[$0], { descending: true }); +break; +case 35: +this.$ = { limit: toInt($$[$0]) }; +break; +case 36: +this.$ = { offset: toInt($$[$0]) }; +break; +case 37: +this.$ = { limit: toInt($$[$0-2]), offset: toInt($$[$0]) }; +break; +case 38: +this.$ = { limit: toInt($$[$0]), offset: toInt($$[$0-2]) }; +break; +case 39: case 43: +this.$ = { type: 'values', values: $$[$0] }; +break; +case 40: case 84: +this.$ = $$[$0-1].map(v => ({ [$$[$0-3]]: v })); +break; +case 41: case 85: +this.$ = $$[$0-1].map(() => ({})); +break; +case 42: case 86: + + var length = $$[$0-4].length; + $$[$0-4] = $$[$0-4].map(toVar); + this.$ = $$[$0-1].map(function (values) { + if (values.length !== length) + throw Error('Inconsistent VALUES length'); + var valuesObject = {}; + for(var i = 0; i el.type === "bind")) { + const index = $$[$0-1].indexOf(binding); + const boundVars = new Set(); + //Collect all bounded variables before the binding + for (const el of $$[$0-1].slice(0, index)) { + if (el.type === "group" || el.type === "bgp") { + getBoundVarsFromGroupGraphPattern(el).forEach(boundVar => boundVars.add(boundVar)); + } + } + // If binding with a non-free variable, throw error + if (boundVars.has(binding.variable.value)) { + throw Error("Variable used to bind is already bound (?" + binding.variable.value + ")"); + } + } + this.$ = { type: 'group', patterns: $$[$0-1] } + +break; +case 71: +this.$ = $$[$0-1] ? unionAll([$$[$0-1]], $$[$0]) : unionAll($$[$0]); +break; +case 72: +this.$ = $$[$0] ? [$$[$0-2], $$[$0]] : $$[$0-2]; +break; +case 75: +this.$ = extend($$[$0], { type: 'optional' }); +break; +case 76: +this.$ = extend($$[$0], { type: 'minus' }); +break; +case 77: +this.$ = extend($$[$0], { type: 'graph', name: $$[$0-1] }); +break; +case 78: +this.$ = extend($$[$0], { type: 'service', name: $$[$0-1], silent: !!$$[$0-2] }); +break; +case 79: +this.$ = { type: 'filter', expression: $$[$0] }; +break; +case 80: +this.$ = { type: 'bind', variable: $$[$0-1], expression: $$[$0-3] }; +break; +case 89: +this.$ = ensureSparqlStar($$[$0]); +break; +case 90: +this.$ = undefined; +break; +case 91: +this.$ = $$[$0-1].length ? { type: 'union', patterns: unionAll($$[$0-1].map(degroupSingle), [degroupSingle($$[$0])]) } : $$[$0]; +break; +case 95: +this.$ = { ...$$[$0], function: $$[$0-1] }; +break; +case 96: +this.$ = { type: 'functionCall', args: [] }; +break; +case 97: +this.$ = { type: 'functionCall', args: appendTo($$[$0-2], $$[$0-1]), distinct: !!$$[$0-3] }; +break; +case 98: case 115: case 128: case 247: case 249: case 251: case 253: case 255: case 263: case 267: case 297: case 299: case 303: case 307: case 328: case 341: case 349: case 355: case 361: case 367: case 369: case 373: case 375: case 379: case 381: case 385: case 391: case 395: case 401: case 405: case 409: case 411: case 420: case 428: case 430: case 440: case 444: case 446: case 448: +this.$ = []; +break; +case 99: +this.$ = appendTo($$[$0-2], $$[$0-1]); +break; +case 101: +this.$ = unionAll($$[$0-2], [$$[$0-1]]); +break; +case 102: case 112: +this.$ = applyAnnotations($$[$0].map(t => extend(triple($$[$0-1]), t))); +break; +case 103: +this.$ = applyAnnotations(appendAllTo($$[$0].map(t => extend(triple($$[$0-1].entity), t)), $$[$0-1].triples)) /* the subject is a blank node, possibly with more triples */; +break; +case 105: +this.$ = unionAll([$$[$0-1]], $$[$0]); +break; +case 106: +this.$ = unionAll($$[$0]); +break; +case 107: +this.$ = objectListToTriples($$[$0-1], $$[$0]); +break; +case 109: case 237: +this.$ = Parser.factory.namedNode(RDF_TYPE); +break; +case 110: case 118: +this.$ = appendTo($$[$0-1], $$[$0]); +break; +case 111: +this.$ = $$[$0] ? { annotation: $$[$0], object: $$[$0-1] } : $$[$0-1]; +break; +case 113: +this.$ = !$$[$0] ? $$[$0-1].triples : applyAnnotations(appendAllTo($$[$0].map(t => extend(triple($$[$0-1].entity), t)), $$[$0-1].triples)) /* the subject is a blank node, possibly with more triples */; +break; +case 114: +this.$ = objectListToTriples(...$$[$0-1], $$[$0]); +break; +case 116: +this.$ = objectListToTriples(...$$[$0]); +break; +case 117: case 159: case 163: +this.$ = [$$[$0-1], $$[$0]]; +break; +case 119: +this.$ = $$[$0] ? { object: $$[$0-1], annotation: $$[$0] } : $$[$0-1];; +break; +case 120: +this.$ = $$[$0-1].length ? path('|',appendTo($$[$0-1], $$[$0])) : $$[$0]; +break; +case 121: +this.$ = $$[$0-1].length ? path('/', appendTo($$[$0-1], $$[$0])) : $$[$0]; +break; +case 122: +this.$ = $$[$0] ? path($$[$0], [$$[$0-1]]) : $$[$0-1]; +break; +case 123: +this.$ = $$[$0-1] ? path($$[$0-1], [$$[$0]]) : $$[$0];; +break; +case 125: case 131: +this.$ = path($$[$0-1], [$$[$0]]); +break; +case 129: +this.$ = path('|', appendTo($$[$0-2], $$[$0-1])); +break; +case 132: case 134: +this.$ = createList($$[$0-1]); +break; +case 133: case 135: +this.$ = createAnonymousObject($$[$0-1]); +break; +case 140: +this.$ = { entity: $$[$0], triples: [] }; +break; +case 145: +this.$ = toVar($$[$0]); +break; +case 149: +this.$ = Parser.factory.namedNode(RDF_NIL); +break; +case 151: case 153: case 158: case 162: +this.$ = createOperationTree($$[$0-1], $$[$0]); +break; +case 152: +this.$ = ['||', $$[$0]]; +break; +case 154: +this.$ = ['&&', $$[$0]]; +break; +case 156: +this.$ = operation($$[$0-1], [$$[$0-2], $$[$0]]); +break; +case 157: +this.$ = operation($$[$0-2] ? 'notin' : 'in', [$$[$0-3], $$[$0]]); +break; +case 160: +this.$ = ['+', createOperationTree($$[$0-1], $$[$0])]; +break; +case 161: + + var negatedLiteral = createTypedLiteral($$[$0-1].value.replace('-', ''), $$[$0-1].datatype); + this.$ = ['-', createOperationTree(negatedLiteral, $$[$0])]; + +break; +case 164: +this.$ = operation('UPLUS', [$$[$0]]); +break; +case 165: +this.$ = operation($$[$0-1], [$$[$0]]); +break; +case 166: +this.$ = operation('UMINUS', [$$[$0]]); +break; +case 177: +this.$ = operation(lowercase($$[$0-1])); +break; +case 178: +this.$ = operation(lowercase($$[$0-3]), [$$[$0-1]]); +break; +case 179: +this.$ = ensureSparqlStar(operation(lowercase($$[$0-3]), [$$[$0-1]])); +break; +case 180: +this.$ = operation(lowercase($$[$0-5]), [$$[$0-3], $$[$0-1]]); +break; +case 181: +this.$ = operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]]); +break; +case 182: +this.$ = ensureSparqlStar(operation(lowercase($$[$0-7]), [$$[$0-5], $$[$0-3], $$[$0-1]])); +break; +case 183: +this.$ = operation(lowercase($$[$0-1]), $$[$0]); +break; +case 184: +this.$ = operation('bound', [toVar($$[$0-1])]); +break; +case 185: +this.$ = operation($$[$0-1], []); +break; +case 186: +this.$ = operation($$[$0-3], [$$[$0-1]]); +break; +case 187: +this.$ = operation($$[$0-2] ? 'notexists' :'exists', [degroupSingle($$[$0])]); +break; +case 188: case 189: +this.$ = expression($$[$0-1], { type: 'aggregate', aggregation: lowercase($$[$0-4]), distinct: !!$$[$0-2] }); +break; +case 190: +this.$ = expression($$[$0-2], { type: 'aggregate', aggregation: lowercase($$[$0-5]), distinct: !!$$[$0-3], separator: typeof $$[$0-1] === 'string' ? $$[$0-1] : ' ' }); +break; +case 192: +this.$ = createTypedLiteral($$[$0]); +break; +case 193: +this.$ = createLangLiteral($$[$0-1], lowercase($$[$0].substr(1))); +break; +case 194: +this.$ = createTypedLiteral($$[$0-2], $$[$0]); +break; +case 195: case 204: +this.$ = createTypedLiteral($$[$0], XSD_INTEGER); +break; +case 196: case 205: +this.$ = createTypedLiteral($$[$0], XSD_DECIMAL); +break; +case 197: case 206: +this.$ = createTypedLiteral(lowercase($$[$0]), XSD_DOUBLE); +break; +case 200: +this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_BOOLEAN); +break; +case 201: +this.$ = createTypedLiteral($$[$0].substr(1), XSD_INTEGER); +break; +case 202: +this.$ = createTypedLiteral($$[$0].substr(1), XSD_DECIMAL); +break; +case 203: +this.$ = createTypedLiteral($$[$0].substr(1).toLowerCase(), XSD_DOUBLE); +break; +case 207: case 208: +this.$ = unescapeString($$[$0], 1); +break; +case 209: case 210: +this.$ = unescapeString($$[$0], 3); +break; +case 211: +this.$ = Parser.factory.namedNode(resolveIRI($$[$0])); +break; +case 213: + + var namePos = $$[$0].indexOf(':'), + prefix = $$[$0].substr(0, namePos), + expansion = Parser.prefixes[prefix]; + if (!expansion) throw new Error('Unknown prefix: ' + prefix); + var uriString = resolveIRI(expansion + $$[$0].substr(namePos + 1)); + this.$ = Parser.factory.namedNode(uriString); + +break; +case 214: + + $$[$0] = $$[$0].substr(0, $$[$0].length - 1); + if (!($$[$0] in Parser.prefixes)) throw new Error('Unknown prefix: ' + $$[$0]); + var uriString = resolveIRI(Parser.prefixes[$$[$0]]); + this.$ = Parser.factory.namedNode(uriString); + +break; +case 215: +this.$ = blank($$[$0].replace(/^(_:)/,''));; +break; +case 216: +this.$ = blank(); +break; +case 217: case 218: case 232: +this.$ = ensureSparqlStar(nestedTriple($$[$0-3], $$[$0-2], $$[$0-1])); +break; +case 230: case 231: +this.$ = ensureSparqlStar($$[$0-1]); +break; +case 248: case 250: case 252: case 254: case 256: case 260: case 264: case 268: case 270: case 292: case 294: case 296: case 298: case 300: case 302: case 304: case 306: case 329: case 342: case 356: case 368: case 370: case 372: case 374: case 392: case 402: case 425: case 427: case 429: case 431: case 441: case 445: case 447: case 449: +$$[$0-1].push($$[$0]); +break; +case 259: case 269: case 291: case 293: case 295: case 301: case 305: case 371: case 424: case 426: +this.$ = [$$[$0]]; +break; +case 308: +$$[$0-3].push($$[$0-2]); +break; +case 350: case 362: case 376: case 380: case 382: case 386: case 396: case 406: case 410: case 412: case 421: +$$[$0-2].push($$[$0-1]); +break; +} +}, +table: [o($V0,$V1,{3:1,4:2,10:3}),{1:[3]},o($V2,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,24:[1,13],32:[1,14],36:[1,15],41:$V4}),o([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:$V5},{6:[2,239]},o($V6,[2,411],{216:28,217:29}),o($V7,[2,249],{18:30}),o($V7,[2,251],{22:31}),o($V8,[2,255],{25:32,27:33,29:[1,34]}),{13:$V9,16:$Va,33:35,39:[1,37],44:39,55:40,87:$Vb,139:38,307:43,308:$Vc,323:36},o($V7,[2,267],{37:46}),o($Vd,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:$Ve,87:$Vb},o($Vf,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),o($V0,[2,248]),o($V0,[2,245]),o($V0,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},o([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),o($Vg,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:$Vh,29:$Vi,52:84,53:$Vj,56:85},{19:88,28:$Vh,29:$Vi,52:89,53:$Vj,56:85},o($V7,[2,253],{26:90}),{28:[1,91],52:92,53:$Vj},o($Vk,[2,385],{181:93,182:94,183:95,31:[2,383]}),o($Vl,[2,263],{34:96}),o($Vl,[2,261],{44:39,55:40,307:43,139:97,13:$V9,16:$Va,87:$Vb,308:$Vc}),o($Vl,[2,262]),o($Vm,[2,259]),o($Vn,[2,143]),o($Vn,[2,144]),o([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),o($Vo,[2,211]),o($Vo,[2,212]),o($Vo,[2,213]),o($Vo,[2,214]),{19:98,28:$Vh,29:$Vi,52:99,53:$Vj,56:85},{6:[2,309],99:100,193:[1,101]},o($Vp,[2,311],{101:102,328:[1,103]}),o($Vq,[2,317],{104:104,328:[1,105]}),o($Vr,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:$Vs,114:110},{29:$Vs,114:112},{29:$Vs,114:113},{118:114,123:[1,115],125:116,126:$Vt},o($Vu,[2,315]),o($Vu,[2,316]),o($Vv,[2,319]),o($Vv,[2,320]),o($Vv,[2,321]),o($Vd,[2,327]),{13:$V9,16:$Va,55:118,307:43,308:$Vc},o($V7,[2,12]),o($V7,[2,13],{44:66,43:119,45:$Ve,87:$Vb}),o($Vw,[2,269]),o($Vw,[2,15]),{13:$V9,16:$Va,44:136,45:$Vx,46:120,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vf,[2,14]),o($Vf,[2,274]),o($Vf,[2,271]),o($Vf,[2,272]),o($V0,[2,4]),{13:[1,177]},o($V61,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},o($V6,[2,410]),o([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:$V9,16:$Va,45:[1,193],55:194,197:$V71,219:189,220:190,223:191,224:[1,192],307:43,308:$Vc},o($Vg,[2,419]),o($V81,$V91,{20:196,59:197,69:198,70:$Va1}),o($V7,[2,250]),{29:$Vb1,57:200},o($Vp,[2,279],{54:202,327:[1,203]}),{29:[2,282]},o($Vc1,$Vd1,{23:204,58:205,62:206,63:$Ve1}),o($V7,[2,252]),{19:208,28:$Vh,29:$Vi,52:209,53:$Vj,56:85},{29:[1,210]},o($V8,[2,256]),{31:[1,211]},{31:[2,384]},{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,145:212,172:221,185:213,187:214,231:$Vh1,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl1,[2,265],{56:85,35:227,52:228,19:229,28:$Vh,29:$Vi,53:$Vj}),o($Vm,[2,260]),o($Vc1,$Vd1,{58:205,62:206,23:230,63:$Ve1}),o($V7,[2,268]),{6:[2,45]},o($V0,$V1,{10:3,4:231}),{13:$V9,16:$Va,55:232,307:43,308:$Vc},o($Vp,[2,312]),{105:233,112:$Vm1,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},o($Vq,[2,318]),o($Vp,$Vn1,{108:240,133:242,112:$Vo1,132:$Vp1}),o($Vr,[2,323]),{112:[1,244]},{112:[2,325]},o($Vq1,[2,50]),o($Vk,$Vr1,{135:245,136:246,143:247,144:248,31:$Vs1,112:$Vs1}),o($Vq1,[2,51]),o($Vq1,[2,52]),o($Vt1,[2,328],{119:249}),{29:$Vs,114:250},o($Vt1,[2,56]),{29:$Vs,114:251},o($Vd,[2,59]),o($Vw,[2,270]),{47:[1,252]},o($Vu1,[2,150]),o($Vv1,[2,428],{240:253}),o($Vw1,[2,430],{244:254}),o($Vw1,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),o($Vx1,[2,440],{252:264}),o($Vy1,[2,448],{260:265}),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:266,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:267,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,255:154,257:155,264:268,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vy1,[2,167]),o($Vy1,[2,168]),o($Vy1,[2,169]),o($Vy1,[2,170],{176:269,45:$Vz1,89:$VA1}),o($Vy1,[2,171]),o($Vy1,[2,172]),o($Vy1,[2,173]),o($Vy1,[2,174]),{13:$V9,16:$Va,44:136,45:$Vx,46:272,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:$VC1,89:$VD1,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},o($VE1,[2,192],{292:[1,286],293:[1,287]}),o($VE1,[2,195]),o($VE1,[2,196]),o($VE1,[2,197]),o($VE1,[2,198]),o($VE1,[2,199]),o($VE1,[2,200]),{13:$V9,16:$Va,44:39,55:40,82:$Vy,87:$Vb,139:289,172:291,255:154,257:155,266:290,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},o($VF1,[2,452]),o($VF1,[2,453]),o($VF1,[2,454]),o($VF1,[2,455]),o($VF1,[2,456]),{279:[2,458]},o($VG1,[2,207]),o($VG1,[2,208]),o($VG1,[2,209]),o($VG1,[2,210]),o($VE1,[2,201]),o($VE1,[2,202]),o($VE1,[2,203]),o($VE1,[2,204]),o($VE1,[2,205]),o($VE1,[2,206]),o($V0,[2,5]),o($VH1,[2,297],{88:295}),o($VI1,[2,299],{90:296}),{48:[1,297],87:[1,298]},o($VJ1,[2,301]),o($V61,[2,43]),o($V61,[2,82]),o($V61,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},o($V6,[2,412]),o($VK1,[2,123]),o($VK1,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),o($VL1,[2,124]),{13:$V9,16:$Va,45:[1,311],55:194,89:[1,310],197:$V71,223:312,225:308,226:309,229:$VM1,307:43,308:$Vc},o($V6,$V3,{215:10,214:314}),o($VL1,[2,236]),o($VL1,[2,237]),o($VN1,[2,6]),o($VO1,[2,287],{60:315,72:316,73:[1,317]}),o($V81,[2,286]),{13:$V9,16:$Va,45:$Vx,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o([6,31,63,70,73,81,83,85],[2,20]),o($Vk,$VP1,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:$VQ1,31:$VQ1,85:$VQ1,112:$VQ1,159:$VQ1,160:$VQ1,161:$VQ1,163:$VQ1,164:$VQ1,41:$V4}),{13:$V9,16:$Va,55:331,307:43,308:$Vc},o($Vp,[2,280]),o($VN1,[2,7]),o($V81,$V91,{59:197,69:198,20:332,70:$Va1}),o($Vc1,[2,284]),{64:[1,333]},o($Vc1,$Vd1,{58:205,62:206,23:334,63:$Ve1}),o($V7,[2,254]),o($Vk,$Vr1,{144:248,30:335,143:336,31:[2,257]}),o($V7,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:339,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VS1,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:$V9,16:$Va,87:$Vb,197:$VR1,308:$Vc}),o($VT1,[2,227]),o($VT1,[2,228]),o($VT1,[2,229]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,200:348,230:347,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:352,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VT1,[2,146]),o($VT1,[2,147]),o($VT1,[2,148]),o($VT1,[2,149]),{13:$V9,16:$Va,44:354,55:355,82:$Vy,87:$Vb,172:357,237:356,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:358,312:$Vk1,313:353},o($VU1,[2,215]),o($VU1,[2,216]),o($Vc1,$Vd1,{58:205,62:206,23:359,63:$Ve1}),o($Vl,[2,264]),o($Vl1,[2,266]),o($VN1,[2,11]),o($V2,[2,308],{6:[2,310]}),o($Vq1,[2,313],{102:360,120:361,121:[1,362]}),o($Vq1,[2,47]),o($Vq1,[2,63]),o($Vq1,[2,64]),{13:$V9,16:$Va,55:363,307:43,308:$Vc},o($Vq1,[2,336]),o($Vq1,[2,337]),o($Vq1,[2,338]),{109:[1,364]},o($VV1,[2,60]),{13:$V9,16:$Va,55:365,307:43,308:$Vc},o($Vp,[2,335]),{13:$V9,16:$Va,55:366,307:43,308:$Vc},{31:[1,367]},o($VW1,[2,341],{137:368}),o($VW1,[2,340]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,145:369,172:221,185:213,187:214,231:$Vh1,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},{28:[1,370],127:371,128:[1,372]},o($Vt1,[2,330],{124:373,125:374,126:$Vt}),o($Vt1,[2,57]),{44:375,87:$Vb},o($Vu1,[2,151],{241:376,242:[1,377]}),o($Vv1,[2,153],{245:378,246:[1,379]}),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,247:380,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{250:[1,381]},o($VX1,[2,432]),o($VX1,[2,433]),o($VX1,[2,434]),o($VX1,[2,435]),o($VX1,[2,436]),o($VX1,[2,437]),{250:[2,439]},o([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW}),o($Vx1,[2,162],{261:388,262:389,39:$VY1,338:$VZ1}),o($Vy1,[2,164]),o($Vy1,[2,165]),o($Vy1,[2,166]),o($VB1,[2,95]),o($VB1,[2,96]),o($VX1,[2,377],{177:392,325:[1,393]}),{48:[1,394]},o($VB1,[2,177]),{13:$V9,16:$Va,44:136,45:$Vx,46:395,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:396,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:397,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:398,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:399,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,183]),o($VB1,[2,98]),o($VX1,[2,381],{180:400}),{87:[1,401]},o($VB1,[2,185]),{13:$V9,16:$Va,44:136,45:$Vx,46:402,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{29:$Vb1,57:403},o($VE1,[2,193]),{13:$V9,16:$Va,55:404,307:43,308:$Vc},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,195:405,197:$VR1,307:43,308:$Vc},o($V_1,[2,233]),o($V_1,[2,234]),o($V_1,[2,235]),o($V$1,[2,459],{281:406,325:[1,407]}),o($VX1,[2,463],{284:408,325:[1,409]}),o($VX1,[2,465],{286:410,325:[1,411]}),{13:$V9,16:$Va,31:[1,412],55:414,82:$Vy,171:413,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,419],89:[1,420]},{29:[1,421]},o($VJ1,[2,302]),o($VH1,[2,367],{167:422}),o($VI1,[2,369],{168:423}),{48:[1,424],87:[1,425]},o($VJ1,[2,371]),o($VK1,[2,122]),o($VK1,[2,417]),o($VK1,[2,413]),o($VK1,[2,414]),o($VK1,[2,415]),o($VL1,[2,125]),o($VL1,[2,127]),o($VL1,[2,128]),o($V22,[2,420],{227:426}),o($VL1,[2,130]),{13:$V9,16:$Va,55:194,197:$V71,223:427,307:43,308:$Vc},{48:[1,428]},o($V32,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),o($VO1,[2,288]),{64:[1,433]},o($V81,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:$V9,16:$Va,45:$Vx,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($V42,[2,293]),o($V52,[2,92]),o($V52,[2,93]),o($V52,[2,94]),{45:$Vz1,89:$VA1,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:$Vh,29:$Vi,56:85},{19:438,28:$Vh,29:$Vi,56:85},o($V62,[2,355],{149:439}),o($V62,[2,354]),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,156:440,172:221,185:441,203:442,231:$V82,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl,[2,19]),o($V32,[2,21]),{13:$V9,16:$Va,44:450,45:$V92,55:323,65:445,66:446,67:447,68:448,87:$Vb,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VN1,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},o($Vk,[2,386],{31:[2,388]}),o($VS1,[2,102]),o($Va2,[2,391],{191:452}),o($Vk,[2,395],{196:453,198:454}),o($Vk,[2,108]),o($Vk,[2,109]),o($VS1,[2,103]),o($VS1,[2,104]),o($VS1,[2,390]),{13:$V9,16:$Va,44:215,45:$Vf1,48:[1,455],55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,200:456,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vb2,[2,424]),o($Vc2,[2,136]),o($Vc2,[2,137]),o($Vd2,[2,140]),{232:[1,457]},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,195:458,197:$VR1,307:43,308:$Vc},o($V_1,[2,219]),o($V_1,[2,220]),o($V_1,[2,221]),o($V_1,[2,222]),o($V_1,[2,223]),o($VN1,[2,10]),o($Vq1,[2,46]),o($Vq1,[2,314]),{112:$Vm1,122:459},o($Vq1,[2,62]),o($Vp,$Vn1,{133:242,108:460,112:$Vo1,132:$Vp1}),o($VV1,[2,61]),o($Vq1,[2,49]),o([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},o($VW1,[2,351],{146:463,335:[1,464]}),{29:$Vb1,57:465},o($Vt1,[2,329]),o($Vp,[2,332],{129:466,327:[1,467]}),o($Vt1,[2,55]),o($Vt1,[2,331]),{48:[1,468]},o($Vv1,[2,429]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vw1,[2,431]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,243:470,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vw1,[2,156]),{45:$VC1,89:$VD1,179:471},o($Vx1,[2,441]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,251:472,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vy1,[2,444],{256:473}),o($Vy1,[2,446],{258:474}),o($VX1,[2,442]),o($VX1,[2,443]),o($Vy1,[2,449]),{13:$V9,16:$Va,44:136,45:$Vx,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,255:154,257:155,259:475,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,450]),o($VX1,[2,451]),o($VX1,[2,379],{178:476}),o($VX1,[2,378]),o([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:$V9,16:$Va,44:136,45:$Vx,46:482,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{48:[1,483]},{48:[1,484]},o($VB1,[2,187]),o($VE1,[2,194]),{13:$V9,16:$Va,44:39,55:40,82:$Vy,87:$Vb,139:289,172:291,255:154,257:155,266:290,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,320:485},{13:$V9,16:$Va,39:[1,487],44:136,45:$Vx,46:488,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,282:486,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($V$1,[2,460]),{13:$V9,16:$Va,44:136,45:$Vx,46:489,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,464]),{13:$V9,16:$Va,44:136,45:$Vx,46:490,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VX1,[2,466]),o($V61,[2,40]),o($VH1,[2,298]),o($Ve2,[2,87]),o($Ve2,[2,88]),o($Ve2,[2,89]),o($Ve2,[2,90]),{13:$V9,16:$Va,55:492,82:$Vy,172:493,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,311:494,312:$Vk1,315:491},o($V61,[2,41]),o($VI1,[2,300]),o($Vf2,[2,303],{92:495}),{13:$V9,16:$Va,31:[1,496],55:414,82:$Vy,171:497,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,498],89:[1,499]},{29:[1,500]},o($VJ1,[2,372]),{13:$V9,16:$Va,48:[2,422],55:194,197:$V71,223:312,226:502,228:501,229:$VM1,307:43,308:$Vc},o($VL1,[2,131]),o($VL1,[2,126]),o($V32,[2,22]),o($V32,[2,290]),{82:[1,503]},{82:[1,504]},{13:$V9,16:$Va,44:510,45:$Vx,55:323,67:321,68:322,74:505,75:506,76:$Vg2,77:320,78:$Vh2,79:509,87:$Vb,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($V42,[2,294]),o($Vi2,[2,69]),o($Vi2,[2,70]),o($V81,$V91,{59:197,69:198,20:511,70:$Va1}),o($Vc1,$Vd1,{58:205,62:206,23:512,63:$Ve1}),{29:[2,375],31:[2,71],84:522,85:$V5,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},o($V62,[2,363],{157:524,335:[1,525]}),o($V6,$V3,{215:10,202:526,205:527,208:528,214:529,44:530,87:$Vb}),o($Vj2,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,87:$Vb}),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,212:534,231:$V82,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($V6,$V3,{215:10,205:527,208:528,214:529,44:530,202:537,87:$Vb}),o($Vc1,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:$V9,16:$Va,45:$V92,87:$Vb,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($Vk2,[2,291]),o($Vk2,[2,24]),o($Vk2,[2,25]),{13:$V9,16:$Va,44:136,45:$Vx,46:539,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vk2,[2,28]),o($Vc1,$Vd1,{58:205,62:206,23:540,63:$Ve1}),o([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),o($Va2,[2,107]),{13:$V9,16:$Va,44:215,45:$Vf1,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,187:350,199:543,200:544,231:$Vh1,234:349,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vl2,[2,132]),o($Vb2,[2,425]),o($Vl2,[2,133]),{13:$V9,16:$Va,44:354,55:355,82:$Vy,87:$Vb,172:357,237:356,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:358,312:$Vk1,313:545},o($Vq1,[2,54]),o($Vq1,[2,48]),o($VW1,[2,342]),{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:546,307:43,308:$Vc},o($VW1,[2,68]),o($Vk,[2,350],{31:$Vm2,112:$Vm2}),o($Vq1,[2,53]),{13:$V9,16:$Va,55:547,307:43,308:$Vc},o($Vp,[2,333]),o($Vw,[2,16]),o($Vv1,[2,152]),o($Vw1,[2,154]),o($Vw1,[2,157]),o($Vx1,[2,159]),o($Vx1,[2,160],{262:389,261:548,39:$VY1,338:$VZ1}),o($Vx1,[2,161],{262:389,261:549,39:$VY1,338:$VZ1}),o($Vy1,[2,163]),{13:$V9,16:$Va,44:136,45:$Vx,46:550,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,178]),o($VB1,[2,179]),{13:$V9,16:$Va,44:136,45:$Vx,46:551,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:552,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:553,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{48:[1,554],272:[1,555]},o($VB1,[2,184]),o($VB1,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:$V9,16:$Va,55:194,197:$V71,223:562,307:43,308:$Vc},o($Vn2,[2,224]),o($Vn2,[2,225]),o($Vn2,[2,226]),{31:[1,563],45:$Vo2,94:564},o($V61,[2,84]),o($VH1,[2,368]),o($V61,[2,85]),o($VI1,[2,370]),o($Vf2,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},o($V32,[2,35],{83:[1,569]}),o($V32,[2,36],{81:[1,570]}),o($VO1,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:$V9,16:$Va,45:$Vx,76:$Vg2,78:$Vh2,87:$Vb,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,276:$VI,277:$VJ,279:$VK,280:$VL,283:$VM,285:$VN,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51}),o($Vp2,[2,295]),{45:$Vx,77:572},{45:$Vx,77:573},o($Vp2,[2,33]),o($Vp2,[2,34]),{31:[2,275],50:574,84:575,85:$V5},{31:[2,277],51:576,84:577,85:$V5},o($V62,[2,356]),o($Vq2,[2,357],{152:578,335:[1,579]}),o($Vr2,[2,74]),{29:$Vb1,57:580},{29:$Vb1,57:581},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:582,307:43,308:$Vc},o($Vs2,[2,365],{162:583,328:[1,584]}),{13:$V9,16:$Va,45:$Vx,55:323,67:321,68:322,77:320,79:585,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,307:43,308:$Vc,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{45:[1,586]},o($Vr2,[2,81]),{29:$Vb1,57:587},o($V62,[2,73]),o($Vk,[2,362],{29:$Vt2,31:$Vt2,85:$Vt2,112:$Vt2,159:$Vt2,160:$Vt2,161:$Vt2,163:$Vt2,164:$Vt2}),o($Vj2,[2,112]),o($Vu2,[2,401],{206:588}),o($Vk,[2,405],{209:589,210:590}),o($Vk,[2,403]),o($Vk,[2,404]),o($Vj2,[2,113]),o($Vj2,[2,400]),{13:$V9,16:$Va,44:215,45:$V72,48:[1,591],55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,212:592,231:$V82,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($Vb2,[2,426]),o($Vd2,[2,138]),o($Vd2,[2,139]),{232:[1,593]},o($Vk2,[2,292]),{47:[1,595],48:[1,594]},o($VN1,[2,9]),o($Va2,[2,392]),o($Va2,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:$V9,16:$Va,87:$Vb,197:$VR1,308:$Vc}),o($Va2,[2,110],{272:[1,598]}),o($Vv2,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},o($Vt1,[2,58]),o($Vy1,[2,445]),o($Vy1,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},o($VB1,[2,99]),o($VX1,[2,382]),o([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),o($VB1,[2,188]),o($VB1,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:$V9,16:$Va,55:492,82:$Vy,172:493,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,311:494,312:$Vk1,315:611},o($V61,[2,42]),o($Vf2,[2,304]),{13:$V9,16:$Va,55:414,82:$Vy,95:612,171:613,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},{31:[1,614],45:$Vo2,94:615},o($VL1,[2,129]),o($V22,[2,421]),{82:[1,616]},{82:[1,617]},o($Vp2,[2,296]),o($Vp2,[2,31]),o($Vp2,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},o($Vk,$VP1,{155:330,153:618,154:619,29:$Vw2,31:$Vw2,85:$Vw2,112:$Vw2,159:$Vw2,160:$Vw2,161:$Vw2,163:$Vw2,164:$Vw2}),o($Vq2,[2,358]),o($Vr2,[2,75]),o($Vr2,[2,76]),{29:$Vb1,57:620},{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:621,307:43,308:$Vc},o($Vs2,[2,366]),o($Vr2,[2,79]),{13:$V9,16:$Va,44:136,45:$Vx,46:622,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($Vr2,[2,91],{336:[1,623]}),o([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),o($Vu2,[2,117]),{13:$V9,16:$Va,44:215,45:$V72,55:220,82:$Vy,87:$Vb,89:$Vg1,172:221,185:351,203:536,211:626,212:627,231:$V82,234:535,236:216,237:222,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,309:$Vi1,310:$Vj1,311:217,312:$Vk1},o($VT1,[2,134]),o($Vb2,[2,427]),o($VT1,[2,135]),o($Vk2,[2,26]),{44:628,87:$Vb},o($Va2,[2,106]),o($Va2,[2,394]),o($Vk,[2,396]),o($Vv2,[2,111]),o($Vv2,[2,398]),{13:$V9,16:$Va,44:39,55:40,87:$Vb,139:342,186:629,190:340,195:341,197:$VR1,307:43,308:$Vc},o($VU1,[2,217]),o($Vk,$Vr1,{144:248,140:630,143:631,31:[2,343]}),o($VB1,[2,97]),o($VX1,[2,380]),o($VB1,[2,180]),{13:$V9,16:$Va,44:136,45:$Vx,46:632,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},{13:$V9,16:$Va,44:136,45:$Vx,46:633,55:133,67:132,68:134,77:131,82:$Vy,87:$Vb,172:135,224:$Vz,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:$VA,264:130,265:$VB,266:137,267:139,268:$VC,269:$VD,270:$VE,271:$VF,273:$VG,274:$VH,275:146,276:$VI,277:$VJ,278:149,279:$VK,280:$VL,283:$VM,285:$VN,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V$,346:$V01,347:$V11,348:$V21,349:$V31,350:$V41,351:$V51},o($VB1,[2,190]),{290:[1,634]},{314:[1,635]},{13:$V9,16:$Va,48:[1,636],55:414,82:$Vy,171:637,172:415,173:416,174:$V02,255:154,257:155,291:150,294:$VO,295:$VP,296:$VQ,297:$VR,298:$VS,299:$VT,300:$VU,301:$VV,302:$VW,303:$VX,304:$VY,305:$VZ,306:$V_,307:43,308:$Vc,312:$V12},o($Vx2,[2,305]),o($V61,[2,86]),o($Vf2,[2,374]),o($V32,[2,37]),o($V32,[2,38]),o($V62,[2,72]),o($V62,[2,360]),o($Vr2,[2,77]),{29:$Vb1,57:638},{47:[1,639]},{29:[2,376]},o($Vu2,[2,402]),o($Vu2,[2,115],{215:10,208:528,214:529,44:530,205:640,13:$V3,16:$V3,45:$V3,197:$V3,224:$V3,229:$V3,308:$V3,87:$Vb}),o($Vu2,[2,118],{272:[1,641]}),o($Vy2,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:$VX,304:$VY,305:$VZ,306:$V_},o($Ve2,[2,218]),o($Vf2,[2,44]),o($Vx2,[2,306]),o($Vr2,[2,78]),{44:651,87:$Vb},o($Vu2,[2,116]),o($Vk,[2,406]),o($Vy2,[2,119]),o($Vy2,[2,408]),o($V6,$V3,{215:10,205:527,208:528,214:529,44:530,202:652,87:$Vb}),o($Vk2,[2,27]),o($Vv2,[2,230]),o($Vz2,[2,345],{141:653,335:[1,654]}),o($VB1,[2,181]),o($VB1,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},o($Vk,$Vr1,{144:248,142:657,143:658,31:$VA2,112:$VA2}),o($Vz2,[2,346]),o($Vr2,[2,80]),o($Vy2,[2,231]),o($VW1,[2,67]),o($VW1,[2,348])], +defaultActions: {5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]}, +parseError: function parseError (str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } +}, +parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + _token_stack: + var lex = function () { + var token; + token = lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + }; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; } break; - // All other groups break up a BGP - default: - // Only add the group if its pattern is non-empty - if (!group.patterns || group.patterns.length > 0) { - appendTo(merged, group); - currentBgp = null; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; } - } - return merged; } - - // Return the id of an expression - function getExpressionId(expression) { - return expression.variable ? expression.variable.value : expression.value || expression.expression.value; + return true; +}}; + + /* + SPARQL parser in the Jison parser generator format. + */ + + var Wildcard = (__webpack_require__(21465)/* .Wildcard */ .R); + + // Common namespaces and entities + var RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', + RDF_TYPE = RDF + 'type', + RDF_FIRST = RDF + 'first', + RDF_REST = RDF + 'rest', + RDF_NIL = RDF + 'nil', + XSD = 'http://www.w3.org/2001/XMLSchema#', + XSD_INTEGER = XSD + 'integer', + XSD_DECIMAL = XSD + 'decimal', + XSD_DOUBLE = XSD + 'double', + XSD_BOOLEAN = XSD + 'boolean'; + + var base = '', basePath = '', baseRoot = ''; + + // Returns a lowercase version of the given string + function lowercase(string) { + return string.toLowerCase(); + } + + // Appends the item to the array and returns the array + function appendTo(array, item) { + return array.push(item), array; + } + + // Appends the items to the array and returns the array + function appendAllTo(array, items) { + return array.push.apply(array, items), array; + } + + // Extends a base object with properties of other objects + function extend(base) { + if (!base) base = {}; + for (var i = 1, l = arguments.length, arg; i < l && (arg = arguments[i] || {}); i++) + for (var name in arg) + base[name] = arg[name]; + return base; + } + + // Creates an array that contains all items of the given arrays + function unionAll() { + var union = []; + for (var i = 0, l = arguments.length; i < l; i++) + union = union.concat.apply(union, arguments[i]); + return union; + } + + // Resolves an IRI against a base path + function resolveIRI(iri) { + // Strip off possible angular brackets + if (iri[0] === '<') + iri = iri.substring(1, iri.length - 1); + // Return absolute IRIs unmodified + if (/^[a-z]+:/i.test(iri)) + return iri; + if (!Parser.base) + throw new Error('Cannot resolve relative IRI ' + iri + ' because no base IRI was set.'); + if (base !== Parser.base) { + base = Parser.base; + basePath = base.replace(/[^\/:]*$/, ''); + baseRoot = base.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]; + } + switch (iri[0]) { + // An empty relative IRI indicates the base IRI + case undefined: + return base; + // Resolve relative fragment IRIs against the base IRI + case '#': + return base + iri; + // Resolve relative query string IRIs by replacing the query string + case '?': + return base.replace(/(?:\?.*)?$/, iri); + // Resolve root relative IRIs at the root of the base IRI + case '/': + return baseRoot + iri; + // Resolve all other IRIs at the base IRI's path + default: + return basePath + iri; + } + } + + // If the item is a variable, ensures it starts with a question mark + function toVar(variable) { + if (variable) { + var first = variable[0]; + if (first === '?' || first === '$') return Parser.factory.variable(variable.substr(1)); } - - // Get all "aggregate"'s from an expression - function getAggregatesOfExpression(expression) { - if (!expression) { - return []; - } - if (expression.type === 'aggregate') { - return [expression]; - } else if (expression.type === "operation") { - const aggregates = []; - for (const arg of expression.args) { - aggregates.push(...getAggregatesOfExpression(arg)); - } - return aggregates; - } - return []; + return variable; + } + + // Creates an operation with the given name and arguments + function operation(operatorName, args) { + return { type: 'operation', operator: operatorName, args: args || [] }; + } + + // Creates an expression with the given type and attributes + function expression(expr, attr) { + var expression = { expression: expr === '*'? new Wildcard() : expr }; + if (attr) + for (var a in attr) + expression[a] = attr[a]; + return expression; + } + + // Creates a path with the given type and items + function path(type, items) { + return { type: 'path', pathType: type, items: items }; + } + + // Transforms a list of operations types and arguments into a tree of operations + function createOperationTree(initialExpression, operationList) { + for (var i = 0, l = operationList.length, item; i < l && (item = operationList[i]); i++) + initialExpression = operation(item[0], [initialExpression, item[1]]); + return initialExpression; + } + + // Group datasets by default and named + function groupDatasets(fromClauses, groupName) { + var defaults = [], named = [], l = fromClauses.length, fromClause, group = {}; + if (!l) + return null; + for (var i = 0; i < l && (fromClause = fromClauses[i]); i++) + (fromClause.named ? named : defaults).push(fromClause.iri); + group[groupName || 'from'] = { default: defaults, named: named }; + return group; + } + + // Converts the string to a number + function toInt(string) { + return parseInt(string, 10); + } + + // Transforms a possibly single group into its patterns + function degroupSingle(group) { + return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group; + } + + // Creates a literal with the given value and type + function createTypedLiteral(value, type) { + if (type && type.termType !== 'NamedNode'){ + type = Parser.factory.namedNode(type); } - - // Get all variables used in an expression - function getVariablesFromExpression(expression) { - const variables = new Set(); - const visitExpression = function (expr) { - if (!expr) { return; } - if (expr.termType === "Variable") { - variables.add(expr); - } else if (expr.type === "operation") { - expr.args.forEach(visitExpression); - } - }; - visitExpression(expression); - return variables; - } - - // Helper function to flatten arrays - function flatten(input, depth = 1, stack = []) { - for (const item of input) { - if (depth > 0 && item instanceof Array) { - flatten(item, depth - 1, stack); - } else { - stack.push(item); - } - } - return stack; + return Parser.factory.literal(value, type); + } + + // Creates a literal with the given value and language + function createLangLiteral(value, lang) { + return Parser.factory.literal(value, lang); + } + + function nestedTriple(subject, predicate, object) { + + // TODO: Remove this when it is caught by the grammar + if (!('termType' in predicate)) { + throw new Error('Nested triples cannot contain paths'); } - - function isVariable(term) { - return term.termType === 'Variable'; + + return Parser.factory.quad(subject, predicate, object); + } + + // Creates a triple with the given subject, predicate, and object + function triple(subject, predicate, object, annotations) { + var triple = {}; + if (subject != null) triple.subject = subject; + if (predicate != null) triple.predicate = predicate; + if (object != null) triple.object = object; + if (annotations != null) triple.annotations = annotations; + return triple; + } + + // Creates a new blank node + function blank(name) { + if (typeof name === 'string') { // Only use name if a name is given + if (name.startsWith('e_')) return Parser.factory.blankNode(name); + return Parser.factory.blankNode('e_' + name); } - - function getBoundVarsFromGroupGraphPattern(pattern) { - if (pattern.triples) { - const boundVars = []; - for (const triple of pattern.triples) { - if (isVariable(triple.subject)) boundVars.push(triple.subject.value); - if (isVariable(triple.predicate)) boundVars.push(triple.predicate.value); - if (isVariable(triple.object)) boundVars.push(triple.object.value); + return Parser.factory.blankNode('g_' + blankId++); + }; + var blankId = 0; + Parser._resetBlanks = function () { blankId = 0; } + + // Regular expression and replacement strings to escape strings + var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g, + escapeReplacements = { '\\': '\\', "'": "'", '"': '"', + 't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' }, + partialSurrogatesWithoutEndpoint = /[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/, + fromCharCode = String.fromCharCode; + + // Translates escape codes in the string into their textual equivalent + function unescapeString(string, trimLength) { + string = string.substring(trimLength, string.length - trimLength); + try { + string = string.replace(escapeSequence, function (sequence, unicode4, unicode8, escapedChar) { + var charCode; + if (unicode4) { + charCode = parseInt(unicode4, 16); + if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance + return fromCharCode(charCode); + } + else if (unicode8) { + charCode = parseInt(unicode8, 16); + if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance + if (charCode < 0xFFFF) return fromCharCode(charCode); + return fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF)); } - return boundVars; - } else if (pattern.patterns) { - const boundVars = []; - for (const pat of pattern.patterns) { - boundVars.push(...getBoundVarsFromGroupGraphPattern(pat)); + else { + var replacement = escapeReplacements[escapedChar]; + if (!replacement) throw new Error(); + return replacement; } - return boundVars; + }); + } + catch (error) { return ''; } + + // Test for invalid unicode surrogate pairs + if (partialSurrogatesWithoutEndpoint.exec(string)) { + throw new Error('Invalid unicode codepoint of surrogate pair without corresponding codepoint in ' + string); + } + + return string; + } + + // Creates a list, collecting its (possibly blank) items and triples associated with those items + function createList(objects) { + var list = blank(), head = list, listItems = [], listTriples, triples = []; + objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); }); + + // Build an RDF list out of the items + for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]), + listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL)); + + // Return the list's identifier, its triples, and the triples associated with its items + return { entity: list, triples: appendAllTo(listTriples, triples) }; + } + + // Creates a blank node identifier, collecting triples with that blank node as subject + function createAnonymousObject(propertyList) { + var entity = blank(); + return { + entity: entity, + triples: propertyList.map(function (t) { return extend(triple(entity), t); }) + }; + } + + // Collects all (possibly blank) objects, and triples that have them as subject + function objectListToTriples(predicate, objectList, otherTriples) { + var objects = [], triples = []; + objectList.forEach(function (l) { + let annotation = null; + if (l.annotation) { + annotation = l.annotation + l = l.object; + } + objects.push(triple(null, predicate, l.entity, annotation)); + appendAllTo(triples, l.triples); + }); + return unionAll(objects, otherTriples || [], triples); + } + + // Simplifies groups by merging adjacent BGPs + function mergeAdjacentBGPs(groups) { + var merged = [], currentBgp; + for (var i = 0, group; group = groups[i]; i++) { + switch (group.type) { + // Add a BGP's triples to the current BGP + case 'bgp': + if (group.triples.length) { + if (!currentBgp) + appendTo(merged, currentBgp = group); + else + appendAllTo(currentBgp.triples, group.triples); + } + break; + // All other groups break up a BGP + default: + // Only add the group if its pattern is non-empty + if (!group.patterns || group.patterns.length > 0) { + appendTo(merged, group); + currentBgp = null; + } } + } + return merged; + } + + // Return the id of an expression + function getExpressionId(expression) { + return expression.variable ? expression.variable.value : expression.value || expression.expression.value; + } + + // Get all "aggregate"'s from an expression + function getAggregatesOfExpression(expression) { + if (!expression) { return []; } - - // Helper function to find duplicates in array - function getDuplicatesInArray(array) { - const sortedArray = array.slice().sort(); - const duplicates = []; - for (let i = 0; i < sortedArray.length - 1; i++) { - if (sortedArray[i + 1] == sortedArray[i]) { - duplicates.push(sortedArray[i]); - } + if (expression.type === 'aggregate') { + return [expression]; + } else if (expression.type === "operation") { + const aggregates = []; + for (const arg of expression.args) { + aggregates.push(...getAggregatesOfExpression(arg)); } - return duplicates; + return aggregates; } - - function ensureSparqlStar(value) { - if (!Parser.sparqlStar) { - throw new Error('SPARQL-star support is not enabled'); + return []; + } + + // Get all variables used in an expression + function getVariablesFromExpression(expression) { + const variables = new Set(); + const visitExpression = function (expr) { + if (!expr) { return; } + if (expr.termType === "Variable") { + variables.add(expr); + } else if (expr.type === "operation") { + expr.args.forEach(visitExpression); } - return value; + }; + visitExpression(expression); + return variables; + } + + // Helper function to flatten arrays + function flatten(input, depth = 1, stack = []) { + for (const item of input) { + if (depth > 0 && item instanceof Array) { + flatten(item, depth - 1, stack); + } else { + stack.push(item); + } } - - function _applyAnnotations(subject, annotations, arr) { - for (const annotation of annotations) { - const t = triple( - // If the annotation already has a subject then just push the - // annotation to the upper scope as it is a blank node introduced - // from a pattern like :s :p :o {| :p1 [ :p2 :o2; :p3 :o3 ] |} - 'subject' in annotation ? annotation.subject : subject, - annotation.predicate, - annotation.object - ) - - arr.push(t); - - if (annotation.annotations) { - _applyAnnotations(nestedTriple( - subject, - annotation.predicate, - annotation.object - ), annotation.annotations, arr) - } - } - } - - function applyAnnotations(triples) { - if (Parser.sparqlStar) { - const newTriples = []; - - triples.forEach(t => { - const s = triple(t.subject, t.predicate, t.object); - - newTriples.push(s); - - if (t.annotations) { - _applyAnnotations(nestedTriple(t.subject, t.predicate, t.object), t.annotations, newTriples); - } - }); - - return newTriples; + return stack; + } + + function isVariable(term) { + return term.termType === 'Variable'; + } + + function getBoundVarsFromGroupGraphPattern(pattern) { + if (pattern.triples) { + const boundVars = []; + for (const triple of pattern.triples) { + if (isVariable(triple.subject)) boundVars.push(triple.subject.value); + if (isVariable(triple.predicate)) boundVars.push(triple.predicate.value); + if (isVariable(triple.object)) boundVars.push(triple.object.value); + } + return boundVars; + } else if (pattern.patterns) { + const boundVars = []; + for (const pat of pattern.patterns) { + boundVars.push(...getBoundVarsFromGroupGraphPattern(pat)); + } + return boundVars; + } + return []; + } + + // Helper function to find duplicates in array + function getDuplicatesInArray(array) { + const sortedArray = array.slice().sort(); + const duplicates = []; + for (let i = 0; i < sortedArray.length - 1; i++) { + if (sortedArray[i + 1] == sortedArray[i]) { + duplicates.push(sortedArray[i]); } - return triples; } - - function ensureSparqlStarNestedQuads(value) { - if (!Parser.sparqlStarNestedQuads) { - throw new Error('Lenient SPARQL-star support with nested quads is not enabled'); + return duplicates; + } + + function ensureSparqlStar(value) { + if (!Parser.sparqlStar) { + throw new Error('SPARQL-star support is not enabled'); + } + return value; + } + + function _applyAnnotations(subject, annotations, arr) { + for (const annotation of annotations) { + const t = triple( + // If the annotation already has a subject then just push the + // annotation to the upper scope as it is a blank node introduced + // from a pattern like :s :p :o {| :p1 [ :p2 :o2; :p3 :o3 ] |} + 'subject' in annotation ? annotation.subject : subject, + annotation.predicate, + annotation.object + ) + + arr.push(t); + + if (annotation.annotations) { + _applyAnnotations(nestedTriple( + subject, + annotation.predicate, + annotation.object + ), annotation.annotations, arr) } - return value; } - - function ensureNoVariables(operations) { - for (const operation of operations) { - if (operation.type === 'graph' && operation.name.termType === 'Variable') { - throw new Error('Detected illegal variable in GRAPH'); + } + + function applyAnnotations(triples) { + if (Parser.sparqlStar) { + const newTriples = []; + + triples.forEach(t => { + const s = triple(t.subject, t.predicate, t.object); + + newTriples.push(s); + + if (t.annotations) { + _applyAnnotations(nestedTriple(t.subject, t.predicate, t.object), t.annotations, newTriples); } - if (operation.type === 'bgp' || operation.type === 'graph') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'Variable' || - triple.predicate.termType === 'Variable' || - triple.object.termType === 'Variable') { - throw new Error('Detected illegal variable in BGP'); - } + }); + + return newTriples; + } + return triples; + } + + function ensureSparqlStarNestedQuads(value) { + if (!Parser.sparqlStarNestedQuads) { + throw new Error('Lenient SPARQL-star support with nested quads is not enabled'); + } + return value; + } + + function ensureNoVariables(operations) { + for (const operation of operations) { + if (operation.type === 'graph' && operation.name.termType === 'Variable') { + throw new Error('Detected illegal variable in GRAPH'); + } + if (operation.type === 'bgp' || operation.type === 'graph') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'Variable' || + triple.predicate.termType === 'Variable' || + triple.object.termType === 'Variable') { + throw new Error('Detected illegal variable in BGP'); } } } - return operations; } - - function ensureNoBnodes(operations) { - for (const operation of operations) { - if (operation.type === 'bgp') { - for (const triple of operation.triples) { - if (triple.subject.termType === 'BlankNode' || - triple.predicate.termType === 'BlankNode' || - triple.object.termType === 'BlankNode') { - throw new Error('Detected illegal blank node in BGP'); - } + return operations; + } + + function ensureNoBnodes(operations) { + for (const operation of operations) { + if (operation.type === 'bgp') { + for (const triple of operation.triples) { + if (triple.subject.termType === 'BlankNode' || + triple.predicate.termType === 'BlankNode' || + triple.object.termType === 'BlankNode') { + throw new Error('Detected illegal blank node in BGP'); } } } - return operations; } - /* generated by jison-lex 0.3.4 */ - var lexer = (function(){ - var lexer = ({ - - EOF:1, - - parseError:function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - - // resets the lexer, sets new input - setInput:function (input, yy) { - this.yy = yy || this.yy || {}; - this._input = input; - this._more = this._backtrack = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0,0]; - } - this.offset = 0; - return this; - }, - - // consumes and returns one char from the input - input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - - // unshifts one char (or a string) into the input - unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, - - // When called from action, caches matched text and appends it on next action - more:function () { - this._more = true; - return this; - }, - - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - - } - return this; - }, - - // retain first n characters of the match - less:function (n) { - this.unput(this.match.slice(n)); - }, - - // displays already matched input, i.e. for error messages - pastInput:function () { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); - }, - - // displays upcoming input, i.e. for error messages - upcomingInput:function () { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); - } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); - }, - - // displays the character position where the lexing error occurred, i.e. for error messages - showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - - // test the lexed token: return FALSE when not a match, otherwise return token - test_match:function(match, indexed_rule) { - var token, - lines, - backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } - return false; - }, - - // return next match in input - next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", - token: null, - line: this.yylineno - }); - } - }, - - // return next match that has a token - lex:function lex () { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); - } - }, - - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - begin:function begin (condition) { - this.conditionStack.push(condition); - }, - - // pop the previously active lexer condition state off the condition stack - popState:function popState () { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - - // produce the lexer rule set which is active for the currently active lexer condition state - _currentRules:function _currentRules () { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState:function topState (n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - - // alias for begin(condition) - pushState:function pushState (condition) { - this.begin(condition); - }, - - // return the number of states currently on the stack - stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, - options: {"flex":true,"case-insensitive":true}, - performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - var YYSTATE=YY_START; - switch($avoiding_name_collisions) { - case 0:/* ignore */ - break; - case 1:return 12 - break; - case 2:return 15 - break; - case 3:return 41 - break; - case 4:return 325 - break; - case 5:return 326 - break; - case 6:return 45 - break; - case 7:return 47 - break; - case 8:return 48 - break; - case 9:return 39 - break; - case 10:return 24 - break; - case 11:return 28 - break; - case 12:return 29 - break; - case 13:return 31 - break; - case 14:return 32 - break; - case 15:return 36 - break; - case 16:return 53 - break; - case 17:return 327 - break; - case 18:return 63 - break; - case 19:return 64 - break; - case 20:return 70 - break; - case 21:return 73 - break; - case 22:return 76 - break; - case 23:return 78 - break; - case 24:return 81 - break; - case 25:return 83 - break; - case 26:return 85 - break; - case 27:return 193 - break; - case 28:return 100 - break; - case 29:return 328 - break; - case 30:return 121 - break; - case 31:return 329 - break; - case 32:return 330 - break; - case 33:return 110 - break; - case 34:return 331 - break; - case 35:return 109 - break; - case 36:return 332 - break; - case 37:return 333 - break; - case 38:return 113 - break; - case 39:return 115 - break; - case 40:return 116 - break; - case 41:return 131 - break; - case 42:return 123 - break; - case 43:return 126 - break; - case 44:return 128 - break; - case 45:return 132 - break; - case 46:return 112 - break; - case 47:return 334 - break; - case 48:return 335 - break; - case 49:return 159 - break; - case 50:return 161 - break; - case 51:return 164 - break; - case 52:return 174 - break; - case 53:return 160 - break; - case 54:return 336 - break; - case 55:return 163 - break; - case 56:return 312 - break; - case 57:return 314 - break; - case 58:return 317 - break; - case 59:return 318 - break; - case 60:return 272 - break; - case 61:return 197 - break; - case 62:return 337 - break; - case 63:return 338 - break; - case 64:return 229 - break; - case 65:return 340 - break; - case 66:return 263 - break; - case 67:return 224 - break; - case 68:return 231 - break; - case 69:return 232 - break; - case 70:return 242 - break; - case 71:return 246 - break; - case 72:return 290 - break; - case 73:return 341 - break; - case 74:return 342 - break; - case 75:return 343 - break; - case 76:return 344 - break; - case 77:return 345 - break; - case 78:return 250 - break; - case 79:return 346 - break; - case 80:return 265 - break; - case 81:return 276 - break; - case 82:return 277 - break; - case 83:return 268 - break; - case 84:return 269 - break; - case 85:return 270 - break; - case 86:return 271 - break; - case 87:return 347 - break; - case 88:return 348 - break; - case 89:return 273 - break; - case 90:return 274 - break; - case 91:return 350 - break; - case 92:return 349 - break; - case 93:return 351 - break; - case 94:return 279 - break; - case 95:return 280 - break; - case 96:return 283 - break; - case 97:return 285 - break; - case 98:return 289 - break; - case 99:return 293 - break; - case 100:return 296 - break; - case 101:return 13 - break; - case 102:return 16 - break; - case 103:return 308 - break; - case 104:return 309 - break; - case 105:return 87 - break; - case 106:return 292 - break; - case 107:return 82 - break; - case 108:return 294 - break; - case 109:return 295 - break; - case 110:return 297 - break; - case 111:return 298 - break; - case 112:return 299 - break; - case 113:return 300 - break; - case 114:return 301 - break; - case 115:return 302 - break; - case 116:return 'EXPONENT' - break; - case 117:return 303 - break; - case 118:return 304 - break; - case 119:return 305 - break; - case 120:return 306 - break; - case 121:return 89 - break; - case 122:return 310 - break; - case 123:return 6 - break; - case 124:return 'INVALID' - break; - case 125:console.log(yy_.yytext); - break; - } - }, - rules: [/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i], - conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,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,91,92,93,94,95,96,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,123,124,125],"inclusive":true}} - }); - return lexer; - })(); - parser.lexer = lexer; - function Parser () { - this.yy = {}; - } - Parser.prototype = parser;parser.Parser = Parser; - return new Parser; - })();module.exports=SparqlParser - - - /***/ }), - - /***/ 21465: - /***/ ((module) => { - - - // Wildcard constructor - class Wildcard { - constructor() { - return WILDCARD || this; - } - - equals(other) { - return other && (this.termType === other.termType); - } - } - - Object.defineProperty(Wildcard.prototype, 'value', { - enumerable: true, - value: '*', - }); - - Object.defineProperty(Wildcard.prototype, 'termType', { - enumerable: true, - value: 'Wildcard', - }); - - - // Wildcard singleton - var WILDCARD = new Wildcard(); - - module.exports.R = Wildcard; - - - /***/ }), - - /***/ 30334: - /***/ ((module, __unused_webpack_exports, __webpack_require__) => { - - var Parser = (__webpack_require__(23474).Parser); - var Generator = __webpack_require__(71674); - var Wildcard = (__webpack_require__(21465)/* .Wildcard */ .R); - var { DataFactory } = __webpack_require__(18628); - - module.exports = { - /** - * Creates a SPARQL parser with the given pre-defined prefixes and base IRI - * @param options { - * prefixes?: { [prefix: string]: string }, - * baseIRI?: string, - * factory?: import('rdf-js').DataFactory, - * sparqlStar?: boolean, - * skipValidation?: boolean, - * skipUngroupedVariableCheck?: boolean - * } - */ - Parser: function ({ prefixes, baseIRI, factory, sparqlStar, skipValidation, skipUngroupedVariableCheck, pathOnly } = {}) { - - // Create a copy of the prefixes - var prefixesCopy = {}; - for (var prefix in prefixes || {}) - prefixesCopy[prefix] = prefixes[prefix]; - - // Create a new parser with the given prefixes - // (Workaround for https://github.com/zaach/jison/issues/241) - var parser = new Parser(); - parser.parse = function () { - Parser.base = baseIRI || ''; - Parser.prefixes = Object.create(prefixesCopy); - Parser.factory = factory || new DataFactory(); - Parser.sparqlStar = Boolean(sparqlStar); - Parser.pathOnly = Boolean(pathOnly); - // We keep skipUngroupedVariableCheck for compatibility reasons. - Parser.skipValidation = Boolean(skipValidation) || Boolean(skipUngroupedVariableCheck) - return Parser.prototype.parse.apply(parser, arguments); - }; - parser._resetBlanks = Parser._resetBlanks; - return parser; - }, - Generator: Generator, - Wildcard: Wildcard, - }; - - - /***/ }), - - /***/ 3988: - /***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - "use strict"; - - var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", ({ value: true })); - exports.mergePrefixArray = exports.getPrefixed = exports.getPrefixInfoFromIri = exports.getPrefixInfoFromPrefixedValue = exports.getLocalNameInfo = void 0; - const lodash_1 = __webpack_require__(53059); - const url_parse_1 = __importDefault(__webpack_require__(1042)); - const getLastSlashIndex = (pathname, offset) => { - if (offset === undefined) - offset = pathname.length; - const i = pathname.lastIndexOf("/", offset); - if (i >= 0 && i === pathname.length - 1) { - if (offset < 0) - return i; - return getLastSlashIndex(pathname, offset - 1); - } - return i; - }; - function getLocalNameInfo(iri) { - const parsed = (0, url_parse_1.default)(iri); - if (parsed.pathname === "/" && !iri.includes(`${parsed.hostname}/`)) { - parsed.set("pathname", ""); - } - if (parsed.hash.length > 1) { - var hashContent = parsed.hash.substring(1); - parsed.set("hash", "#"); - return { - iri: parsed.toString(), - localName: hashContent, - }; - } - const i = getLastSlashIndex(parsed.pathname); - if (i >= 0) { - const localName = parsed.pathname.substring(i + 1) + parsed.query + parsed.hash; - if (localName && localName.length) { - parsed.set("pathname", parsed.pathname.substring(0, i + 1)); - parsed.set("query", ""); - parsed.set("hash", ""); - return { - iri: parsed.toString(), - localName: localName, - }; - } - } - return { iri: iri }; - } - exports.getLocalNameInfo = getLocalNameInfo; - function getPrefixInfoFromPrefixedValue(value, prefixes) { - for (const p of Array.isArray(prefixes) ? prefixes : Object.values(prefixes)) { - if (!p.prefixLabel) - continue; - if (value.lastIndexOf(p.prefixLabel + ":", 0) === 0) { - return { - prefixLabel: p.prefixLabel, - iri: p.iri, - localName: value.substring(p.prefixLabel.length + 1), - }; - } - } - return getLocalNameInfo(value); - } - exports.getPrefixInfoFromPrefixedValue = getPrefixInfoFromPrefixedValue; - function getPrefixInfoFromIri(value, prefixes) { - const matches = []; - for (const p of Array.isArray(prefixes) ? prefixes : Object.values(prefixes)) { - if (value.length >= p.iri.length && value.lastIndexOf(p.iri, 0) === 0) { - matches.push({ - prefixLabel: p.prefixLabel, - iri: p.iri, - localName: value.substring(p.iri.length), - }); - } - } - return matches.sort((a, b) => b.iri.length - a.iri.length)[0] || getLocalNameInfo(value); - } - exports.getPrefixInfoFromIri = getPrefixInfoFromIri; - function getPrefixed(value, prefixes) { - const info = getPrefixInfoFromIri(value, prefixes); - if (info && info.prefixLabel) - return `${info.prefixLabel}:${info.localName}`; - } - exports.getPrefixed = getPrefixed; - function mergePrefixArray(basePrefixes, secondPrefixes) { - return (0, lodash_1.uniqBy)((0, lodash_1.unionBy)(basePrefixes, secondPrefixes, (prefix) => prefix.iri), (prefix) => prefix.prefixLabel); - } - exports.mergePrefixArray = mergePrefixArray; - - - /***/ }), - - /***/ 16996: - /***/ ((__unused_webpack_module, exports) => { - - "use strict"; - - - /** - * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes. - * - * Works with anything that has a `length` property and index access properties, including NodeList. - * - * @template {unknown} T - * @param {Array | ({length:number, [number]: T})} list - * @param {function (item: T, index: number, list:Array | ({length:number, [number]: T})):boolean} predicate - * @param {Partial>?} ac `Array.prototype` by default, - * allows injecting a custom implementation in tests - * @returns {T | undefined} - * - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find - * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find - */ - function find(list, predicate, ac) { - if (ac === undefined) { - ac = Array.prototype; - } - if (list && typeof ac.find === 'function') { - return ac.find.call(list, predicate); - } - for (var i = 0; i < list.length; i++) { - if (Object.prototype.hasOwnProperty.call(list, i)) { - var item = list[i]; - if (predicate.call(undefined, item, i, list)) { - return item; - } - } - } - } - - /** - * "Shallow freezes" an object to render it immutable. - * Uses `Object.freeze` if available, - * otherwise the immutability is only in the type. - * - * Is used to create "enum like" objects. - * - * @template T - * @param {T} object the object to freeze - * @param {Pick = Object} oc `Object` by default, - * allows to inject custom object constructor for tests - * @returns {Readonly} - * - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze - */ - function freeze(object, oc) { - if (oc === undefined) { - oc = Object - } - return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object - } - - /** - * Since we can not rely on `Object.assign` we provide a simplified version - * that is sufficient for our needs. - * - * @param {Object} target - * @param {Object | null | undefined} source - * - * @returns {Object} target - * @throws TypeError if target is not an object - * - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign - */ - function assign(target, source) { - if (target === null || typeof target !== 'object') { - throw new TypeError('target is not an object') - } - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - return target - } - - /** - * All mime types that are allowed as input to `DOMParser.parseFromString` - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec - * @see DOMParser.prototype.parseFromString - */ - var MIME_TYPE = freeze({ - /** - * `text/html`, the only mime type that triggers treating an XML document as HTML. - * - * @see DOMParser.SupportedType.isHTML - * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration - * @see https://en.wikipedia.org/wiki/HTML Wikipedia - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec - */ - HTML: 'text/html', - - /** - * Helper method to check a mime type if it indicates an HTML document - * - * @param {string} [value] - * @returns {boolean} - * - * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration - * @see https://en.wikipedia.org/wiki/HTML Wikipedia - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */ - isHTML: function (value) { - return value === MIME_TYPE.HTML - }, - - /** - * `application/xml`, the standard mime type for XML documents. - * - * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration - * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303 - * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia - */ - XML_APPLICATION: 'application/xml', - - /** - * `text/html`, an alias for `application/xml`. - * - * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303 - * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration - * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia - */ - XML_TEXT: 'text/xml', - - /** - * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace, - * but is parsed as an XML document. - * - * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration - * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec - * @see https://en.wikipedia.org/wiki/XHTML Wikipedia - */ - XML_XHTML_APPLICATION: 'application/xhtml+xml', - - /** - * `image/svg+xml`, - * - * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration - * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1 - * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia - */ - XML_SVG_IMAGE: 'image/svg+xml', - }) - - /** - * Namespaces that are used in this code base. - * - * @see http://www.w3.org/TR/REC-xml-names - */ - var NAMESPACE = freeze({ - /** - * The XHTML namespace. - * - * @see http://www.w3.org/1999/xhtml - */ - HTML: 'http://www.w3.org/1999/xhtml', - - /** - * Checks if `uri` equals `NAMESPACE.HTML`. - * - * @param {string} [uri] - * - * @see NAMESPACE.HTML - */ - isHTML: function (uri) { - return uri === NAMESPACE.HTML - }, - - /** - * The SVG namespace. - * - * @see http://www.w3.org/2000/svg - */ - SVG: 'http://www.w3.org/2000/svg', - - /** - * The `xml:` namespace. - * - * @see http://www.w3.org/XML/1998/namespace - */ - XML: 'http://www.w3.org/XML/1998/namespace', - - /** - * The `xmlns:` namespace - * - * @see https://www.w3.org/2000/xmlns/ - */ - XMLNS: 'http://www.w3.org/2000/xmlns/', - }) - - exports.assign = assign; - exports.find = find; - exports.freeze = freeze; - exports.MIME_TYPE = MIME_TYPE; - exports.NAMESPACE = NAMESPACE; - - - /***/ }), - - /***/ 40654: - /***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - var __webpack_unused_export__; - /* provided dependency */ var console = __webpack_require__(80292); - var conventions = __webpack_require__(16996); - var dom = __webpack_require__(71855) - var entities = __webpack_require__(16714); - var sax = __webpack_require__(13418); - - var DOMImplementation = dom.DOMImplementation; - - var NAMESPACE = conventions.NAMESPACE; - - var ParseError = sax.ParseError; - var XMLReader = sax.XMLReader; - - /** - * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends: - * - * > XML parsed entities are often stored in computer files which, - * > for editing convenience, are organized into lines. - * > These lines are typically separated by some combination - * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA). - * > - * > To simplify the tasks of applications, the XML processor must behave - * > as if it normalized all line breaks in external parsed entities (including the document entity) - * > on input, before parsing, by translating all of the following to a single #xA character: - * > - * > 1. the two-character sequence #xD #xA - * > 2. the two-character sequence #xD #x85 - * > 3. the single character #x85 - * > 4. the single character #x2028 - * > 5. any #xD character that is not immediately followed by #xA or #x85. - * - * @param {string} input - * @returns {string} - */ - function normalizeLineEndings(input) { - return input - .replace(/\r[\n\u0085]/g, '\n') - .replace(/[\r\u0085\u2028]/g, '\n') - } - - /** - * @typedef Locator - * @property {number} [columnNumber] - * @property {number} [lineNumber] - */ - - /** - * @typedef DOMParserOptions - * @property {DOMHandler} [domBuilder] - * @property {Function} [errorHandler] - * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing - * defaults to `normalizeLineEndings` - * @property {Locator} [locator] - * @property {Record} [xmlns] - * - * @see normalizeLineEndings - */ - - /** - * The DOMParser interface provides the ability to parse XML or HTML source code - * from a string into a DOM `Document`. - * - * _xmldom is different from the spec in that it allows an `options` parameter, - * to override the default behavior._ - * - * @param {DOMParserOptions} [options] - * @constructor - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization - */ - function DOMParser(options){ - this.options = options ||{locator:{}}; - } - - DOMParser.prototype.parseFromString = function(source,mimeType){ - var options = this.options; - var sax = new XMLReader(); - var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler - var errorHandler = options.errorHandler; - var locator = options.locator; - var defaultNSMap = options.xmlns||{}; - var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1; - var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES; - if(locator){ - domBuilder.setDocumentLocator(locator) - } - - sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); - sax.domBuilder = options.domBuilder || domBuilder; - if(isHTML){ - defaultNSMap[''] = NAMESPACE.HTML; - } - defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML; - var normalize = options.normalizeLineEndings || normalizeLineEndings; - if (source && typeof source === 'string') { - sax.parse( - normalize(source), - defaultNSMap, - entityMap - ) - } else { - sax.errorHandler.error('invalid doc source') - } - return domBuilder.doc; - } - function buildErrorHandler(errorImpl,domBuilder,locator){ - if(!errorImpl){ - if(domBuilder instanceof DOMHandler){ - return domBuilder; - } - errorImpl = domBuilder ; - } - var errorHandler = {} - var isCallback = errorImpl instanceof Function; - locator = locator||{} - function build(key){ - var fn = errorImpl[key]; - if(!fn && isCallback){ - fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; - } - errorHandler[key] = fn && function(msg){ - fn('[xmldom '+key+']\t'+msg+_locator(locator)); - }||function(){}; - } - build('warning'); - build('error'); - build('fatalError'); - return errorHandler; - } - - //console.log('#\n\n\n\n\n\n\n####') - /** - * +ContentHandler+ErrorHandler - * +LexicalHandler+EntityResolver2 - * -DeclHandler-DTDHandler - * - * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler - * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 - * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html - */ - function DOMHandler() { - this.cdata = false; + return operations; } - function position(locator,node){ - node.lineNumber = locator.lineNumber; - node.columnNumber = locator.columnNumber; - } - /** - * @see org.xml.sax.ContentHandler#startDocument - * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html - */ - DOMHandler.prototype = { - startDocument : function() { - this.doc = new DOMImplementation().createDocument(null, null, null); - if (this.locator) { - this.doc.documentURI = this.locator.systemId; +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ +var lexer = ({ + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); } }, - startElement:function(namespaceURI, localName, qName, attrs) { - var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName||localName); - var len = attrs.length; - appendElement(this, el); - this.currentElement = el; - - this.locator && position(this.locator,el) - for (var i = 0 ; i < len; i++) { - var namespaceURI = attrs.getURI(i); - var value = attrs.getValue(i); - var qName = attrs.getQName(i); - var attr = doc.createAttributeNS(namespaceURI, qName); - this.locator &&position(attrs.getLocator(i),attr); - attr.value = attr.nodeValue = value; - el.setAttributeNode(attr) + +// resets the lexer, sets new input +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; } + this.offset = 0; + return this; }, - endElement:function(namespaceURI, localName, qName) { - var current = this.currentElement - var tagName = current.tagName; - this.currentElement = current.parentNode; - }, - startPrefixMapping:function(prefix, uri) { - }, - endPrefixMapping:function(prefix) { - }, - processingInstruction:function(target, data) { - var ins = this.doc.createProcessingInstruction(target, data); - this.locator && position(this.locator,ins) - appendElement(this, ins); - }, - ignorableWhitespace:function(ch, start, length) { - }, - characters:function(chars, start, length) { - chars = _toString.apply(this,arguments) - //console.log(chars) - if(chars){ - if (this.cdata) { - var charNode = this.doc.createCDATASection(chars); + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; } else { - var charNode = this.doc.createTextNode(chars); + this.yylloc.last_column++; } - if(this.currentElement){ - this.currentElement.appendChild(charNode); - }else if(/^\s*$/.test(chars)){ - this.doc.appendChild(charNode); - //process xml + if (this.options.ranges) { + this.yylloc.range[1]++; } - this.locator && position(this.locator,charNode) - } - }, - skippedEntity:function(name) { - }, - endDocument:function() { - this.doc.normalize(); + + this._input = this._input.slice(1); + return ch; }, - setDocumentLocator:function (locator) { - if(this.locator = locator){// && !('lineNumber' in locator)){ - locator.lineNumber = 0; + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; } - }, - //LexicalHandler - comment:function(chars, start, length) { - chars = _toString.apply(this,arguments) - var comm = this.doc.createComment(chars); - this.locator && position(this.locator,comm) - appendElement(this, comm); - }, - - startCDATA:function() { - //used in characters() methods - this.cdata = true; - }, - endCDATA:function() { - this.cdata = false; - }, - - startDTD:function(name, publicId, systemId) { - var impl = this.doc.implementation; - if (impl && impl.createDocumentType) { - var dt = impl.createDocumentType(name, publicId, systemId); - this.locator && position(this.locator,dt) - appendElement(this, dt); - this.doc.doctype = dt; + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } + this.yyleng = this.yytext.length; + return this; }, - /** - * @see org.xml.sax.ErrorHandler - * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html - */ - warning:function(error) { - console.warn('[xmldom warning]\t'+error,_locator(this.locator)); + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; }, - error:function(error) { - console.error('[xmldom error]\t'+error,_locator(this.locator)); + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + + } + return this; }, - fatalError:function(error) { - throw new ParseError(error, this.locator); - } - } - function _locator(l){ - if(l){ - return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' - } - } - function _toString(chars,start,length){ - if(typeof chars == 'string'){ - return chars.substr(start,length) - }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") - if(chars.length >= start+length || start){ - return new java.lang.String(chars,start,length)+''; - } - return chars; - } - } - - /* - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html - * used method of org.xml.sax.ext.LexicalHandler: - * #comment(chars, start, length) - * #startCDATA() - * #endCDATA() - * #startDTD(name, publicId, systemId) - * - * - * IGNORED method of org.xml.sax.ext.LexicalHandler: - * #endDTD() - * #startEntity(name) - * #endEntity(name) - * - * - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html - * IGNORED method of org.xml.sax.ext.DeclHandler - * #attributeDecl(eName, aName, type, mode, value) - * #elementDecl(name, model) - * #externalEntityDecl(name, publicId, systemId) - * #internalEntityDecl(name, value) - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html - * IGNORED method of org.xml.sax.EntityResolver2 - * #resolveEntity(String name,String publicId,String baseURI,String systemId) - * #resolveEntity(publicId, systemId) - * #getExternalSubset(name, baseURI) - * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html - * IGNORED method of org.xml.sax.DTDHandler - * #notationDecl(name, publicId, systemId) {}; - * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; - */ - "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ - DOMHandler.prototype[key] = function(){return null} - }) - - /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ - function appendElement (hander,node) { - if (!hander.currentElement) { - hander.doc.appendChild(node); - } else { - hander.currentElement.appendChild(node); - } - }//appendChild and setAttributeNS are preformance key - - __webpack_unused_export__ = DOMHandler; - __webpack_unused_export__ = normalizeLineEndings; - exports.DOMParser = DOMParser; - - - /***/ }), - - /***/ 71855: - /***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - /* provided dependency */ var console = __webpack_require__(80292); - var conventions = __webpack_require__(16996); - - var find = conventions.find; - var NAMESPACE = conventions.NAMESPACE; - - /** - * A prerequisite for `[].filter`, to drop elements that are empty - * @param {string} input - * @returns {boolean} - */ - function notEmptyString (input) { - return input !== '' - } - /** - * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace - * @see https://infra.spec.whatwg.org/#ascii-whitespace - * - * @param {string} input - * @returns {string[]} (can be empty) - */ - function splitOnASCIIWhitespace(input) { - // U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE - return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [] - } - - /** - * Adds element as a key to current if it is not already present. - * - * @param {Record} current - * @param {string} element - * @returns {Record} - */ - function orderedSetReducer (current, element) { - if (!current.hasOwnProperty(element)) { - current[element] = true; - } - return current; - } - - /** - * @see https://infra.spec.whatwg.org/#ordered-set - * @param {string} input - * @returns {string[]} - */ - function toOrderedSet(input) { - if (!input) return []; - var list = splitOnASCIIWhitespace(input); - return Object.keys(list.reduce(orderedSetReducer, {})) - } - - /** - * Uses `list.indexOf` to implement something like `Array.prototype.includes`, - * which we can not rely on being available. - * - * @param {any[]} list - * @returns {function(any): boolean} - */ - function arrayIncludes (list) { - return function(element) { - return list && list.indexOf(element) !== -1; - } - } - - function copy(src,dest){ - for(var p in src){ - if (Object.prototype.hasOwnProperty.call(src, p)) { - dest[p] = src[p]; - } - } - } - - /** - ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? - ^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? - */ - function _extends(Class,Super){ - var pt = Class.prototype; - if(!(pt instanceof Super)){ - function t(){}; - t.prototype = Super.prototype; - t = new t(); - copy(pt,t); - Class.prototype = pt = t; - } - if(pt.constructor != Class){ - if(typeof Class != 'function'){ - console.error("unknown Class:"+Class) - } - pt.constructor = Class - } - } - - // Node Types - var NodeType = {} - var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; - var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; - var TEXT_NODE = NodeType.TEXT_NODE = 3; - var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; - var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; - var ENTITY_NODE = NodeType.ENTITY_NODE = 6; - var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; - var COMMENT_NODE = NodeType.COMMENT_NODE = 8; - var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; - var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; - var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; - var NOTATION_NODE = NodeType.NOTATION_NODE = 12; - - // ExceptionCode - var ExceptionCode = {} - var ExceptionMessage = {}; - var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); - var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); - var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); - var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); - var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); - var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); - var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); - var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); - var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); - var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); - //level2 - var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); - var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); - var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); - var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); - var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); - - /** - * DOM Level 2 - * Object DOMException - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html - * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html - */ - function DOMException(code, message) { - if(message instanceof Error){ - var error = message; - }else{ - error = this; - Error.call(this, ExceptionMessage[code]); - this.message = ExceptionMessage[code]; - if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); - } - error.code = code; - if(message) this.message = this.message + ": " + message; - return error; - }; - DOMException.prototype = Error.prototype; - copy(ExceptionCode,DOMException) - - /** - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 - * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. - * The items in the NodeList are accessible via an integral index, starting from 0. - */ - function NodeList() { - }; - NodeList.prototype = { - /** - * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. - * @standard level1 - */ - length:0, - /** - * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. - * @standard level1 - * @param index unsigned long - * Index into the collection. - * @return Node - * The node at the indexth position in the NodeList, or null if that is not a valid index. - */ - item: function(index) { - return index >= 0 && index < this.length ? this[index] : null; + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); }, - toString:function(isHTML,nodeFilter){ - for(var buf = [], i = 0;i 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, - /** - * @private - * @param {function (Node):boolean} predicate - * @returns {Node[]} - */ - filter: function (predicate) { - return Array.prototype.filter.call(this, predicate); + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, - /** - * @private - * @param {Node} item - * @returns {number} - */ - indexOf: function (item) { - return Array.prototype.indexOf.call(this, item); + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; }, - }; - - function LiveNodeList(node,refresh){ - this._node = node; - this._refresh = refresh - _updateLiveList(this); - } - function _updateLiveList(list){ - var inc = list._node._inc || list._node.ownerDocument._inc; - if (list._inc !== inc) { - var ls = list._refresh(list._node); - __set__(list,'length',ls.length); - if (!list.$$length || ls.length < list.$$length) { - for (var i = ls.length; i in list; i++) { - if (Object.prototype.hasOwnProperty.call(list, i)) { - delete list[i]; - } + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function(match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } } - } - copy(ls,list); - list._inc = inc; - } - } - LiveNodeList.prototype.item = function(i){ - _updateLiveList(this); - return this[i] || null; - } - - _extends(LiveNodeList,NodeList); - - /** - * Objects implementing the NamedNodeMap interface are used - * to represent collections of nodes that can be accessed by name. - * Note that NamedNodeMap does not inherit from NodeList; - * NamedNodeMaps are not maintained in any particular order. - * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, - * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, - * and does not imply that the DOM specifies an order to these Nodes. - * NamedNodeMap objects in the DOM are live. - * used for attributes or DocumentType entities - */ - function NamedNodeMap() { - }; - - function _findNodeIndex(list,node){ - var i = list.length; - while(i--){ - if(list[i] === node){return i} - } - } - - function _addNamedNode(el,list,newAttr,oldAttr){ - if(oldAttr){ - list[_findNodeIndex(list,oldAttr)] = newAttr; - }else{ - list[list.length++] = newAttr; - } - if(el){ - newAttr.ownerElement = el; - var doc = el.ownerDocument; - if(doc){ - oldAttr && _onRemoveAttribute(doc,el,oldAttr); - _onAddAttribute(doc,el,newAttr); - } - } - } - function _removeNamedNode(el,list,attr){ - //console.log('remove attr:'+attr) - var i = _findNodeIndex(list,attr); - if(i>=0){ - var lastIndex = list.length-1 - while(i0 || key == 'xmlns'){ - // return null; - // } - //console.log() - var i = this.length; - while(i--){ - var attr = this[i]; - //console.log(attr.nodeName,key) - if(attr.nodeName == key){ - return attr; + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. } - } - }, - setNamedItem: function(attr) { - var el = attr.ownerElement; - if(el && el!=this._ownerElement){ - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - var oldAttr = this.getNamedItem(attr.nodeName); - _addNamedNode(this._ownerElement,this,attr,oldAttr); - return oldAttr; - }, - /* returns Node */ - setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR - var el = attr.ownerElement, oldAttr; - if(el && el!=this._ownerElement){ - throw new DOMException(INUSE_ATTRIBUTE_ERR); - } - oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); - _addNamedNode(this._ownerElement,this,attr,oldAttr); - return oldAttr; - }, - - /* returns Node */ - removeNamedItem: function(key) { - var attr = this.getNamedItem(key); - _removeNamedNode(this._ownerElement,this,attr); - return attr; - - - },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR - - //for level2 - removeNamedItemNS:function(namespaceURI,localName){ - var attr = this.getNamedItemNS(namespaceURI,localName); - _removeNamedNode(this._ownerElement,this,attr); - return attr; + return false; }, - getNamedItemNS: function(namespaceURI, localName) { - var i = this.length; - while(i--){ - var node = this[i]; - if(node.localName == localName && node.namespaceURI == namespaceURI){ - return node; + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); } - } - return null; - } - }; - - /** - * The DOMImplementation interface represents an object providing methods - * which are not dependent on any particular document. - * Such an object is returned by the `Document.implementation` property. - * - * __The individual methods describe the differences compared to the specs.__ - * - * @constructor - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN - * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial) - * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core - * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core - * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard - */ - function DOMImplementation() { - } - - DOMImplementation.prototype = { - /** - * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported. - * The different implementations fairly diverged in what kind of features were reported. - * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. - * - * @deprecated It is deprecated and modern browsers return true in all cases. - * - * @param {string} feature - * @param {string} [version] - * @returns {boolean} always true - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN - * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core - * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard - */ - hasFeature: function(feature, version) { - return true; - }, - /** - * Creates an XML Document object of the specified type with its document element. - * - * __It behaves slightly different from the description in the living standard__: - * - There is no interface/class `XMLDocument`, it returns a `Document` instance. - * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared. - * - this implementation is not validating names or qualified names - * (when parsing XML strings, the SAX parser takes care of that) - * - * @param {string|null} namespaceURI - * @param {string} qualifiedName - * @param {DocumentType=null} doctype - * @returns {Document} - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN - * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial) - * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core - * - * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract - * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names - * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names - */ - createDocument: function(namespaceURI, qualifiedName, doctype){ - var doc = new Document(); - doc.implementation = this; - doc.childNodes = new NodeList(); - doc.doctype = doctype || null; - if (doctype){ - doc.appendChild(doctype); - } - if (qualifiedName){ - var root = doc.createElementNS(namespaceURI, qualifiedName); - doc.appendChild(root); - } - return doc; - }, - /** - * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`. - * - * __This behavior is slightly different from the in the specs__: - * - this implementation is not validating names or qualified names - * (when parsing XML strings, the SAX parser takes care of that) - * - * @param {string} qualifiedName - * @param {string} [publicId] - * @param {string} [systemId] - * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation - * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()` - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN - * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core - * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard - * - * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract - * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names - * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names - */ - createDocumentType: function(qualifiedName, publicId, systemId){ - var node = new DocumentType(); - node.name = qualifiedName; - node.nodeName = qualifiedName; - node.publicId = publicId || ''; - node.systemId = systemId || ''; - - return node; - } - }; - - - /** - * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 - */ - - function Node() { - }; - - Node.prototype = { - firstChild : null, - lastChild : null, - previousSibling : null, - nextSibling : null, - attributes : null, - parentNode : null, - childNodes : null, - ownerDocument : null, - nodeValue : null, - namespaceURI : null, - prefix : null, - localName : null, - // Modified in DOM Level 2: - insertBefore:function(newChild, refChild){//raises - return _insertBefore(this,newChild,refChild); - }, - replaceChild:function(newChild, oldChild){//raises - _insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument); - if(oldChild){ - this.removeChild(oldChild); - } }, - removeChild:function(oldChild){ - return _removeChild(this,oldChild); + +// return next match that has a token +lex:function lex () { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } }, - appendChild:function(newChild){ - return this.insertBefore(newChild,null); + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin (condition) { + this.conditionStack.push(condition); }, - hasChildNodes:function(){ - return this.firstChild != null; + +// pop the previously active lexer condition state off the condition stack +popState:function popState () { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } }, - cloneNode:function(deep){ - return cloneNode(this.ownerDocument||this,this,deep); + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules () { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } }, - // Modified in DOM Level 2: - normalize:function(){ - var child = this.firstChild; - while(child){ - var next = child.nextSibling; - if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ - this.removeChild(next); - child.appendData(next.data); - }else{ - child.normalize(); - child = next; + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState (n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; } - } }, - // Introduced in DOM Level 2: - isSupported:function(feature, version){ - return this.ownerDocument.implementation.hasFeature(feature,version); + +// alias for begin(condition) +pushState:function pushState (condition) { + this.begin(condition); }, - // Introduced in DOM Level 2: - hasAttributes:function(){ - return this.attributes.length>0; - }, - /** - * Look up the prefix associated to the given namespace URI, starting from this node. - * **The default namespace declarations are ignored by this method.** - * See Namespace Prefix Lookup for details on the algorithm used by this method. - * - * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._ - * - * @param {string | null} namespaceURI - * @returns {string | null} - * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix - * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo - * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix - * @see https://github.com/xmldom/xmldom/issues/322 - */ - lookupPrefix:function(namespaceURI){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - for(var n in map){ - if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) { - return n; - } - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - lookupNamespaceURI:function(prefix){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - if(Object.prototype.hasOwnProperty.call(map, prefix)){ - return map[prefix] ; - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - isDefaultNamespace:function(namespaceURI){ - var prefix = this.lookupPrefix(namespaceURI); - return prefix == null; - } - }; - - - function _xmlEncoder(c){ - return c == '<' && '<' || - c == '>' && '>' || - c == '&' && '&' || - c == '"' && '"' || - '&#'+c.charCodeAt()+';' - } - - - copy(NodeType,Node); - copy(NodeType,Node.prototype); - - /** - * @param callback return true for continue,false for break - * @return boolean true: break visit; - */ - function _visitNode(node,callback){ - if(callback(node)){ - return true; - } - if(node = node.firstChild){ - do{ - if(_visitNode(node,callback)){return true} - }while(node=node.nextSibling) - } - } - - - - function Document(){ - this.ownerDocument = this; - } - - function _onAddAttribute(doc,el,newAttr){ - doc && doc._inc++; - var ns = newAttr.namespaceURI ; - if(ns === NAMESPACE.XMLNS){ - //update namespace - el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value - } + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {"flex":true,"case-insensitive":true}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:/* ignore */ +break; +case 1:return 12 +break; +case 2:return 15 +break; +case 3:return 41 +break; +case 4:return 325 +break; +case 5:return 326 +break; +case 6:return 45 +break; +case 7:return 47 +break; +case 8:return 48 +break; +case 9:return 39 +break; +case 10:return 24 +break; +case 11:return 28 +break; +case 12:return 29 +break; +case 13:return 31 +break; +case 14:return 32 +break; +case 15:return 36 +break; +case 16:return 53 +break; +case 17:return 327 +break; +case 18:return 63 +break; +case 19:return 64 +break; +case 20:return 70 +break; +case 21:return 73 +break; +case 22:return 76 +break; +case 23:return 78 +break; +case 24:return 81 +break; +case 25:return 83 +break; +case 26:return 85 +break; +case 27:return 193 +break; +case 28:return 100 +break; +case 29:return 328 +break; +case 30:return 121 +break; +case 31:return 329 +break; +case 32:return 330 +break; +case 33:return 110 +break; +case 34:return 331 +break; +case 35:return 109 +break; +case 36:return 332 +break; +case 37:return 333 +break; +case 38:return 113 +break; +case 39:return 115 +break; +case 40:return 116 +break; +case 41:return 131 +break; +case 42:return 123 +break; +case 43:return 126 +break; +case 44:return 128 +break; +case 45:return 132 +break; +case 46:return 112 +break; +case 47:return 334 +break; +case 48:return 335 +break; +case 49:return 159 +break; +case 50:return 161 +break; +case 51:return 164 +break; +case 52:return 174 +break; +case 53:return 160 +break; +case 54:return 336 +break; +case 55:return 163 +break; +case 56:return 312 +break; +case 57:return 314 +break; +case 58:return 317 +break; +case 59:return 318 +break; +case 60:return 272 +break; +case 61:return 197 +break; +case 62:return 337 +break; +case 63:return 338 +break; +case 64:return 229 +break; +case 65:return 340 +break; +case 66:return 263 +break; +case 67:return 224 +break; +case 68:return 231 +break; +case 69:return 232 +break; +case 70:return 242 +break; +case 71:return 246 +break; +case 72:return 290 +break; +case 73:return 341 +break; +case 74:return 342 +break; +case 75:return 343 +break; +case 76:return 344 +break; +case 77:return 345 +break; +case 78:return 250 +break; +case 79:return 346 +break; +case 80:return 265 +break; +case 81:return 276 +break; +case 82:return 277 +break; +case 83:return 268 +break; +case 84:return 269 +break; +case 85:return 270 +break; +case 86:return 271 +break; +case 87:return 347 +break; +case 88:return 348 +break; +case 89:return 273 +break; +case 90:return 274 +break; +case 91:return 350 +break; +case 92:return 349 +break; +case 93:return 351 +break; +case 94:return 279 +break; +case 95:return 280 +break; +case 96:return 283 +break; +case 97:return 285 +break; +case 98:return 289 +break; +case 99:return 293 +break; +case 100:return 296 +break; +case 101:return 13 +break; +case 102:return 16 +break; +case 103:return 308 +break; +case 104:return 309 +break; +case 105:return 87 +break; +case 106:return 292 +break; +case 107:return 82 +break; +case 108:return 294 +break; +case 109:return 295 +break; +case 110:return 297 +break; +case 111:return 298 +break; +case 112:return 299 +break; +case 113:return 300 +break; +case 114:return 301 +break; +case 115:return 302 +break; +case 116:return 'EXPONENT' +break; +case 117:return 303 +break; +case 118:return 304 +break; +case 119:return 305 +break; +case 120:return 306 +break; +case 121:return 89 +break; +case 122:return 310 +break; +case 123:return 6 +break; +case 124:return 'INVALID' +break; +case 125:console.log(yy_.yytext); +break; +} +}, +rules: [/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,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,91,92,93,94,95,96,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,123,124,125],"inclusive":true}} +}); +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})();module.exports=SparqlParser + + +/***/ }), + +/***/ 21465: +/***/ ((module) => { + + +// Wildcard constructor +class Wildcard { + constructor() { + return WILDCARD || this; } - - function _onRemoveAttribute(doc,el,newAttr,remove){ - doc && doc._inc++; - var ns = newAttr.namespaceURI ; - if(ns === NAMESPACE.XMLNS){ - //update namespace - delete el._nsMap[newAttr.prefix?newAttr.localName:''] - } + + equals(other) { + return other && (this.termType === other.termType); } - +} + +Object.defineProperty(Wildcard.prototype, 'value', { + enumerable: true, + value: '*', +}); + +Object.defineProperty(Wildcard.prototype, 'termType', { + enumerable: true, + value: 'Wildcard', +}); + + +// Wildcard singleton +var WILDCARD = new Wildcard(); + +module.exports.R = Wildcard; + + +/***/ }), + +/***/ 30334: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Parser = (__webpack_require__(23474).Parser); +var Generator = __webpack_require__(71674); +var Wildcard = (__webpack_require__(21465)/* .Wildcard */ .R); +var { DataFactory } = __webpack_require__(18628); + +module.exports = { /** - * Updates `el.childNodes`, updating the indexed items and it's `length`. - * Passing `newChild` means it will be appended. - * Otherwise it's assumed that an item has been removed, - * and `el.firstNode` and it's `.nextSibling` are used - * to walk the current list of child nodes. - * - * @param {Document} doc - * @param {Node} el - * @param {Node} [newChild] - * @private + * Creates a SPARQL parser with the given pre-defined prefixes and base IRI + * @param options { + * prefixes?: { [prefix: string]: string }, + * baseIRI?: string, + * factory?: import('rdf-js').DataFactory, + * sparqlStar?: boolean, + * skipValidation?: boolean, + * skipUngroupedVariableCheck?: boolean + * } */ - function _onUpdateChild (doc, el, newChild) { - if(doc && doc._inc){ - doc._inc++; - //update childNodes - var cs = el.childNodes; - if (newChild) { - cs[cs.length++] = newChild; - } else { - var child = el.firstChild; - var i = 0; - while (child) { - cs[i++] = child; - child = child.nextSibling; - } - cs.length = i; - delete cs[cs.length]; - } + Parser: function ({ prefixes, baseIRI, factory, sparqlStar, skipValidation, skipUngroupedVariableCheck, pathOnly } = {}) { + + // Create a copy of the prefixes + var prefixesCopy = {}; + for (var prefix in prefixes || {}) + prefixesCopy[prefix] = prefixes[prefix]; + + // Create a new parser with the given prefixes + // (Workaround for https://github.com/zaach/jison/issues/241) + var parser = new Parser(); + parser.parse = function () { + Parser.base = baseIRI || ''; + Parser.prefixes = Object.create(prefixesCopy); + Parser.factory = factory || new DataFactory(); + Parser.sparqlStar = Boolean(sparqlStar); + Parser.pathOnly = Boolean(pathOnly); + // We keep skipUngroupedVariableCheck for compatibility reasons. + Parser.skipValidation = Boolean(skipValidation) || Boolean(skipUngroupedVariableCheck) + return Parser.prototype.parse.apply(parser, arguments); + }; + parser._resetBlanks = Parser._resetBlanks; + return parser; + }, + Generator: Generator, + Wildcard: Wildcard, +}; + + +/***/ }), + +/***/ 3988: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.mergePrefixArray = exports.getPrefixed = exports.getPrefixInfoFromIri = exports.getPrefixInfoFromPrefixedValue = exports.getLocalNameInfo = void 0; +const lodash_1 = __webpack_require__(53059); +const url_parse_1 = __importDefault(__webpack_require__(1042)); +const getLastSlashIndex = (pathname, offset) => { + if (offset === undefined) + offset = pathname.length; + const i = pathname.lastIndexOf("/", offset); + if (i >= 0 && i === pathname.length - 1) { + if (offset < 0) + return i; + return getLastSlashIndex(pathname, offset - 1); + } + return i; +}; +function getLocalNameInfo(iri) { + const parsed = (0, url_parse_1.default)(iri); + if (parsed.pathname === "/" && !iri.includes(`${parsed.hostname}/`)) { + parsed.set("pathname", ""); + } + if (parsed.hash.length > 1) { + var hashContent = parsed.hash.substring(1); + parsed.set("hash", "#"); + return { + iri: parsed.toString(), + localName: hashContent, + }; } - } - - /** - * Removes the connections between `parentNode` and `child` - * and any existing `child.previousSibling` or `child.nextSibling`. - * - * @see https://github.com/xmldom/xmldom/issues/135 - * @see https://github.com/xmldom/xmldom/issues/145 - * - * @param {Node} parentNode - * @param {Node} child - * @returns {Node} the child that was removed. - * @private - */ - function _removeChild (parentNode, child) { - var previous = child.previousSibling; - var next = child.nextSibling; - if (previous) { - previous.nextSibling = next; - } else { - parentNode.firstChild = next; + const i = getLastSlashIndex(parsed.pathname); + if (i >= 0) { + const localName = parsed.pathname.substring(i + 1) + parsed.query + parsed.hash; + if (localName && localName.length) { + parsed.set("pathname", parsed.pathname.substring(0, i + 1)); + parsed.set("query", ""); + parsed.set("hash", ""); + return { + iri: parsed.toString(), + localName: localName, + }; + } } - if (next) { - next.previousSibling = previous; - } else { - parentNode.lastChild = previous; + return { iri: iri }; +} +exports.getLocalNameInfo = getLocalNameInfo; +function getPrefixInfoFromPrefixedValue(value, prefixes) { + for (const p of Array.isArray(prefixes) ? prefixes : Object.values(prefixes)) { + if (!p.prefixLabel) + continue; + if (value.lastIndexOf(p.prefixLabel + ":", 0) === 0) { + return { + prefixLabel: p.prefixLabel, + iri: p.iri, + localName: value.substring(p.prefixLabel.length + 1), + }; + } } - child.parentNode = null; - child.previousSibling = null; - child.nextSibling = null; - _onUpdateChild(parentNode.ownerDocument, parentNode); - return child; - } - - /** - * Returns `true` if `node` can be a parent for insertion. - * @param {Node} node - * @returns {boolean} - */ - function hasValidParentNodeType(node) { - return ( - node && - (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE) - ); - } - - /** - * Returns `true` if `node` can be inserted according to it's `nodeType`. - * @param {Node} node - * @returns {boolean} - */ - function hasInsertableNodeType(node) { - return ( - node && - (isElementNode(node) || - isTextNode(node) || - isDocTypeNode(node) || - node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || - node.nodeType === Node.COMMENT_NODE || - node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) - ); - } - - /** - * Returns true if `node` is a DOCTYPE node - * @param {Node} node - * @returns {boolean} - */ - function isDocTypeNode(node) { - return node && node.nodeType === Node.DOCUMENT_TYPE_NODE; - } - - /** - * Returns true if the node is an element - * @param {Node} node - * @returns {boolean} - */ - function isElementNode(node) { - return node && node.nodeType === Node.ELEMENT_NODE; - } - /** - * Returns true if `node` is a text node - * @param {Node} node - * @returns {boolean} - */ - function isTextNode(node) { - return node && node.nodeType === Node.TEXT_NODE; - } - - /** - * Check if en element node can be inserted before `child`, or at the end if child is falsy, - * according to the presence and position of a doctype node on the same level. - * - * @param {Document} doc The document node - * @param {Node} child the node that would become the nextSibling if the element would be inserted - * @returns {boolean} `true` if an element can be inserted before child - * @private - * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity - */ - function isElementInsertionPossible(doc, child) { - var parentChildNodes = doc.childNodes || []; - if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) { - return false; + return getLocalNameInfo(value); +} +exports.getPrefixInfoFromPrefixedValue = getPrefixInfoFromPrefixedValue; +function getPrefixInfoFromIri(value, prefixes) { + const matches = []; + for (const p of Array.isArray(prefixes) ? prefixes : Object.values(prefixes)) { + if (value.length >= p.iri.length && value.lastIndexOf(p.iri, 0) === 0) { + matches.push({ + prefixLabel: p.prefixLabel, + iri: p.iri, + localName: value.substring(p.iri.length), + }); + } } - var docTypeNode = find(parentChildNodes, isDocTypeNode); - return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); - } - - /** - * Check if en element node can be inserted before `child`, or at the end if child is falsy, - * according to the presence and position of a doctype node on the same level. - * - * @param {Node} doc The document node - * @param {Node} child the node that would become the nextSibling if the element would be inserted - * @returns {boolean} `true` if an element can be inserted before child - * @private - * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity - */ - function isElementReplacementPossible(doc, child) { - var parentChildNodes = doc.childNodes || []; - - function hasElementChildThatIsNotChild(node) { - return isElementNode(node) && node !== child; - } - - if (find(parentChildNodes, hasElementChildThatIsNotChild)) { - return false; + return matches.sort((a, b) => b.iri.length - a.iri.length)[0] || getLocalNameInfo(value); +} +exports.getPrefixInfoFromIri = getPrefixInfoFromIri; +function getPrefixed(value, prefixes) { + const info = getPrefixInfoFromIri(value, prefixes); + if (info && info.prefixLabel) + return `${info.prefixLabel}:${info.localName}`; +} +exports.getPrefixed = getPrefixed; +function mergePrefixArray(basePrefixes, secondPrefixes) { + return (0, lodash_1.uniqBy)((0, lodash_1.unionBy)(basePrefixes, secondPrefixes, (prefix) => prefix.iri), (prefix) => prefix.prefixLabel); +} +exports.mergePrefixArray = mergePrefixArray; + + +/***/ }), + +/***/ 16996: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +/** + * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes. + * + * Works with anything that has a `length` property and index access properties, including NodeList. + * + * @template {unknown} T + * @param {Array | ({length:number, [number]: T})} list + * @param {function (item: T, index: number, list:Array | ({length:number, [number]: T})):boolean} predicate + * @param {Partial>?} ac `Array.prototype` by default, + * allows injecting a custom implementation in tests + * @returns {T | undefined} + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find + * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find + */ +function find(list, predicate, ac) { + if (ac === undefined) { + ac = Array.prototype; + } + if (list && typeof ac.find === 'function') { + return ac.find.call(list, predicate); + } + for (var i = 0; i < list.length; i++) { + if (Object.prototype.hasOwnProperty.call(list, i)) { + var item = list[i]; + if (predicate.call(undefined, item, i, list)) { + return item; + } + } + } +} + +/** + * "Shallow freezes" an object to render it immutable. + * Uses `Object.freeze` if available, + * otherwise the immutability is only in the type. + * + * Is used to create "enum like" objects. + * + * @template T + * @param {T} object the object to freeze + * @param {Pick = Object} oc `Object` by default, + * allows to inject custom object constructor for tests + * @returns {Readonly} + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze + */ +function freeze(object, oc) { + if (oc === undefined) { + oc = Object + } + return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object +} + +/** + * Since we can not rely on `Object.assign` we provide a simplified version + * that is sufficient for our needs. + * + * @param {Object} target + * @param {Object | null | undefined} source + * + * @returns {Object} target + * @throws TypeError if target is not an object + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign + */ +function assign(target, source) { + if (target === null || typeof target !== 'object') { + throw new TypeError('target is not an object') + } + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + return target +} + +/** + * All mime types that are allowed as input to `DOMParser.parseFromString` + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec + * @see DOMParser.prototype.parseFromString + */ +var MIME_TYPE = freeze({ + /** + * `text/html`, the only mime type that triggers treating an XML document as HTML. + * + * @see DOMParser.SupportedType.isHTML + * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration + * @see https://en.wikipedia.org/wiki/HTML Wikipedia + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec + */ + HTML: 'text/html', + + /** + * Helper method to check a mime type if it indicates an HTML document + * + * @param {string} [value] + * @returns {boolean} + * + * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration + * @see https://en.wikipedia.org/wiki/HTML Wikipedia + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */ + isHTML: function (value) { + return value === MIME_TYPE.HTML + }, + + /** + * `application/xml`, the standard mime type for XML documents. + * + * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration + * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303 + * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia + */ + XML_APPLICATION: 'application/xml', + + /** + * `text/html`, an alias for `application/xml`. + * + * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303 + * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration + * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia + */ + XML_TEXT: 'text/xml', + + /** + * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace, + * but is parsed as an XML document. + * + * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec + * @see https://en.wikipedia.org/wiki/XHTML Wikipedia + */ + XML_XHTML_APPLICATION: 'application/xhtml+xml', + + /** + * `image/svg+xml`, + * + * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration + * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1 + * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia + */ + XML_SVG_IMAGE: 'image/svg+xml', +}) + +/** + * Namespaces that are used in this code base. + * + * @see http://www.w3.org/TR/REC-xml-names + */ +var NAMESPACE = freeze({ + /** + * The XHTML namespace. + * + * @see http://www.w3.org/1999/xhtml + */ + HTML: 'http://www.w3.org/1999/xhtml', + + /** + * Checks if `uri` equals `NAMESPACE.HTML`. + * + * @param {string} [uri] + * + * @see NAMESPACE.HTML + */ + isHTML: function (uri) { + return uri === NAMESPACE.HTML + }, + + /** + * The SVG namespace. + * + * @see http://www.w3.org/2000/svg + */ + SVG: 'http://www.w3.org/2000/svg', + + /** + * The `xml:` namespace. + * + * @see http://www.w3.org/XML/1998/namespace + */ + XML: 'http://www.w3.org/XML/1998/namespace', + + /** + * The `xmlns:` namespace + * + * @see https://www.w3.org/2000/xmlns/ + */ + XMLNS: 'http://www.w3.org/2000/xmlns/', +}) + +exports.assign = assign; +exports.find = find; +exports.freeze = freeze; +exports.MIME_TYPE = MIME_TYPE; +exports.NAMESPACE = NAMESPACE; + + +/***/ }), + +/***/ 40654: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var __webpack_unused_export__; +/* provided dependency */ var console = __webpack_require__(80292); +var conventions = __webpack_require__(16996); +var dom = __webpack_require__(71855) +var entities = __webpack_require__(16714); +var sax = __webpack_require__(13418); + +var DOMImplementation = dom.DOMImplementation; + +var NAMESPACE = conventions.NAMESPACE; + +var ParseError = sax.ParseError; +var XMLReader = sax.XMLReader; + +/** + * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends: + * + * > XML parsed entities are often stored in computer files which, + * > for editing convenience, are organized into lines. + * > These lines are typically separated by some combination + * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA). + * > + * > To simplify the tasks of applications, the XML processor must behave + * > as if it normalized all line breaks in external parsed entities (including the document entity) + * > on input, before parsing, by translating all of the following to a single #xA character: + * > + * > 1. the two-character sequence #xD #xA + * > 2. the two-character sequence #xD #x85 + * > 3. the single character #x85 + * > 4. the single character #x2028 + * > 5. any #xD character that is not immediately followed by #xA or #x85. + * + * @param {string} input + * @returns {string} + */ +function normalizeLineEndings(input) { + return input + .replace(/\r[\n\u0085]/g, '\n') + .replace(/[\r\u0085\u2028]/g, '\n') +} + +/** + * @typedef Locator + * @property {number} [columnNumber] + * @property {number} [lineNumber] + */ + +/** + * @typedef DOMParserOptions + * @property {DOMHandler} [domBuilder] + * @property {Function} [errorHandler] + * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing + * defaults to `normalizeLineEndings` + * @property {Locator} [locator] + * @property {Record} [xmlns] + * + * @see normalizeLineEndings + */ + +/** + * The DOMParser interface provides the ability to parse XML or HTML source code + * from a string into a DOM `Document`. + * + * _xmldom is different from the spec in that it allows an `options` parameter, + * to override the default behavior._ + * + * @param {DOMParserOptions} [options] + * @constructor + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization + */ +function DOMParser(options){ + this.options = options ||{locator:{}}; +} + +DOMParser.prototype.parseFromString = function(source,mimeType){ + var options = this.options; + var sax = new XMLReader(); + var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler + var errorHandler = options.errorHandler; + var locator = options.locator; + var defaultNSMap = options.xmlns||{}; + var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1; + var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES; + if(locator){ + domBuilder.setDocumentLocator(locator) + } + + sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); + sax.domBuilder = options.domBuilder || domBuilder; + if(isHTML){ + defaultNSMap[''] = NAMESPACE.HTML; + } + defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML; + var normalize = options.normalizeLineEndings || normalizeLineEndings; + if (source && typeof source === 'string') { + sax.parse( + normalize(source), + defaultNSMap, + entityMap + ) + } else { + sax.errorHandler.error('invalid doc source') + } + return domBuilder.doc; +} +function buildErrorHandler(errorImpl,domBuilder,locator){ + if(!errorImpl){ + if(domBuilder instanceof DOMHandler){ + return domBuilder; + } + errorImpl = domBuilder ; + } + var errorHandler = {} + var isCallback = errorImpl instanceof Function; + locator = locator||{} + function build(key){ + var fn = errorImpl[key]; + if(!fn && isCallback){ + fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; + } + errorHandler[key] = fn && function(msg){ + fn('[xmldom '+key+']\t'+msg+_locator(locator)); + }||function(){}; + } + build('warning'); + build('error'); + build('fatalError'); + return errorHandler; +} + +//console.log('#\n\n\n\n\n\n\n####') +/** + * +ContentHandler+ErrorHandler + * +LexicalHandler+EntityResolver2 + * -DeclHandler-DTDHandler + * + * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler + * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 + * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html + */ +function DOMHandler() { + this.cdata = false; +} +function position(locator,node){ + node.lineNumber = locator.lineNumber; + node.columnNumber = locator.columnNumber; +} +/** + * @see org.xml.sax.ContentHandler#startDocument + * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ +DOMHandler.prototype = { + startDocument : function() { + this.doc = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.doc.documentURI = this.locator.systemId; + } + }, + startElement:function(namespaceURI, localName, qName, attrs) { + var doc = this.doc; + var el = doc.createElementNS(namespaceURI, qName||localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + + this.locator && position(this.locator,el) + for (var i = 0 ; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + this.locator &&position(attrs.getLocator(i),attr); + attr.value = attr.nodeValue = value; + el.setAttributeNode(attr) + } + }, + endElement:function(namespaceURI, localName, qName) { + var current = this.currentElement + var tagName = current.tagName; + this.currentElement = current.parentNode; + }, + startPrefixMapping:function(prefix, uri) { + }, + endPrefixMapping:function(prefix) { + }, + processingInstruction:function(target, data) { + var ins = this.doc.createProcessingInstruction(target, data); + this.locator && position(this.locator,ins) + appendElement(this, ins); + }, + ignorableWhitespace:function(ch, start, length) { + }, + characters:function(chars, start, length) { + chars = _toString.apply(this,arguments) + //console.log(chars) + if(chars){ + if (this.cdata) { + var charNode = this.doc.createCDATASection(chars); + } else { + var charNode = this.doc.createTextNode(chars); + } + if(this.currentElement){ + this.currentElement.appendChild(charNode); + }else if(/^\s*$/.test(chars)){ + this.doc.appendChild(charNode); + //process xml + } + this.locator && position(this.locator,charNode) + } + }, + skippedEntity:function(name) { + }, + endDocument:function() { + this.doc.normalize(); + }, + setDocumentLocator:function (locator) { + if(this.locator = locator){// && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } + }, + //LexicalHandler + comment:function(chars, start, length) { + chars = _toString.apply(this,arguments) + var comm = this.doc.createComment(chars); + this.locator && position(this.locator,comm) + appendElement(this, comm); + }, + + startCDATA:function() { + //used in characters() methods + this.cdata = true; + }, + endCDATA:function() { + this.cdata = false; + }, + + startDTD:function(name, publicId, systemId) { + var impl = this.doc.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator,dt) + appendElement(this, dt); + this.doc.doctype = dt; + } + }, + /** + * @see org.xml.sax.ErrorHandler + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning:function(error) { + console.warn('[xmldom warning]\t'+error,_locator(this.locator)); + }, + error:function(error) { + console.error('[xmldom error]\t'+error,_locator(this.locator)); + }, + fatalError:function(error) { + throw new ParseError(error, this.locator); + } +} +function _locator(l){ + if(l){ + return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' + } +} +function _toString(chars,start,length){ + if(typeof chars == 'string'){ + return chars.substr(start,length) + }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") + if(chars.length >= start+length || start){ + return new java.lang.String(chars,start,length)+''; + } + return chars; + } +} + +/* + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html + * used method of org.xml.sax.ext.LexicalHandler: + * #comment(chars, start, length) + * #startCDATA() + * #endCDATA() + * #startDTD(name, publicId, systemId) + * + * + * IGNORED method of org.xml.sax.ext.LexicalHandler: + * #endDTD() + * #startEntity(name) + * #endEntity(name) + * + * + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html + * IGNORED method of org.xml.sax.ext.DeclHandler + * #attributeDecl(eName, aName, type, mode, value) + * #elementDecl(name, model) + * #externalEntityDecl(name, publicId, systemId) + * #internalEntityDecl(name, value) + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html + * IGNORED method of org.xml.sax.EntityResolver2 + * #resolveEntity(String name,String publicId,String baseURI,String systemId) + * #resolveEntity(publicId, systemId) + * #getExternalSubset(name, baseURI) + * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html + * IGNORED method of org.xml.sax.DTDHandler + * #notationDecl(name, publicId, systemId) {}; + * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; + */ +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ + DOMHandler.prototype[key] = function(){return null} +}) + +/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ +function appendElement (hander,node) { + if (!hander.currentElement) { + hander.doc.appendChild(node); + } else { + hander.currentElement.appendChild(node); } - var docTypeNode = find(parentChildNodes, isDocTypeNode); - return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); +}//appendChild and setAttributeNS are preformance key + +__webpack_unused_export__ = DOMHandler; +__webpack_unused_export__ = normalizeLineEndings; +exports.DOMParser = DOMParser; + + +/***/ }), + +/***/ 71855: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* provided dependency */ var console = __webpack_require__(80292); +var conventions = __webpack_require__(16996); + +var find = conventions.find; +var NAMESPACE = conventions.NAMESPACE; + +/** + * A prerequisite for `[].filter`, to drop elements that are empty + * @param {string} input + * @returns {boolean} + */ +function notEmptyString (input) { + return input !== '' +} +/** + * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace + * @see https://infra.spec.whatwg.org/#ascii-whitespace + * + * @param {string} input + * @returns {string[]} (can be empty) + */ +function splitOnASCIIWhitespace(input) { + // U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE + return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [] +} + +/** + * Adds element as a key to current if it is not already present. + * + * @param {Record} current + * @param {string} element + * @returns {Record} + */ +function orderedSetReducer (current, element) { + if (!current.hasOwnProperty(element)) { + current[element] = true; + } + return current; +} + +/** + * @see https://infra.spec.whatwg.org/#ordered-set + * @param {string} input + * @returns {string[]} + */ +function toOrderedSet(input) { + if (!input) return []; + var list = splitOnASCIIWhitespace(input); + return Object.keys(list.reduce(orderedSetReducer, {})) +} + +/** + * Uses `list.indexOf` to implement something like `Array.prototype.includes`, + * which we can not rely on being available. + * + * @param {any[]} list + * @returns {function(any): boolean} + */ +function arrayIncludes (list) { + return function(element) { + return list && list.indexOf(element) !== -1; + } +} + +function copy(src,dest){ + for(var p in src){ + if (Object.prototype.hasOwnProperty.call(src, p)) { + dest[p] = src[p]; + } + } +} + +/** +^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));? +^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));? + */ +function _extends(Class,Super){ + var pt = Class.prototype; + if(!(pt instanceof Super)){ + function t(){}; + t.prototype = Super.prototype; + t = new t(); + copy(pt,t); + Class.prototype = pt = t; + } + if(pt.constructor != Class){ + if(typeof Class != 'function'){ + console.error("unknown Class:"+Class) + } + pt.constructor = Class + } +} + +// Node Types +var NodeType = {} +var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2; +var TEXT_NODE = NodeType.TEXT_NODE = 3; +var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = NodeType.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = NodeType.COMMENT_NODE = 8; +var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = NodeType.NOTATION_NODE = 12; + +// ExceptionCode +var ExceptionCode = {} +var ExceptionMessage = {}; +var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1); +var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2); +var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3); +var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4); +var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5); +var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6); +var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7); +var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8); +var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9); +var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10); +//level2 +var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11); +var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12); +var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13); +var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14); +var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15); + +/** + * DOM Level 2 + * Object DOMException + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html + * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html + */ +function DOMException(code, message) { + if(message instanceof Error){ + var error = message; + }else{ + error = this; + Error.call(this, ExceptionMessage[code]); + this.message = ExceptionMessage[code]; + if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException); + } + error.code = code; + if(message) this.message = this.message + ": " + message; + return error; +}; +DOMException.prototype = Error.prototype; +copy(ExceptionCode,DOMException) + +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177 + * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live. + * The items in the NodeList are accessible via an integral index, starting from 0. + */ +function NodeList() { +}; +NodeList.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. + * @standard level1 + */ + length:0, + /** + * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null. + * @standard level1 + * @param index unsigned long + * Index into the collection. + * @return Node + * The node at the indexth position in the NodeList, or null if that is not a valid index. + */ + item: function(index) { + return index >= 0 && index < this.length ? this[index] : null; + }, + toString:function(isHTML,nodeFilter){ + for(var buf = [], i = 0;i=0){ + var lastIndex = list.length-1 + while(i0 || key == 'xmlns'){ +// return null; +// } + //console.log() + var i = this.length; + while(i--){ + var attr = this[i]; + //console.log(attr.nodeName,key) + if(attr.nodeName == key){ + return attr; + } + } + }, + setNamedItem: function(attr) { + var el = attr.ownerElement; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + var oldAttr = this.getNamedItem(attr.nodeName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + /* returns Node */ + setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR + var el = attr.ownerElement, oldAttr; + if(el && el!=this._ownerElement){ + throw new DOMException(INUSE_ATTRIBUTE_ERR); + } + oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName); + _addNamedNode(this._ownerElement,this,attr,oldAttr); + return oldAttr; + }, + + /* returns Node */ + removeNamedItem: function(key) { + var attr = this.getNamedItem(key); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + + + },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR + + //for level2 + removeNamedItemNS:function(namespaceURI,localName){ + var attr = this.getNamedItemNS(namespaceURI,localName); + _removeNamedNode(this._ownerElement,this,attr); + return attr; + }, + getNamedItemNS: function(namespaceURI, localName) { + var i = this.length; + while(i--){ + var node = this[i]; + if(node.localName == localName && node.namespaceURI == namespaceURI){ + return node; + } + } + return null; + } +}; + +/** + * The DOMImplementation interface represents an object providing methods + * which are not dependent on any particular document. + * Such an object is returned by the `Document.implementation` property. + * + * __The individual methods describe the differences compared to the specs.__ + * + * @constructor + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN + * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial) + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core + * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard + */ +function DOMImplementation() { +} + +DOMImplementation.prototype = { + /** + * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported. + * The different implementations fairly diverged in what kind of features were reported. + * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. + * + * @deprecated It is deprecated and modern browsers return true in all cases. + * + * @param {string} feature + * @param {string} [version] + * @returns {boolean} always true + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN + * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core + * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard + */ + hasFeature: function(feature, version) { + return true; + }, + /** + * Creates an XML Document object of the specified type with its document element. + * + * __It behaves slightly different from the description in the living standard__: + * - There is no interface/class `XMLDocument`, it returns a `Document` instance. + * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared. + * - this implementation is not validating names or qualified names + * (when parsing XML strings, the SAX parser takes care of that) + * + * @param {string|null} namespaceURI + * @param {string} qualifiedName + * @param {DocumentType=null} doctype + * @returns {Document} + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial) + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core + * + * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract + * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names + * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names + */ + createDocument: function(namespaceURI, qualifiedName, doctype){ + var doc = new Document(); + doc.implementation = this; + doc.childNodes = new NodeList(); + doc.doctype = doctype || null; + if (doctype){ + doc.appendChild(doctype); + } + if (qualifiedName){ + var root = doc.createElementNS(namespaceURI, qualifiedName); + doc.appendChild(root); + } + return doc; + }, + /** + * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`. + * + * __This behavior is slightly different from the in the specs__: + * - this implementation is not validating names or qualified names + * (when parsing XML strings, the SAX parser takes care of that) + * + * @param {string} qualifiedName + * @param {string} [publicId] + * @param {string} [systemId] + * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation + * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()` + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard + * + * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract + * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names + * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names + */ + createDocumentType: function(qualifiedName, publicId, systemId){ + var node = new DocumentType(); + node.name = qualifiedName; + node.nodeName = qualifiedName; + node.publicId = publicId || ''; + node.systemId = systemId || ''; + + return node; + } +}; + + +/** + * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247 + */ + +function Node() { +}; + +Node.prototype = { + firstChild : null, + lastChild : null, + previousSibling : null, + nextSibling : null, + attributes : null, + parentNode : null, + childNodes : null, + ownerDocument : null, + nodeValue : null, + namespaceURI : null, + prefix : null, + localName : null, + // Modified in DOM Level 2: + insertBefore:function(newChild, refChild){//raises + return _insertBefore(this,newChild,refChild); + }, + replaceChild:function(newChild, oldChild){//raises + _insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument); + if(oldChild){ + this.removeChild(oldChild); + } + }, + removeChild:function(oldChild){ + return _removeChild(this,oldChild); + }, + appendChild:function(newChild){ + return this.insertBefore(newChild,null); + }, + hasChildNodes:function(){ + return this.firstChild != null; + }, + cloneNode:function(deep){ + return cloneNode(this.ownerDocument||this,this,deep); + }, + // Modified in DOM Level 2: + normalize:function(){ + var child = this.firstChild; + while(child){ + var next = child.nextSibling; + if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){ + this.removeChild(next); + child.appendData(next.data); + }else{ + child.normalize(); + child = next; + } + } + }, + // Introduced in DOM Level 2: + isSupported:function(feature, version){ + return this.ownerDocument.implementation.hasFeature(feature,version); + }, + // Introduced in DOM Level 2: + hasAttributes:function(){ + return this.attributes.length>0; + }, + /** + * Look up the prefix associated to the given namespace URI, starting from this node. + * **The default namespace declarations are ignored by this method.** + * See Namespace Prefix Lookup for details on the algorithm used by this method. + * + * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._ + * + * @param {string | null} namespaceURI + * @returns {string | null} + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix + * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo + * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix + * @see https://github.com/xmldom/xmldom/issues/322 + */ + lookupPrefix:function(namespaceURI){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + for(var n in map){ + if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) { + return n; + } + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + lookupNamespaceURI:function(prefix){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + if(Object.prototype.hasOwnProperty.call(map, prefix)){ + return map[prefix] ; + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + isDefaultNamespace:function(namespaceURI){ + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + } +}; + + +function _xmlEncoder(c){ + return c == '<' && '<' || + c == '>' && '>' || + c == '&' && '&' || + c == '"' && '"' || + '&#'+c.charCodeAt()+';' +} + + +copy(NodeType,Node); +copy(NodeType,Node.prototype); + +/** + * @param callback return true for continue,false for break + * @return boolean true: break visit; + */ +function _visitNode(node,callback){ + if(callback(node)){ + return true; + } + if(node = node.firstChild){ + do{ + if(_visitNode(node,callback)){return true} + }while(node=node.nextSibling) + } +} + + + +function Document(){ + this.ownerDocument = this; +} + +function _onAddAttribute(doc,el,newAttr){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns === NAMESPACE.XMLNS){ + //update namespace + el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value + } +} + +function _onRemoveAttribute(doc,el,newAttr,remove){ + doc && doc._inc++; + var ns = newAttr.namespaceURI ; + if(ns === NAMESPACE.XMLNS){ + //update namespace + delete el._nsMap[newAttr.prefix?newAttr.localName:''] + } +} + +/** + * Updates `el.childNodes`, updating the indexed items and it's `length`. + * Passing `newChild` means it will be appended. + * Otherwise it's assumed that an item has been removed, + * and `el.firstNode` and it's `.nextSibling` are used + * to walk the current list of child nodes. + * + * @param {Document} doc + * @param {Node} el + * @param {Node} [newChild] + * @private + */ +function _onUpdateChild (doc, el, newChild) { + if(doc && doc._inc){ + doc._inc++; + //update childNodes + var cs = el.childNodes; + if (newChild) { + cs[cs.length++] = newChild; + } else { + var child = el.firstChild; + var i = 0; + while (child) { + cs[i++] = child; + child = child.nextSibling; + } + cs.length = i; + delete cs[cs.length]; + } + } +} + +/** + * Removes the connections between `parentNode` and `child` + * and any existing `child.previousSibling` or `child.nextSibling`. + * + * @see https://github.com/xmldom/xmldom/issues/135 + * @see https://github.com/xmldom/xmldom/issues/145 + * + * @param {Node} parentNode + * @param {Node} child + * @returns {Node} the child that was removed. + * @private + */ +function _removeChild (parentNode, child) { + var previous = child.previousSibling; + var next = child.nextSibling; + if (previous) { + previous.nextSibling = next; + } else { + parentNode.firstChild = next; + } + if (next) { + next.previousSibling = previous; + } else { + parentNode.lastChild = previous; + } + child.parentNode = null; + child.previousSibling = null; + child.nextSibling = null; + _onUpdateChild(parentNode.ownerDocument, parentNode); + return child; +} + +/** + * Returns `true` if `node` can be a parent for insertion. + * @param {Node} node + * @returns {boolean} + */ +function hasValidParentNodeType(node) { + return ( + node && + (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE) + ); +} + +/** + * Returns `true` if `node` can be inserted according to it's `nodeType`. + * @param {Node} node + * @returns {boolean} + */ +function hasInsertableNodeType(node) { + return ( + node && + (isElementNode(node) || + isTextNode(node) || + isDocTypeNode(node) || + node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || + node.nodeType === Node.COMMENT_NODE || + node.nodeType === Node.PROCESSING_INSTRUCTION_NODE) + ); +} + +/** + * Returns true if `node` is a DOCTYPE node + * @param {Node} node + * @returns {boolean} + */ +function isDocTypeNode(node) { + return node && node.nodeType === Node.DOCUMENT_TYPE_NODE; +} + +/** + * Returns true if the node is an element + * @param {Node} node + * @returns {boolean} + */ +function isElementNode(node) { + return node && node.nodeType === Node.ELEMENT_NODE; +} +/** + * Returns true if `node` is a text node + * @param {Node} node + * @returns {boolean} + */ +function isTextNode(node) { + return node && node.nodeType === Node.TEXT_NODE; +} + +/** + * Check if en element node can be inserted before `child`, or at the end if child is falsy, + * according to the presence and position of a doctype node on the same level. + * + * @param {Document} doc The document node + * @param {Node} child the node that would become the nextSibling if the element would be inserted + * @returns {boolean} `true` if an element can be inserted before child + * @private + * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + */ +function isElementInsertionPossible(doc, child) { + var parentChildNodes = doc.childNodes || []; + if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) { + return false; + } + var docTypeNode = find(parentChildNodes, isDocTypeNode); + return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); +} + +/** + * Check if en element node can be inserted before `child`, or at the end if child is falsy, + * according to the presence and position of a doctype node on the same level. + * + * @param {Node} doc The document node + * @param {Node} child the node that would become the nextSibling if the element would be inserted + * @returns {boolean} `true` if an element can be inserted before child + * @private + * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + */ +function isElementReplacementPossible(doc, child) { + var parentChildNodes = doc.childNodes || []; + + function hasElementChildThatIsNotChild(node) { + return isElementNode(node) && node !== child; + } + + if (find(parentChildNodes, hasElementChildThatIsNotChild)) { + return false; + } + var docTypeNode = find(parentChildNodes, isDocTypeNode); + return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child)); +} + +/** + * @private + * Steps 1-5 of the checks before inserting and before replacing a child are the same. + * + * @param {Node} parent the parent node to insert `node` into + * @param {Node} node the node to insert + * @param {Node=} child the node that should become the `nextSibling` of `node` + * @returns {Node} + * @throws DOMException for several node combinations that would create a DOM that is not well-formed. + * @throws DOMException if `child` is provided but is not a child of `parent`. + * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + * @see https://dom.spec.whatwg.org/#concept-node-replace + */ +function assertPreInsertionValidity1to5(parent, node, child) { + // 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a "HierarchyRequestError" DOMException. + if (!hasValidParentNodeType(parent)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType); + } + // 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a "HierarchyRequestError" DOMException. + // not implemented! + // 3. If `child` is non-null and its parent is not `parent`, then throw a "NotFoundError" DOMException. + if (child && child.parentNode !== parent) { + throw new DOMException(NOT_FOUND_ERR, 'child not in parent'); + } + if ( + // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException. + !hasInsertableNodeType(node) || + // 5. If either `node` is a Text node and `parent` is a document, + // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0 + // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE) + // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException. + (isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) + ) { + throw new DOMException( + HIERARCHY_REQUEST_ERR, + 'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType + ); + } +} + +/** + * @private + * Step 6 of the checks before inserting and before replacing a child are different. + * + * @param {Document} parent the parent node to insert `node` into + * @param {Node} node the node to insert + * @param {Node | undefined} child the node that should become the `nextSibling` of `node` + * @returns {Node} + * @throws DOMException for several node combinations that would create a DOM that is not well-formed. + * @throws DOMException if `child` is provided but is not a child of `parent`. + * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + * @see https://dom.spec.whatwg.org/#concept-node-replace + */ +function assertPreInsertionValidityInDocument(parent, node, child) { + var parentChildNodes = parent.childNodes || []; + var nodeChildNodes = node.childNodes || []; + + // DocumentFragment + if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + var nodeChildElements = nodeChildNodes.filter(isElementNode); + // If node has more than one element child or has a Text node child. + if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment'); + } + // Otherwise, if `node` has one element child and either `parent` has an element child, + // `child` is a doctype, or `child` is non-null and a doctype is following `child`. + if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype'); + } + } + // Element + if (isElementNode(node)) { + // `parent` has an element child, `child` is a doctype, + // or `child` is non-null and a doctype is following `child`. + if (!isElementInsertionPossible(parent, child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype'); + } + } + // DocumentType + if (isDocTypeNode(node)) { + // `parent` has a doctype child, + if (find(parentChildNodes, isDocTypeNode)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed'); + } + var parentElementChild = find(parentChildNodes, isElementNode); + // `child` is non-null and an element is preceding `child`, + if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element'); + } + // or `child` is null and `parent` has an element child. + if (!child && parentElementChild) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present'); + } + } +} + +/** + * @private + * Step 6 of the checks before inserting and before replacing a child are different. + * + * @param {Document} parent the parent node to insert `node` into + * @param {Node} node the node to insert + * @param {Node | undefined} child the node that should become the `nextSibling` of `node` + * @returns {Node} + * @throws DOMException for several node combinations that would create a DOM that is not well-formed. + * @throws DOMException if `child` is provided but is not a child of `parent`. + * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + * @see https://dom.spec.whatwg.org/#concept-node-replace + */ +function assertPreReplacementValidityInDocument(parent, node, child) { + var parentChildNodes = parent.childNodes || []; + var nodeChildNodes = node.childNodes || []; + + // DocumentFragment + if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + var nodeChildElements = nodeChildNodes.filter(isElementNode); + // If `node` has more than one element child or has a Text node child. + if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment'); + } + // Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`. + if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype'); + } + } + // Element + if (isElementNode(node)) { + // `parent` has an element child that is not `child` or a doctype is following `child`. + if (!isElementReplacementPossible(parent, child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype'); + } + } + // DocumentType + if (isDocTypeNode(node)) { + function hasDoctypeChildThatIsNotChild(node) { + return isDocTypeNode(node) && node !== child; + } + + // `parent` has a doctype child that is not `child`, + if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed'); + } + var parentElementChild = find(parentChildNodes, isElementNode); + // or an element is preceding `child`. + if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) { + throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element'); + } + } +} + +/** + * @private + * @param {Node} parent the parent node to insert `node` into + * @param {Node} node the node to insert + * @param {Node=} child the node that should become the `nextSibling` of `node` + * @returns {Node} + * @throws DOMException for several node combinations that would create a DOM that is not well-formed. + * @throws DOMException if `child` is provided but is not a child of `parent`. + * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity + */ +function _insertBefore(parent, node, child, _inDocumentAssertion) { + // To ensure pre-insertion validity of a node into a parent before a child, run these steps: + assertPreInsertionValidity1to5(parent, node, child); + + // If parent is a document, and any of the statements below, switched on the interface node implements, + // are true, then throw a "HierarchyRequestError" DOMException. + if (parent.nodeType === Node.DOCUMENT_NODE) { + (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child); + } + + var cp = node.parentNode; + if(cp){ + cp.removeChild(node);//remove and update + } + if(node.nodeType === DOCUMENT_FRAGMENT_NODE){ + var newFirst = node.firstChild; + if (newFirst == null) { + return node; + } + var newLast = node.lastChild; + }else{ + newFirst = newLast = node; + } + var pre = child ? child.previousSibling : parent.lastChild; + + newFirst.previousSibling = pre; + newLast.nextSibling = child; + + + if(pre){ + pre.nextSibling = newFirst; + }else{ + parent.firstChild = newFirst; + } + if(child == null){ + parent.lastChild = newLast; + }else{ + child.previousSibling = newLast; + } + do{ + newFirst.parentNode = parent; + }while(newFirst !== newLast && (newFirst= newFirst.nextSibling)) + _onUpdateChild(parent.ownerDocument||parent, parent); + //console.log(parent.lastChild.nextSibling == null) + if (node.nodeType == DOCUMENT_FRAGMENT_NODE) { + node.firstChild = node.lastChild = null; + } + return node; +} + +/** + * Appends `newChild` to `parentNode`. + * If `newChild` is already connected to a `parentNode` it is first removed from it. + * + * @see https://github.com/xmldom/xmldom/issues/135 + * @see https://github.com/xmldom/xmldom/issues/145 + * @param {Node} parentNode + * @param {Node} newChild + * @returns {Node} + * @private + */ +function _appendSingleChild (parentNode, newChild) { + if (newChild.parentNode) { + newChild.parentNode.removeChild(newChild); + } + newChild.parentNode = parentNode; + newChild.previousSibling = parentNode.lastChild; + newChild.nextSibling = null; + if (newChild.previousSibling) { + newChild.previousSibling.nextSibling = newChild; + } else { + parentNode.firstChild = newChild; + } + parentNode.lastChild = newChild; + _onUpdateChild(parentNode.ownerDocument, parentNode, newChild); + return newChild; +} + +Document.prototype = { + //implementation : null, + nodeName : '#document', + nodeType : DOCUMENT_NODE, + /** + * The DocumentType node of the document. + * + * @readonly + * @type DocumentType + */ + doctype : null, + documentElement : null, + _inc : 1, + + insertBefore : function(newChild, refChild){//raises + if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){ + var child = newChild.firstChild; + while(child){ + var next = child.nextSibling; + this.insertBefore(child,refChild); + child = next; + } + return newChild; + } + _insertBefore(this, newChild, refChild); + newChild.ownerDocument = this; + if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) { + this.documentElement = newChild; + } + + return newChild; + }, + removeChild : function(oldChild){ + if(this.documentElement == oldChild){ + this.documentElement = null; + } + return _removeChild(this,oldChild); + }, + replaceChild: function (newChild, oldChild) { + //raises + _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument); + newChild.ownerDocument = this; + if (oldChild) { + this.removeChild(oldChild); + } + if (isElementNode(newChild)) { + this.documentElement = newChild; + } + }, + // Introduced in DOM Level 2: + importNode : function(importedNode,deep){ + return importNode(this,importedNode,deep); + }, + // Introduced in DOM Level 2: + getElementById : function(id){ + var rtv = null; + _visitNode(this.documentElement,function(node){ + if(node.nodeType == ELEMENT_NODE){ + if(node.getAttribute('id') == id){ + rtv = node; + return true; + } + } + }) + return rtv; + }, + + /** + * The `getElementsByClassName` method of `Document` interface returns an array-like object + * of all child elements which have **all** of the given class name(s). + * + * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters. + * + * + * Warning: This is a live LiveNodeList. + * Changes in the DOM will reflect in the array as the changes occur. + * If an element selected by this array no longer qualifies for the selector, + * it will automatically be removed. Be aware of this for iteration purposes. + * + * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName + * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname + */ + getElementsByClassName: function(classNames) { + var classNamesSet = toOrderedSet(classNames) + return new LiveNodeList(this, function(base) { + var ls = []; + if (classNamesSet.length > 0) { + _visitNode(base.documentElement, function(node) { + if(node !== base && node.nodeType === ELEMENT_NODE) { + var nodeClassNames = node.getAttribute('class') + // can be null if the attribute does not exist + if (nodeClassNames) { + // before splitting and iterating just compare them for the most common case + var matches = classNames === nodeClassNames; + if (!matches) { + var nodeClassNamesSet = toOrderedSet(nodeClassNames) + matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet)) + } + if(matches) { + ls.push(node); + } + } + } + }); + } + return ls; + }); + }, + + //document factory method: + createElement : function(tagName){ + var node = new Element(); + node.ownerDocument = this; + node.nodeName = tagName; + node.tagName = tagName; + node.localName = tagName; + node.childNodes = new NodeList(); + var attrs = node.attributes = new NamedNodeMap(); + attrs._ownerElement = node; + return node; + }, + createDocumentFragment : function(){ + var node = new DocumentFragment(); + node.ownerDocument = this; + node.childNodes = new NodeList(); + return node; + }, + createTextNode : function(data){ + var node = new Text(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createComment : function(data){ + var node = new Comment(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createCDATASection : function(data){ + var node = new CDATASection(); + node.ownerDocument = this; + node.appendData(data) + return node; + }, + createProcessingInstruction : function(target,data){ + var node = new ProcessingInstruction(); + node.ownerDocument = this; + node.tagName = node.nodeName = node.target = target; + node.nodeValue = node.data = data; + return node; + }, + createAttribute : function(name){ + var node = new Attr(); + node.ownerDocument = this; + node.name = name; + node.nodeName = name; + node.localName = name; + node.specified = true; + return node; + }, + createEntityReference : function(name){ + var node = new EntityReference(); + node.ownerDocument = this; + node.nodeName = name; + return node; + }, + // Introduced in DOM Level 2: + createElementNS : function(namespaceURI,qualifiedName){ + var node = new Element(); + var pl = qualifiedName.split(':'); + var attrs = node.attributes = new NamedNodeMap(); + node.childNodes = new NodeList(); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.tagName = qualifiedName; + node.namespaceURI = namespaceURI; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + attrs._ownerElement = node; + return node; + }, + // Introduced in DOM Level 2: + createAttributeNS : function(namespaceURI,qualifiedName){ + var node = new Attr(); + var pl = qualifiedName.split(':'); + node.ownerDocument = this; + node.nodeName = qualifiedName; + node.name = qualifiedName; + node.namespaceURI = namespaceURI; + node.specified = true; + if(pl.length == 2){ + node.prefix = pl[0]; + node.localName = pl[1]; + }else{ + //el.prefix = null; + node.localName = qualifiedName; + } + return node; + } +}; +_extends(Document,Node); + + +function Element() { + this._nsMap = {}; +}; +Element.prototype = { + nodeType : ELEMENT_NODE, + hasAttribute : function(name){ + return this.getAttributeNode(name)!=null; + }, + getAttribute : function(name){ + var attr = this.getAttributeNode(name); + return attr && attr.value || ''; + }, + getAttributeNode : function(name){ + return this.attributes.getNamedItem(name); + }, + setAttribute : function(name, value){ + var attr = this.ownerDocument.createAttribute(name); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + removeAttribute : function(name){ + var attr = this.getAttributeNode(name) + attr && this.removeAttributeNode(attr); + }, + + //four real opeartion method + appendChild:function(newChild){ + if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){ + return this.insertBefore(newChild,null); + }else{ + return _appendSingleChild(this,newChild); + } + }, + setAttributeNode : function(newAttr){ + return this.attributes.setNamedItem(newAttr); + }, + setAttributeNodeNS : function(newAttr){ + return this.attributes.setNamedItemNS(newAttr); + }, + removeAttributeNode : function(oldAttr){ + //console.log(this == oldAttr.ownerElement) + return this.attributes.removeNamedItem(oldAttr.nodeName); + }, + //get real attribute name,and remove it by removeAttributeNode + removeAttributeNS : function(namespaceURI, localName){ + var old = this.getAttributeNodeNS(namespaceURI, localName); + old && this.removeAttributeNode(old); + }, + + hasAttributeNS : function(namespaceURI, localName){ + return this.getAttributeNodeNS(namespaceURI, localName)!=null; + }, + getAttributeNS : function(namespaceURI, localName){ + var attr = this.getAttributeNodeNS(namespaceURI, localName); + return attr && attr.value || ''; + }, + setAttributeNS : function(namespaceURI, qualifiedName, value){ + var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); + attr.value = attr.nodeValue = "" + value; + this.setAttributeNode(attr) + }, + getAttributeNodeNS : function(namespaceURI, localName){ + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + + getElementsByTagName : function(tagName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){ + ls.push(node); + } + }); + return ls; + }); + }, + getElementsByTagNameNS : function(namespaceURI, localName){ + return new LiveNodeList(this,function(base){ + var ls = []; + _visitNode(base,function(node){ + if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){ + ls.push(node); + } + }); + return ls; + + }); + } +}; +Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName; +Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; + + +_extends(Element,Node); +function Attr() { +}; +Attr.prototype.nodeType = ATTRIBUTE_NODE; +_extends(Attr,Node); + + +function CharacterData() { +}; +CharacterData.prototype = { + data : '', + substringData : function(offset, count) { + return this.data.substring(offset, offset+count); + }, + appendData: function(text) { + text = this.data+text; + this.nodeValue = this.data = text; + this.length = text.length; + }, + insertData: function(offset,text) { + this.replaceData(offset,0,text); + + }, + appendChild:function(newChild){ + throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]) + }, + deleteData: function(offset, count) { + this.replaceData(offset,count,""); + }, + replaceData: function(offset, count, text) { + var start = this.data.substring(0,offset); + var end = this.data.substring(offset+count); + text = start + text + end; + this.nodeValue = this.data = text; + this.length = text.length; + } +} +_extends(CharacterData,Node); +function Text() { +}; +Text.prototype = { + nodeName : "#text", + nodeType : TEXT_NODE, + splitText : function(offset) { + var text = this.data; + var newText = text.substring(offset); + text = text.substring(0, offset); + this.data = this.nodeValue = text; + this.length = text.length; + var newNode = this.ownerDocument.createTextNode(newText); + if(this.parentNode){ + this.parentNode.insertBefore(newNode, this.nextSibling); + } + return newNode; + } +} +_extends(Text,CharacterData); +function Comment() { +}; +Comment.prototype = { + nodeName : "#comment", + nodeType : COMMENT_NODE +} +_extends(Comment,CharacterData); + +function CDATASection() { +}; +CDATASection.prototype = { + nodeName : "#cdata-section", + nodeType : CDATA_SECTION_NODE +} +_extends(CDATASection,CharacterData); + + +function DocumentType() { +}; +DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; +_extends(DocumentType,Node); + +function Notation() { +}; +Notation.prototype.nodeType = NOTATION_NODE; +_extends(Notation,Node); + +function Entity() { +}; +Entity.prototype.nodeType = ENTITY_NODE; +_extends(Entity,Node); + +function EntityReference() { +}; +EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; +_extends(EntityReference,Node); + +function DocumentFragment() { +}; +DocumentFragment.prototype.nodeName = "#document-fragment"; +DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; +_extends(DocumentFragment,Node); + + +function ProcessingInstruction() { +} +ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; +_extends(ProcessingInstruction,Node); +function XMLSerializer(){} +XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){ + return nodeSerializeToString.call(node,isHtml,nodeFilter); +} +Node.prototype.toString = nodeSerializeToString; +function nodeSerializeToString(isHtml,nodeFilter){ + var buf = []; + var refNode = this.nodeType == 9 && this.documentElement || this; + var prefix = refNode.prefix; + var uri = refNode.namespaceURI; + + if(uri && prefix == null){ + //console.log(prefix) + var prefix = refNode.lookupPrefix(uri); + if(prefix == null){ + //isHTML = true; + var visibleNamespaces=[ + {namespace:uri,prefix:null} + //{namespace:uri,prefix:''} + ] + } + } + serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces); + //console.log('###',this.nodeType,uri,prefix,buf.join('')) + return buf.join(''); +} + +function needNamespaceDefine(node, isHTML, visibleNamespaces) { + var prefix = node.prefix || ''; + var uri = node.namespaceURI; + // According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) , + // and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl : + // > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty. + // in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using) + // and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared : + // > [...] Furthermore, the attribute value [...] must not be an empty string. + // so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document. + if (!uri) { + return false; + } + if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) { + return false; + } + + var i = visibleNamespaces.length + while (i--) { + var ns = visibleNamespaces[i]; + // get namespace prefix + if (ns.prefix === prefix) { + return ns.namespace !== uri; + } + } + return true; +} +/** + * Well-formed constraint: No < in Attribute Values + * > The replacement text of any entity referred to directly or indirectly + * > in an attribute value must not contain a <. + * @see https://www.w3.org/TR/xml11/#CleanAttrVals + * @see https://www.w3.org/TR/xml11/#NT-AttValue + * + * Literal whitespace other than space that appear in attribute values + * are serialized as their entity references, so they will be preserved. + * (In contrast to whitespace literals in the input which are normalized to spaces) + * @see https://www.w3.org/TR/xml11/#AVNormalize + * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes + */ +function addSerializedAttribute(buf, qualifiedName, value) { + buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"') +} + +function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ + if (!visibleNamespaces) { + visibleNamespaces = []; + } + + if(nodeFilter){ + node = nodeFilter(node); + if(node){ + if(typeof node == 'string'){ + buf.push(node); + return; + } + }else{ + return; + } + //buf.sort.apply(attrs, attributeSorter); + } + + switch(node.nodeType){ + case ELEMENT_NODE: + var attrs = node.attributes; + var len = attrs.length; + var child = node.firstChild; + var nodeName = node.tagName; + + isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML + + var prefixedNodeName = nodeName + if (!isHTML && !node.prefix && node.namespaceURI) { + var defaultNS + // lookup current default ns from `xmlns` attribute + for (var ai = 0; ai < attrs.length; ai++) { + if (attrs.item(ai).name === 'xmlns') { + defaultNS = attrs.item(ai).value + break + } + } + if (!defaultNS) { + // lookup current default ns in visibleNamespaces + for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) { + var namespace = visibleNamespaces[nsi] + if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) { + defaultNS = namespace.namespace + break + } + } + } + if (defaultNS !== node.namespaceURI) { + for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) { + var namespace = visibleNamespaces[nsi] + if (namespace.namespace === node.namespaceURI) { + if (namespace.prefix) { + prefixedNodeName = namespace.prefix + ':' + nodeName + } + break + } + } + } + } + + buf.push('<', prefixedNodeName); + + for(var i=0;i'); + //if is cdata child node + if(isHTML && /^script$/i.test(nodeName)){ + while(child){ + if(child.data){ + buf.push(child.data); + }else{ + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); + } + child = child.nextSibling; + } + }else + { + while(child){ + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); + child = child.nextSibling; + } + } + buf.push(''); + }else{ + buf.push('/>'); + } + // remove added visible namespaces + //visibleNamespaces.length = startVisibleNamespaces; + return; + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + var child = node.firstChild; + while(child){ + serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice()); + child = child.nextSibling; + } + return; + case ATTRIBUTE_NODE: + return addSerializedAttribute(buf, node.name, node.value); + case TEXT_NODE: + /** + * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, + * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. + * If they are needed elsewhere, they must be escaped using either numeric character references or the strings + * `&` and `<` respectively. + * The right angle bracket (>) may be represented using the string " > ", and must, for compatibility, + * be escaped using either `>` or a character reference when it appears in the string `]]>` in content, + * when that string is not marking the end of a CDATA section. + * + * In the content of elements, character data is any string of characters + * which does not contain the start-delimiter of any markup + * and does not include the CDATA-section-close delimiter, `]]>`. + * + * @see https://www.w3.org/TR/xml/#NT-CharData + * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node + */ + return buf.push(node.data + .replace(/[<&>]/g,_xmlEncoder) + ); + case CDATA_SECTION_NODE: + return buf.push( ''); + case COMMENT_NODE: + return buf.push( ""); + case DOCUMENT_TYPE_NODE: + var pubid = node.publicId; + var sysid = node.systemId; + buf.push(''); + }else if(sysid && sysid!='.'){ + buf.push(' SYSTEM ', sysid, '>'); + }else{ + var sub = node.internalSubset; + if(sub){ + buf.push(" [",sub,"]"); + } + buf.push(">"); + } + return; + case PROCESSING_INSTRUCTION_NODE: + return buf.push( ""); + case ENTITY_REFERENCE_NODE: + return buf.push( '&',node.nodeName,';'); + //case ENTITY_NODE: + //case NOTATION_NODE: + default: + buf.push('??',node.nodeName); + } +} +function importNode(doc,node,deep){ + var node2; + switch (node.nodeType) { + case ELEMENT_NODE: + node2 = node.cloneNode(false); + node2.ownerDocument = doc; + //var attrs = node2.attributes; + //var len = attrs.length; + //for(var i=0;i { + +"use strict"; + + +var freeze = (__webpack_require__(16996).freeze); + +/** + * The entities that are predefined in every XML document. + * + * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1 + * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0 + * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia + */ +exports.XML_ENTITIES = freeze({ + amp: '&', + apos: "'", + gt: '>', + lt: '<', + quot: '"', +}); + +/** + * A map of all entities that are detected in an HTML document. + * They contain all entries from `XML_ENTITIES`. + * + * @see XML_ENTITIES + * @see DOMParser.parseFromString + * @see DOMImplementation.prototype.createHTMLDocument + * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec + * @see https://html.spec.whatwg.org/entities.json JSON + * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names + * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML + * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML) + * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML) + */ +exports.HTML_ENTITIES = freeze({ + Aacute: '\u00C1', + aacute: '\u00E1', + Abreve: '\u0102', + abreve: '\u0103', + ac: '\u223E', + acd: '\u223F', + acE: '\u223E\u0333', + Acirc: '\u00C2', + acirc: '\u00E2', + acute: '\u00B4', + Acy: '\u0410', + acy: '\u0430', + AElig: '\u00C6', + aelig: '\u00E6', + af: '\u2061', + Afr: '\uD835\uDD04', + afr: '\uD835\uDD1E', + Agrave: '\u00C0', + agrave: '\u00E0', + alefsym: '\u2135', + aleph: '\u2135', + Alpha: '\u0391', + alpha: '\u03B1', + Amacr: '\u0100', + amacr: '\u0101', + amalg: '\u2A3F', + AMP: '\u0026', + amp: '\u0026', + And: '\u2A53', + 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: '\u0104', + aogon: '\u0105', + Aopf: '\uD835\uDD38', + aopf: '\uD835\uDD52', + ap: '\u2248', + apacir: '\u2A6F', + apE: '\u2A70', + ape: '\u224A', + apid: '\u224B', + apos: '\u0027', + ApplyFunction: '\u2061', + approx: '\u2248', + approxeq: '\u224A', + Aring: '\u00C5', + aring: '\u00E5', + Ascr: '\uD835\uDC9C', + ascr: '\uD835\uDCB6', + Assign: '\u2254', + ast: '\u002A', + asymp: '\u2248', + asympeq: '\u224D', + Atilde: '\u00C3', + atilde: '\u00E3', + Auml: '\u00C4', + auml: '\u00E4', + awconint: '\u2233', + awint: '\u2A11', + backcong: '\u224C', + backepsilon: '\u03F6', + backprime: '\u2035', + backsim: '\u223D', + backsimeq: '\u22CD', + Backslash: '\u2216', + Barv: '\u2AE7', + barvee: '\u22BD', + Barwed: '\u2306', + barwed: '\u2305', + barwedge: '\u2305', + bbrk: '\u23B5', + bbrktbrk: '\u23B6', + bcong: '\u224C', + Bcy: '\u0411', + bcy: '\u0431', + bdquo: '\u201E', + becaus: '\u2235', + Because: '\u2235', + because: '\u2235', + bemptyv: '\u29B0', + bepsi: '\u03F6', + bernou: '\u212C', + Bernoullis: '\u212C', + Beta: '\u0392', + beta: '\u03B2', + beth: '\u2136', + between: '\u226C', + Bfr: '\uD835\uDD05', + 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: '\u2AED', + bnot: '\u2310', + Bopf: '\uD835\uDD39', + bopf: '\uD835\uDD53', + bot: '\u22A5', + bottom: '\u22A5', + bowtie: '\u22C8', + boxbox: '\u29C9', + boxDL: '\u2557', + boxDl: '\u2556', + boxdL: '\u2555', + boxdl: '\u2510', + boxDR: '\u2554', + boxDr: '\u2553', + boxdR: '\u2552', + boxdr: '\u250C', + boxH: '\u2550', + boxh: '\u2500', + boxHD: '\u2566', + boxHd: '\u2564', + boxhD: '\u2565', + boxhd: '\u252C', + boxHU: '\u2569', + boxHu: '\u2567', + boxhU: '\u2568', + boxhu: '\u2534', + boxminus: '\u229F', + boxplus: '\u229E', + boxtimes: '\u22A0', + boxUL: '\u255D', + boxUl: '\u255C', + boxuL: '\u255B', + boxul: '\u2518', + boxUR: '\u255A', + boxUr: '\u2559', + boxuR: '\u2558', + boxur: '\u2514', + boxV: '\u2551', + boxv: '\u2502', + boxVH: '\u256C', + boxVh: '\u256B', + boxvH: '\u256A', + boxvh: '\u253C', + boxVL: '\u2563', + boxVl: '\u2562', + boxvL: '\u2561', + boxvl: '\u2524', + boxVR: '\u2560', + boxVr: '\u255F', + boxvR: '\u255E', + boxvr: '\u251C', + bprime: '\u2035', + Breve: '\u02D8', + breve: '\u02D8', + brvbar: '\u00A6', + Bscr: '\u212C', + 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: '\u224E', + bumpeq: '\u224F', + Cacute: '\u0106', + cacute: '\u0107', + Cap: '\u22D2', + cap: '\u2229', + capand: '\u2A44', + capbrcup: '\u2A49', + capcap: '\u2A4B', + capcup: '\u2A47', + capdot: '\u2A40', + CapitalDifferentialD: '\u2145', + caps: '\u2229\uFE00', + caret: '\u2041', + caron: '\u02C7', + Cayleys: '\u212D', + ccaps: '\u2A4D', + Ccaron: '\u010C', + ccaron: '\u010D', + Ccedil: '\u00C7', + ccedil: '\u00E7', + Ccirc: '\u0108', + ccirc: '\u0109', + Cconint: '\u2230', + ccups: '\u2A4C', + ccupssm: '\u2A50', + Cdot: '\u010A', + cdot: '\u010B', + cedil: '\u00B8', + Cedilla: '\u00B8', + cemptyv: '\u29B2', + cent: '\u00A2', + CenterDot: '\u00B7', + centerdot: '\u00B7', + Cfr: '\u212D', + cfr: '\uD835\uDD20', + CHcy: '\u0427', + chcy: '\u0447', + check: '\u2713', + checkmark: '\u2713', + Chi: '\u03A7', + chi: '\u03C7', + cir: '\u25CB', + circ: '\u02C6', + circeq: '\u2257', + circlearrowleft: '\u21BA', + circlearrowright: '\u21BB', + circledast: '\u229B', + circledcirc: '\u229A', + circleddash: '\u229D', + CircleDot: '\u2299', + circledR: '\u00AE', + circledS: '\u24C8', + CircleMinus: '\u2296', + CirclePlus: '\u2295', + CircleTimes: '\u2297', + cirE: '\u29C3', + cire: '\u2257', + cirfnint: '\u2A10', + cirmid: '\u2AEF', + cirscir: '\u29C2', + ClockwiseContourIntegral: '\u2232', + CloseCurlyDoubleQuote: '\u201D', + CloseCurlyQuote: '\u2019', + clubs: '\u2663', + clubsuit: '\u2663', + Colon: '\u2237', + colon: '\u003A', + Colone: '\u2A74', + colone: '\u2254', + coloneq: '\u2254', + comma: '\u002C', + commat: '\u0040', + comp: '\u2201', + compfn: '\u2218', + complement: '\u2201', + complexes: '\u2102', + cong: '\u2245', + congdot: '\u2A6D', + Congruent: '\u2261', + Conint: '\u222F', + conint: '\u222E', + ContourIntegral: '\u222E', + Copf: '\u2102', + copf: '\uD835\uDD54', + coprod: '\u2210', + Coproduct: '\u2210', + COPY: '\u00A9', + copy: '\u00A9', + copysr: '\u2117', + CounterClockwiseContourIntegral: '\u2233', + crarr: '\u21B5', + Cross: '\u2A2F', + cross: '\u2717', + Cscr: '\uD835\uDC9E', + 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: '\u22D3', + cup: '\u222A', + cupbrcap: '\u2A48', + CupCap: '\u224D', + 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', + Dagger: '\u2021', + dagger: '\u2020', + daleth: '\u2138', + Darr: '\u21A1', + dArr: '\u21D3', + darr: '\u2193', + dash: '\u2010', + Dashv: '\u2AE4', + dashv: '\u22A3', + dbkarow: '\u290F', + dblac: '\u02DD', + Dcaron: '\u010E', + dcaron: '\u010F', + Dcy: '\u0414', + dcy: '\u0434', + DD: '\u2145', + dd: '\u2146', + ddagger: '\u2021', + ddarr: '\u21CA', + DDotrahd: '\u2911', + ddotseq: '\u2A77', + deg: '\u00B0', + Del: '\u2207', + Delta: '\u0394', + delta: '\u03B4', + demptyv: '\u29B1', + dfisht: '\u297F', + Dfr: '\uD835\uDD07', + dfr: '\uD835\uDD21', + dHar: '\u2965', + dharl: '\u21C3', + dharr: '\u21C2', + DiacriticalAcute: '\u00B4', + DiacriticalDot: '\u02D9', + DiacriticalDoubleAcute: '\u02DD', + DiacriticalGrave: '\u0060', + DiacriticalTilde: '\u02DC', + diam: '\u22C4', + Diamond: '\u22C4', + diamond: '\u22C4', + diamondsuit: '\u2666', + diams: '\u2666', + die: '\u00A8', + DifferentialD: '\u2146', + digamma: '\u03DD', + disin: '\u22F2', + div: '\u00F7', + divide: '\u00F7', + divideontimes: '\u22C7', + divonx: '\u22C7', + DJcy: '\u0402', + djcy: '\u0452', + dlcorn: '\u231E', + dlcrop: '\u230D', + dollar: '\u0024', + Dopf: '\uD835\uDD3B', + dopf: '\uD835\uDD55', + Dot: '\u00A8', + dot: '\u02D9', + DotDot: '\u20DC', + doteq: '\u2250', + doteqdot: '\u2251', + DotEqual: '\u2250', + dotminus: '\u2238', + dotplus: '\u2214', + dotsquare: '\u22A1', + doublebarwedge: '\u2306', + 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', + Downarrow: '\u21D3', + downarrow: '\u2193', + DownArrowBar: '\u2913', + DownArrowUpArrow: '\u21F5', + DownBreve: '\u0311', + downdownarrows: '\u21CA', + downharpoonleft: '\u21C3', + downharpoonright: '\u21C2', + DownLeftRightVector: '\u2950', + DownLeftTeeVector: '\u295E', + DownLeftVector: '\u21BD', + DownLeftVectorBar: '\u2956', + DownRightTeeVector: '\u295F', + DownRightVector: '\u21C1', + DownRightVectorBar: '\u2957', + DownTee: '\u22A4', + DownTeeArrow: '\u21A7', + drbkarow: '\u2910', + drcorn: '\u231F', + drcrop: '\u230C', + Dscr: '\uD835\uDC9F', + dscr: '\uD835\uDCB9', + DScy: '\u0405', + dscy: '\u0455', + dsol: '\u29F6', + Dstrok: '\u0110', + dstrok: '\u0111', + dtdot: '\u22F1', + dtri: '\u25BF', + dtrif: '\u25BE', + duarr: '\u21F5', + duhar: '\u296F', + dwangle: '\u29A6', + DZcy: '\u040F', + dzcy: '\u045F', + dzigrarr: '\u27FF', + Eacute: '\u00C9', + eacute: '\u00E9', + easter: '\u2A6E', + Ecaron: '\u011A', + ecaron: '\u011B', + ecir: '\u2256', + Ecirc: '\u00CA', + ecirc: '\u00EA', + ecolon: '\u2255', + Ecy: '\u042D', + ecy: '\u044D', + eDDot: '\u2A77', + Edot: '\u0116', + eDot: '\u2251', + edot: '\u0117', + ee: '\u2147', + efDot: '\u2252', + Efr: '\uD835\uDD08', + efr: '\uD835\uDD22', + eg: '\u2A9A', + Egrave: '\u00C8', + egrave: '\u00E8', + egs: '\u2A96', + egsdot: '\u2A98', + el: '\u2A99', + Element: '\u2208', + elinters: '\u23E7', + ell: '\u2113', + els: '\u2A95', + elsdot: '\u2A97', + Emacr: '\u0112', + emacr: '\u0113', + empty: '\u2205', + emptyset: '\u2205', + EmptySmallSquare: '\u25FB', + emptyv: '\u2205', + EmptyVerySmallSquare: '\u25AB', + emsp: '\u2003', + emsp13: '\u2004', + emsp14: '\u2005', + ENG: '\u014A', + eng: '\u014B', + ensp: '\u2002', + Eogon: '\u0118', + eogon: '\u0119', + Eopf: '\uD835\uDD3C', + eopf: '\uD835\uDD56', + epar: '\u22D5', + eparsl: '\u29E3', + eplus: '\u2A71', + epsi: '\u03B5', + Epsilon: '\u0395', + epsilon: '\u03B5', + epsiv: '\u03F5', + eqcirc: '\u2256', + eqcolon: '\u2255', + eqsim: '\u2242', + eqslantgtr: '\u2A96', + eqslantless: '\u2A95', + Equal: '\u2A75', + equals: '\u003D', + EqualTilde: '\u2242', + equest: '\u225F', + Equilibrium: '\u21CC', + equiv: '\u2261', + equivDD: '\u2A78', + eqvparsl: '\u29E5', + erarr: '\u2971', + erDot: '\u2253', + Escr: '\u2130', + escr: '\u212F', + esdot: '\u2250', + Esim: '\u2A73', + esim: '\u2242', + Eta: '\u0397', + eta: '\u03B7', + ETH: '\u00D0', + eth: '\u00F0', + Euml: '\u00CB', + euml: '\u00EB', + euro: '\u20AC', + excl: '\u0021', + exist: '\u2203', + Exists: '\u2203', + expectation: '\u2130', + ExponentialE: '\u2147', + exponentiale: '\u2147', + fallingdotseq: '\u2252', + Fcy: '\u0424', + fcy: '\u0444', + female: '\u2640', + ffilig: '\uFB03', + fflig: '\uFB00', + ffllig: '\uFB04', + Ffr: '\uD835\uDD09', + ffr: '\uD835\uDD23', + filig: '\uFB01', + FilledSmallSquare: '\u25FC', + FilledVerySmallSquare: '\u25AA', + fjlig: '\u0066\u006A', + flat: '\u266D', + fllig: '\uFB02', + fltns: '\u25B1', + fnof: '\u0192', + Fopf: '\uD835\uDD3D', + fopf: '\uD835\uDD57', + ForAll: '\u2200', + forall: '\u2200', + fork: '\u22D4', + forkv: '\u2AD9', + Fouriertrf: '\u2131', + 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: '\u2131', + fscr: '\uD835\uDCBB', + gacute: '\u01F5', + Gamma: '\u0393', + gamma: '\u03B3', + Gammad: '\u03DC', + gammad: '\u03DD', + gap: '\u2A86', + Gbreve: '\u011E', + gbreve: '\u011F', + Gcedil: '\u0122', + Gcirc: '\u011C', + gcirc: '\u011D', + Gcy: '\u0413', + gcy: '\u0433', + Gdot: '\u0120', + gdot: '\u0121', + gE: '\u2267', + ge: '\u2265', + gEl: '\u2A8C', + 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\uDD0A', + gfr: '\uD835\uDD24', + Gg: '\u22D9', + gg: '\u226B', + ggg: '\u22D9', + gimel: '\u2137', + GJcy: '\u0403', + gjcy: '\u0453', + gl: '\u2277', + gla: '\u2AA5', + glE: '\u2A92', + glj: '\u2AA4', + gnap: '\u2A8A', + gnapprox: '\u2A8A', + gnE: '\u2269', + gne: '\u2A88', + gneq: '\u2A88', + gneqq: '\u2269', + gnsim: '\u22E7', + Gopf: '\uD835\uDD3E', + gopf: '\uD835\uDD58', + grave: '\u0060', + GreaterEqual: '\u2265', + GreaterEqualLess: '\u22DB', + GreaterFullEqual: '\u2267', + GreaterGreater: '\u2AA2', + GreaterLess: '\u2277', + GreaterSlantEqual: '\u2A7E', + GreaterTilde: '\u2273', + Gscr: '\uD835\uDCA2', + gscr: '\u210A', + gsim: '\u2273', + gsime: '\u2A8E', + gsiml: '\u2A90', + Gt: '\u226B', + GT: '\u003E', + 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', + Hacek: '\u02C7', + hairsp: '\u200A', + half: '\u00BD', + hamilt: '\u210B', + HARDcy: '\u042A', + hardcy: '\u044A', + hArr: '\u21D4', + harr: '\u2194', + harrcir: '\u2948', + harrw: '\u21AD', + Hat: '\u005E', + hbar: '\u210F', + Hcirc: '\u0124', + hcirc: '\u0125', + hearts: '\u2665', + heartsuit: '\u2665', + hellip: '\u2026', + hercon: '\u22B9', + Hfr: '\u210C', + hfr: '\uD835\uDD25', + HilbertSpace: '\u210B', + hksearow: '\u2925', + hkswarow: '\u2926', + hoarr: '\u21FF', + homtht: '\u223B', + hookleftarrow: '\u21A9', + hookrightarrow: '\u21AA', + Hopf: '\u210D', + hopf: '\uD835\uDD59', + horbar: '\u2015', + HorizontalLine: '\u2500', + Hscr: '\u210B', + hscr: '\uD835\uDCBD', + hslash: '\u210F', + Hstrok: '\u0126', + hstrok: '\u0127', + HumpDownHump: '\u224E', + HumpEqual: '\u224F', + hybull: '\u2043', + hyphen: '\u2010', + Iacute: '\u00CD', + iacute: '\u00ED', + ic: '\u2063', + Icirc: '\u00CE', + icirc: '\u00EE', + Icy: '\u0418', + icy: '\u0438', + Idot: '\u0130', + IEcy: '\u0415', + iecy: '\u0435', + iexcl: '\u00A1', + iff: '\u21D4', + Ifr: '\u2111', + ifr: '\uD835\uDD26', + Igrave: '\u00CC', + igrave: '\u00EC', + ii: '\u2148', + iiiint: '\u2A0C', + iiint: '\u222D', + iinfin: '\u29DC', + iiota: '\u2129', + IJlig: '\u0132', + ijlig: '\u0133', + Im: '\u2111', + Imacr: '\u012A', + imacr: '\u012B', + image: '\u2111', + ImaginaryI: '\u2148', + imagline: '\u2110', + imagpart: '\u2111', + imath: '\u0131', + imof: '\u22B7', + imped: '\u01B5', + Implies: '\u21D2', + in: '\u2208', + incare: '\u2105', + infin: '\u221E', + infintie: '\u29DD', + inodot: '\u0131', + Int: '\u222C', + int: '\u222B', + intcal: '\u22BA', + integers: '\u2124', + Integral: '\u222B', + intercal: '\u22BA', + Intersection: '\u22C2', + intlarhk: '\u2A17', + intprod: '\u2A3C', + InvisibleComma: '\u2063', + InvisibleTimes: '\u2062', + IOcy: '\u0401', + iocy: '\u0451', + Iogon: '\u012E', + iogon: '\u012F', + Iopf: '\uD835\uDD40', + iopf: '\uD835\uDD5A', + Iota: '\u0399', + iota: '\u03B9', + iprod: '\u2A3C', + iquest: '\u00BF', + Iscr: '\u2110', + iscr: '\uD835\uDCBE', + isin: '\u2208', + isindot: '\u22F5', + isinE: '\u22F9', + isins: '\u22F4', + isinsv: '\u22F3', + isinv: '\u2208', + it: '\u2062', + Itilde: '\u0128', + itilde: '\u0129', + Iukcy: '\u0406', + iukcy: '\u0456', + Iuml: '\u00CF', + iuml: '\u00EF', + Jcirc: '\u0134', + jcirc: '\u0135', + Jcy: '\u0419', + jcy: '\u0439', + Jfr: '\uD835\uDD0D', + jfr: '\uD835\uDD27', + jmath: '\u0237', + Jopf: '\uD835\uDD41', + jopf: '\uD835\uDD5B', + Jscr: '\uD835\uDCA5', + jscr: '\uD835\uDCBF', + Jsercy: '\u0408', + jsercy: '\u0458', + Jukcy: '\u0404', + jukcy: '\u0454', + Kappa: '\u039A', + kappa: '\u03BA', + kappav: '\u03F0', + Kcedil: '\u0136', + kcedil: '\u0137', + Kcy: '\u041A', + kcy: '\u043A', + Kfr: '\uD835\uDD0E', + kfr: '\uD835\uDD28', + kgreen: '\u0138', + KHcy: '\u0425', + khcy: '\u0445', + KJcy: '\u040C', + kjcy: '\u045C', + Kopf: '\uD835\uDD42', + kopf: '\uD835\uDD5C', + Kscr: '\uD835\uDCA6', + kscr: '\uD835\uDCC0', + lAarr: '\u21DA', + Lacute: '\u0139', + lacute: '\u013A', + laemptyv: '\u29B4', + lagran: '\u2112', + Lambda: '\u039B', + lambda: '\u03BB', + Lang: '\u27EA', + lang: '\u27E8', + langd: '\u2991', + langle: '\u27E8', + lap: '\u2A85', + Laplacetrf: '\u2112', + laquo: '\u00AB', + Larr: '\u219E', + lArr: '\u21D0', + larr: '\u2190', + larrb: '\u21E4', + larrbfs: '\u291F', + larrfs: '\u291D', + larrhk: '\u21A9', + larrlp: '\u21AB', + larrpl: '\u2939', + larrsim: '\u2973', + larrtl: '\u21A2', + lat: '\u2AAB', + lAtail: '\u291B', + latail: '\u2919', + late: '\u2AAD', + lates: '\u2AAD\uFE00', + lBarr: '\u290E', + lbarr: '\u290C', + lbbrk: '\u2772', + lbrace: '\u007B', + lbrack: '\u005B', + lbrke: '\u298B', + lbrksld: '\u298F', + lbrkslu: '\u298D', + Lcaron: '\u013D', + lcaron: '\u013E', + Lcedil: '\u013B', + lcedil: '\u013C', + lceil: '\u2308', + lcub: '\u007B', + Lcy: '\u041B', + lcy: '\u043B', + ldca: '\u2936', + ldquo: '\u201C', + ldquor: '\u201E', + ldrdhar: '\u2967', + ldrushar: '\u294B', + ldsh: '\u21B2', + lE: '\u2266', + le: '\u2264', + LeftAngleBracket: '\u27E8', + LeftArrow: '\u2190', + Leftarrow: '\u21D0', + leftarrow: '\u2190', + LeftArrowBar: '\u21E4', + LeftArrowRightArrow: '\u21C6', + leftarrowtail: '\u21A2', + LeftCeiling: '\u2308', + LeftDoubleBracket: '\u27E6', + LeftDownTeeVector: '\u2961', + LeftDownVector: '\u21C3', + LeftDownVectorBar: '\u2959', + LeftFloor: '\u230A', + leftharpoondown: '\u21BD', + leftharpoonup: '\u21BC', + leftleftarrows: '\u21C7', + LeftRightArrow: '\u2194', + Leftrightarrow: '\u21D4', + leftrightarrow: '\u2194', + leftrightarrows: '\u21C6', + leftrightharpoons: '\u21CB', + leftrightsquigarrow: '\u21AD', + LeftRightVector: '\u294E', + LeftTee: '\u22A3', + LeftTeeArrow: '\u21A4', + LeftTeeVector: '\u295A', + leftthreetimes: '\u22CB', + LeftTriangle: '\u22B2', + LeftTriangleBar: '\u29CF', + LeftTriangleEqual: '\u22B4', + LeftUpDownVector: '\u2951', + LeftUpTeeVector: '\u2960', + LeftUpVector: '\u21BF', + LeftUpVectorBar: '\u2958', + LeftVector: '\u21BC', + LeftVectorBar: '\u2952', + lEg: '\u2A8B', + 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', + LessEqualGreater: '\u22DA', + LessFullEqual: '\u2266', + LessGreater: '\u2276', + lessgtr: '\u2276', + LessLess: '\u2AA1', + lesssim: '\u2272', + LessSlantEqual: '\u2A7D', + LessTilde: '\u2272', + lfisht: '\u297C', + lfloor: '\u230A', + Lfr: '\uD835\uDD0F', + lfr: '\uD835\uDD29', + lg: '\u2276', + lgE: '\u2A91', + lHar: '\u2962', + lhard: '\u21BD', + lharu: '\u21BC', + lharul: '\u296A', + lhblk: '\u2584', + LJcy: '\u0409', + ljcy: '\u0459', + Ll: '\u22D8', + ll: '\u226A', + llarr: '\u21C7', + llcorner: '\u231E', + Lleftarrow: '\u21DA', + llhard: '\u296B', + lltri: '\u25FA', + Lmidot: '\u013F', + lmidot: '\u0140', + lmoust: '\u23B0', + lmoustache: '\u23B0', + lnap: '\u2A89', + lnapprox: '\u2A89', + lnE: '\u2268', + lne: '\u2A87', + lneq: '\u2A87', + lneqq: '\u2268', + lnsim: '\u22E6', + loang: '\u27EC', + loarr: '\u21FD', + lobrk: '\u27E6', + LongLeftArrow: '\u27F5', + Longleftarrow: '\u27F8', + longleftarrow: '\u27F5', + LongLeftRightArrow: '\u27F7', + Longleftrightarrow: '\u27FA', + longleftrightarrow: '\u27F7', + longmapsto: '\u27FC', + LongRightArrow: '\u27F6', + Longrightarrow: '\u27F9', + longrightarrow: '\u27F6', + looparrowleft: '\u21AB', + looparrowright: '\u21AC', + lopar: '\u2985', + Lopf: '\uD835\uDD43', + lopf: '\uD835\uDD5D', + loplus: '\u2A2D', + lotimes: '\u2A34', + lowast: '\u2217', + lowbar: '\u005F', + LowerLeftArrow: '\u2199', + LowerRightArrow: '\u2198', + 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: '\u2112', + lscr: '\uD835\uDCC1', + Lsh: '\u21B0', + lsh: '\u21B0', + lsim: '\u2272', + lsime: '\u2A8D', + lsimg: '\u2A8F', + lsqb: '\u005B', + lsquo: '\u2018', + lsquor: '\u201A', + Lstrok: '\u0141', + lstrok: '\u0142', + Lt: '\u226A', + LT: '\u003C', + lt: '\u003C', + ltcc: '\u2AA6', + ltcir: '\u2A79', + ltdot: '\u22D6', + lthree: '\u22CB', + ltimes: '\u22C9', + ltlarr: '\u2976', + ltquest: '\u2A7B', + ltri: '\u25C3', + ltrie: '\u22B4', + ltrif: '\u25C2', + ltrPar: '\u2996', + lurdshar: '\u294A', + luruhar: '\u2966', + lvertneqq: '\u2268\uFE00', + lvnE: '\u2268\uFE00', + macr: '\u00AF', + male: '\u2642', + malt: '\u2720', + maltese: '\u2720', + Map: '\u2905', + map: '\u21A6', + mapsto: '\u21A6', + mapstodown: '\u21A7', + mapstoleft: '\u21A4', + mapstoup: '\u21A5', + marker: '\u25AE', + mcomma: '\u2A29', + Mcy: '\u041C', + mcy: '\u043C', + mdash: '\u2014', + mDDot: '\u223A', + measuredangle: '\u2221', + MediumSpace: '\u205F', + Mellintrf: '\u2133', + Mfr: '\uD835\uDD10', + mfr: '\uD835\uDD2A', + mho: '\u2127', + micro: '\u00B5', + mid: '\u2223', + midast: '\u002A', + midcir: '\u2AF0', + middot: '\u00B7', + minus: '\u2212', + minusb: '\u229F', + minusd: '\u2238', + minusdu: '\u2A2A', + MinusPlus: '\u2213', + mlcp: '\u2ADB', + mldr: '\u2026', + mnplus: '\u2213', + models: '\u22A7', + Mopf: '\uD835\uDD44', + mopf: '\uD835\uDD5E', + mp: '\u2213', + Mscr: '\u2133', + mscr: '\uD835\uDCC2', + mstpos: '\u223E', + Mu: '\u039C', + mu: '\u03BC', + multimap: '\u22B8', + mumap: '\u22B8', + nabla: '\u2207', + Nacute: '\u0143', + 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: '\u0147', + ncaron: '\u0148', + Ncedil: '\u0145', + ncedil: '\u0146', + ncong: '\u2247', + ncongdot: '\u2A6D\u0338', + ncup: '\u2A42', + Ncy: '\u041D', + ncy: '\u043D', + ndash: '\u2013', + ne: '\u2260', + nearhk: '\u2924', + neArr: '\u21D7', + nearr: '\u2197', + nearrow: '\u2197', + nedot: '\u2250\u0338', + NegativeMediumSpace: '\u200B', + NegativeThickSpace: '\u200B', + NegativeThinSpace: '\u200B', + NegativeVeryThinSpace: '\u200B', + nequiv: '\u2262', + nesear: '\u2928', + nesim: '\u2242\u0338', + NestedGreaterGreater: '\u226B', + NestedLessLess: '\u226A', + NewLine: '\u000A', + nexist: '\u2204', + nexists: '\u2204', + Nfr: '\uD835\uDD11', + nfr: '\uD835\uDD2B', + ngE: '\u2267\u0338', + nge: '\u2271', + ngeq: '\u2271', + ngeqq: '\u2267\u0338', + ngeqslant: '\u2A7E\u0338', + nges: '\u2A7E\u0338', + nGg: '\u22D9\u0338', + ngsim: '\u2275', + nGt: '\u226B\u20D2', + ngt: '\u226F', + ngtr: '\u226F', + nGtv: '\u226B\u0338', + nhArr: '\u21CE', + nharr: '\u21AE', + nhpar: '\u2AF2', + ni: '\u220B', + nis: '\u22FC', + nisd: '\u22FA', + niv: '\u220B', + NJcy: '\u040A', + njcy: '\u045A', + nlArr: '\u21CD', + nlarr: '\u219A', + nldr: '\u2025', + nlE: '\u2266\u0338', + nle: '\u2270', + nLeftarrow: '\u21CD', + nleftarrow: '\u219A', + nLeftrightarrow: '\u21CE', + nleftrightarrow: '\u21AE', + nleq: '\u2270', + nleqq: '\u2266\u0338', + nleqslant: '\u2A7D\u0338', + nles: '\u2A7D\u0338', + nless: '\u226E', + nLl: '\u22D8\u0338', + nlsim: '\u2274', + nLt: '\u226A\u20D2', + nlt: '\u226E', + nltri: '\u22EA', + nltrie: '\u22EC', + nLtv: '\u226A\u0338', + nmid: '\u2224', + NoBreak: '\u2060', + NonBreakingSpace: '\u00A0', + Nopf: '\u2115', + nopf: '\uD835\uDD5F', + Not: '\u2AEC', + not: '\u00AC', + 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', + notin: '\u2209', + notindot: '\u22F5\u0338', + notinE: '\u22F9\u0338', + notinva: '\u2209', + notinvb: '\u22F7', + notinvc: '\u22F6', + 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', + notni: '\u220C', + notniva: '\u220C', + notnivb: '\u22FE', + notnivc: '\u22FD', + 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', + 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: '\u21CF', + nrightarrow: '\u219B', + nrtri: '\u22EB', + nrtrie: '\u22ED', + nsc: '\u2281', + nsccue: '\u22E1', + nsce: '\u2AB0\u0338', + Nscr: '\uD835\uDCA9', + 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: '\u00D1', + ntilde: '\u00F1', + ntlg: '\u2278', + ntriangleleft: '\u22EA', + ntrianglelefteq: '\u22EC', + ntriangleright: '\u22EB', + ntrianglerighteq: '\u22ED', + Nu: '\u039D', + nu: '\u03BD', + num: '\u0023', + numero: '\u2116', + numsp: '\u2007', + nvap: '\u224D\u20D2', + nVDash: '\u22AF', + nVdash: '\u22AE', + nvDash: '\u22AD', + nvdash: '\u22AC', + nvge: '\u2265\u20D2', + nvgt: '\u003E\u20D2', + nvHarr: '\u2904', + nvinfin: '\u29DE', + nvlArr: '\u2902', + nvle: '\u2264\u20D2', + nvlt: '\u003C\u20D2', + nvltrie: '\u22B4\u20D2', + nvrArr: '\u2903', + nvrtrie: '\u22B5\u20D2', + nvsim: '\u223C\u20D2', + nwarhk: '\u2923', + nwArr: '\u21D6', + nwarr: '\u2196', + nwarrow: '\u2196', + nwnear: '\u2927', + Oacute: '\u00D3', + oacute: '\u00F3', + oast: '\u229B', + ocir: '\u229A', + Ocirc: '\u00D4', + ocirc: '\u00F4', + Ocy: '\u041E', + ocy: '\u043E', + odash: '\u229D', + Odblac: '\u0150', + odblac: '\u0151', + odiv: '\u2A38', + odot: '\u2299', + odsold: '\u29BC', + OElig: '\u0152', + oelig: '\u0153', + ofcir: '\u29BF', + Ofr: '\uD835\uDD12', + ofr: '\uD835\uDD2C', + ogon: '\u02DB', + Ograve: '\u00D2', + ograve: '\u00F2', + ogt: '\u29C1', + ohbar: '\u29B5', + ohm: '\u03A9', + oint: '\u222E', + olarr: '\u21BA', + olcir: '\u29BE', + olcross: '\u29BB', + oline: '\u203E', + olt: '\u29C0', + Omacr: '\u014C', + omacr: '\u014D', + Omega: '\u03A9', + omega: '\u03C9', + Omicron: '\u039F', + omicron: '\u03BF', + omid: '\u29B6', + ominus: '\u2296', + Oopf: '\uD835\uDD46', + oopf: '\uD835\uDD60', + opar: '\u29B7', + OpenCurlyDoubleQuote: '\u201C', + OpenCurlyQuote: '\u2018', + operp: '\u29B9', + oplus: '\u2295', + Or: '\u2A54', + or: '\u2228', + orarr: '\u21BB', + ord: '\u2A5D', + order: '\u2134', + orderof: '\u2134', + ordf: '\u00AA', + ordm: '\u00BA', + origof: '\u22B6', + oror: '\u2A56', + orslope: '\u2A57', + orv: '\u2A5B', + oS: '\u24C8', + Oscr: '\uD835\uDCAA', + oscr: '\u2134', + Oslash: '\u00D8', + oslash: '\u00F8', + osol: '\u2298', + Otilde: '\u00D5', + otilde: '\u00F5', + Otimes: '\u2A37', + otimes: '\u2297', + otimesas: '\u2A36', + Ouml: '\u00D6', + ouml: '\u00F6', + ovbar: '\u233D', + OverBar: '\u203E', + OverBrace: '\u23DE', + OverBracket: '\u23B4', + OverParenthesis: '\u23DC', + par: '\u2225', + para: '\u00B6', + parallel: '\u2225', + parsim: '\u2AF3', + parsl: '\u2AFD', + part: '\u2202', + PartialD: '\u2202', + Pcy: '\u041F', + pcy: '\u043F', + percnt: '\u0025', + period: '\u002E', + permil: '\u2030', + perp: '\u22A5', + pertenk: '\u2031', + Pfr: '\uD835\uDD13', + pfr: '\uD835\uDD2D', + Phi: '\u03A6', + phi: '\u03C6', + phiv: '\u03D5', + phmmat: '\u2133', + phone: '\u260E', + Pi: '\u03A0', + 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', + PlusMinus: '\u00B1', + plusmn: '\u00B1', + plussim: '\u2A26', + plustwo: '\u2A27', + pm: '\u00B1', + Poincareplane: '\u210C', + pointint: '\u2A15', + Popf: '\u2119', + popf: '\uD835\uDD61', + pound: '\u00A3', + Pr: '\u2ABB', + pr: '\u227A', + prap: '\u2AB7', + prcue: '\u227C', + prE: '\u2AB3', + pre: '\u2AAF', + prec: '\u227A', + precapprox: '\u2AB7', + preccurlyeq: '\u227C', + Precedes: '\u227A', + PrecedesEqual: '\u2AAF', + PrecedesSlantEqual: '\u227C', + PrecedesTilde: '\u227E', + preceq: '\u2AAF', + precnapprox: '\u2AB9', + precneqq: '\u2AB5', + precnsim: '\u22E8', + precsim: '\u227E', + Prime: '\u2033', + prime: '\u2032', + primes: '\u2119', + prnap: '\u2AB9', + prnE: '\u2AB5', + prnsim: '\u22E8', + prod: '\u220F', + Product: '\u220F', + profalar: '\u232E', + profline: '\u2312', + profsurf: '\u2313', + prop: '\u221D', + Proportion: '\u2237', + Proportional: '\u221D', + propto: '\u221D', + prsim: '\u227E', + prurel: '\u22B0', + Pscr: '\uD835\uDCAB', + pscr: '\uD835\uDCC5', + Psi: '\u03A8', + psi: '\u03C8', + puncsp: '\u2008', + Qfr: '\uD835\uDD14', + qfr: '\uD835\uDD2E', + qint: '\u2A0C', + Qopf: '\u211A', + qopf: '\uD835\uDD62', + qprime: '\u2057', + Qscr: '\uD835\uDCAC', + qscr: '\uD835\uDCC6', + quaternions: '\u210D', + quatint: '\u2A16', + quest: '\u003F', + questeq: '\u225F', + QUOT: '\u0022', + quot: '\u0022', + rAarr: '\u21DB', + race: '\u223D\u0331', + Racute: '\u0154', + racute: '\u0155', + radic: '\u221A', + raemptyv: '\u29B3', + Rang: '\u27EB', + rang: '\u27E9', + rangd: '\u2992', + range: '\u29A5', + rangle: '\u27E9', + raquo: '\u00BB', + Rarr: '\u21A0', + rArr: '\u21D2', + rarr: '\u2192', + rarrap: '\u2975', + rarrb: '\u21E5', + rarrbfs: '\u2920', + rarrc: '\u2933', + rarrfs: '\u291E', + rarrhk: '\u21AA', + rarrlp: '\u21AC', + rarrpl: '\u2945', + rarrsim: '\u2974', + Rarrtl: '\u2916', + rarrtl: '\u21A3', + rarrw: '\u219D', + rAtail: '\u291C', + ratail: '\u291A', + ratio: '\u2236', + rationals: '\u211A', + RBarr: '\u2910', + rBarr: '\u290F', + rbarr: '\u290D', + rbbrk: '\u2773', + rbrace: '\u007D', + rbrack: '\u005D', + rbrke: '\u298C', + rbrksld: '\u298E', + rbrkslu: '\u2990', + Rcaron: '\u0158', + rcaron: '\u0159', + Rcedil: '\u0156', + rcedil: '\u0157', + rceil: '\u2309', + rcub: '\u007D', + Rcy: '\u0420', + rcy: '\u0440', + rdca: '\u2937', + rdldhar: '\u2969', + rdquo: '\u201D', + rdquor: '\u201D', + rdsh: '\u21B3', + Re: '\u211C', + real: '\u211C', + realine: '\u211B', + realpart: '\u211C', + reals: '\u211D', + rect: '\u25AD', + REG: '\u00AE', + reg: '\u00AE', + ReverseElement: '\u220B', + ReverseEquilibrium: '\u21CB', + ReverseUpEquilibrium: '\u296F', + rfisht: '\u297D', + rfloor: '\u230B', + Rfr: '\u211C', + rfr: '\uD835\uDD2F', + rHar: '\u2964', + rhard: '\u21C1', + rharu: '\u21C0', + rharul: '\u296C', + Rho: '\u03A1', + rho: '\u03C1', + rhov: '\u03F1', + RightAngleBracket: '\u27E9', + RightArrow: '\u2192', + Rightarrow: '\u21D2', + rightarrow: '\u2192', + RightArrowBar: '\u21E5', + RightArrowLeftArrow: '\u21C4', + rightarrowtail: '\u21A3', + RightCeiling: '\u2309', + RightDoubleBracket: '\u27E7', + RightDownTeeVector: '\u295D', + RightDownVector: '\u21C2', + RightDownVectorBar: '\u2955', + RightFloor: '\u230B', + rightharpoondown: '\u21C1', + rightharpoonup: '\u21C0', + rightleftarrows: '\u21C4', + rightleftharpoons: '\u21CC', + rightrightarrows: '\u21C9', + rightsquigarrow: '\u219D', + RightTee: '\u22A2', + RightTeeArrow: '\u21A6', + RightTeeVector: '\u295B', + rightthreetimes: '\u22CC', + RightTriangle: '\u22B3', + RightTriangleBar: '\u29D0', + RightTriangleEqual: '\u22B5', + RightUpDownVector: '\u294F', + RightUpTeeVector: '\u295C', + RightUpVector: '\u21BE', + RightUpVectorBar: '\u2954', + RightVector: '\u21C0', + RightVectorBar: '\u2953', + 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: '\u211D', + ropf: '\uD835\uDD63', + roplus: '\u2A2E', + rotimes: '\u2A35', + RoundImplies: '\u2970', + rpar: '\u0029', + rpargt: '\u2994', + rppolint: '\u2A12', + rrarr: '\u21C9', + Rrightarrow: '\u21DB', + rsaquo: '\u203A', + Rscr: '\u211B', + rscr: '\uD835\uDCC7', + Rsh: '\u21B1', + rsh: '\u21B1', + rsqb: '\u005D', + rsquo: '\u2019', + rsquor: '\u2019', + rthree: '\u22CC', + rtimes: '\u22CA', + rtri: '\u25B9', + rtrie: '\u22B5', + rtrif: '\u25B8', + rtriltri: '\u29CE', + RuleDelayed: '\u29F4', + ruluhar: '\u2968', + rx: '\u211E', + Sacute: '\u015A', + sacute: '\u015B', + sbquo: '\u201A', + Sc: '\u2ABC', + sc: '\u227B', + scap: '\u2AB8', + Scaron: '\u0160', + scaron: '\u0161', + sccue: '\u227D', + scE: '\u2AB4', + sce: '\u2AB0', + Scedil: '\u015E', + scedil: '\u015F', + Scirc: '\u015C', + scirc: '\u015D', + scnap: '\u2ABA', + scnE: '\u2AB6', + scnsim: '\u22E9', + scpolint: '\u2A13', + scsim: '\u227F', + Scy: '\u0421', + scy: '\u0441', + sdot: '\u22C5', + sdotb: '\u22A1', + sdote: '\u2A66', + searhk: '\u2925', + seArr: '\u21D8', + searr: '\u2198', + searrow: '\u2198', + sect: '\u00A7', + semi: '\u003B', + seswar: '\u2929', + setminus: '\u2216', + setmn: '\u2216', + sext: '\u2736', + Sfr: '\uD835\uDD16', + sfr: '\uD835\uDD30', + sfrown: '\u2322', + sharp: '\u266F', + SHCHcy: '\u0429', + shchcy: '\u0449', + SHcy: '\u0428', + shcy: '\u0448', + ShortDownArrow: '\u2193', + ShortLeftArrow: '\u2190', + shortmid: '\u2223', + shortparallel: '\u2225', + ShortRightArrow: '\u2192', + ShortUpArrow: '\u2191', + shy: '\u00AD', + Sigma: '\u03A3', + 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', + SmallCircle: '\u2218', + smallsetminus: '\u2216', + smashp: '\u2A33', + smeparsl: '\u29E4', + smid: '\u2223', + smile: '\u2323', + smt: '\u2AAA', + smte: '\u2AAC', + smtes: '\u2AAC\uFE00', + SOFTcy: '\u042C', + softcy: '\u044C', + sol: '\u002F', + solb: '\u29C4', + solbar: '\u233F', + Sopf: '\uD835\uDD4A', + sopf: '\uD835\uDD64', + spades: '\u2660', + spadesuit: '\u2660', + spar: '\u2225', + sqcap: '\u2293', + sqcaps: '\u2293\uFE00', + sqcup: '\u2294', + sqcups: '\u2294\uFE00', + Sqrt: '\u221A', + sqsub: '\u228F', + sqsube: '\u2291', + sqsubset: '\u228F', + sqsubseteq: '\u2291', + sqsup: '\u2290', + sqsupe: '\u2292', + sqsupset: '\u2290', + sqsupseteq: '\u2292', + squ: '\u25A1', + Square: '\u25A1', + square: '\u25A1', + SquareIntersection: '\u2293', + SquareSubset: '\u228F', + SquareSubsetEqual: '\u2291', + SquareSuperset: '\u2290', + SquareSupersetEqual: '\u2292', + SquareUnion: '\u2294', + squarf: '\u25AA', + squf: '\u25AA', + srarr: '\u2192', + Sscr: '\uD835\uDCAE', + sscr: '\uD835\uDCC8', + ssetmn: '\u2216', + ssmile: '\u2323', + sstarf: '\u22C6', + Star: '\u22C6', + star: '\u2606', + starf: '\u2605', + straightepsilon: '\u03F5', + straightphi: '\u03D5', + strns: '\u00AF', + Sub: '\u22D0', + sub: '\u2282', + subdot: '\u2ABD', + subE: '\u2AC5', + sube: '\u2286', + subedot: '\u2AC3', + submult: '\u2AC1', + subnE: '\u2ACB', + subne: '\u228A', + subplus: '\u2ABF', + subrarr: '\u2979', + Subset: '\u22D0', + subset: '\u2282', + subseteq: '\u2286', + subseteqq: '\u2AC5', + SubsetEqual: '\u2286', + subsetneq: '\u228A', + subsetneqq: '\u2ACB', + subsim: '\u2AC7', + subsub: '\u2AD5', + subsup: '\u2AD3', + succ: '\u227B', + succapprox: '\u2AB8', + succcurlyeq: '\u227D', + Succeeds: '\u227B', + SucceedsEqual: '\u2AB0', + SucceedsSlantEqual: '\u227D', + SucceedsTilde: '\u227F', + succeq: '\u2AB0', + succnapprox: '\u2ABA', + succneqq: '\u2AB6', + succnsim: '\u22E9', + succsim: '\u227F', + SuchThat: '\u220B', + Sum: '\u2211', + sum: '\u2211', + sung: '\u266A', + Sup: '\u22D1', + sup: '\u2283', + sup1: '\u00B9', + sup2: '\u00B2', + sup3: '\u00B3', + supdot: '\u2ABE', + supdsub: '\u2AD8', + supE: '\u2AC6', + supe: '\u2287', + supedot: '\u2AC4', + Superset: '\u2283', + SupersetEqual: '\u2287', + suphsol: '\u27C9', + suphsub: '\u2AD7', + suplarr: '\u297B', + supmult: '\u2AC2', + supnE: '\u2ACC', + supne: '\u228B', + supplus: '\u2AC0', + Supset: '\u22D1', + supset: '\u2283', + supseteq: '\u2287', + supseteqq: '\u2AC6', + supsetneq: '\u228B', + supsetneqq: '\u2ACC', + supsim: '\u2AC8', + supsub: '\u2AD4', + supsup: '\u2AD6', + swarhk: '\u2926', + swArr: '\u21D9', + swarr: '\u2199', + swarrow: '\u2199', + swnwar: '\u292A', + szlig: '\u00DF', + Tab: '\u0009', + target: '\u2316', + Tau: '\u03A4', + tau: '\u03C4', + tbrk: '\u23B4', + Tcaron: '\u0164', + tcaron: '\u0165', + Tcedil: '\u0162', + tcedil: '\u0163', + Tcy: '\u0422', + tcy: '\u0442', + tdot: '\u20DB', + telrec: '\u2315', + Tfr: '\uD835\uDD17', + tfr: '\uD835\uDD31', + there4: '\u2234', + Therefore: '\u2234', + therefore: '\u2234', + Theta: '\u0398', + theta: '\u03B8', + thetasym: '\u03D1', + thetav: '\u03D1', + thickapprox: '\u2248', + thicksim: '\u223C', + ThickSpace: '\u205F\u200A', + thinsp: '\u2009', + ThinSpace: '\u2009', + thkap: '\u2248', + thksim: '\u223C', + THORN: '\u00DE', + thorn: '\u00FE', + Tilde: '\u223C', + tilde: '\u02DC', + TildeEqual: '\u2243', + TildeFullEqual: '\u2245', + TildeTilde: '\u2248', + times: '\u00D7', + timesb: '\u22A0', + timesbar: '\u2A31', + timesd: '\u2A30', + tint: '\u222D', + toea: '\u2928', + top: '\u22A4', + topbot: '\u2336', + topcir: '\u2AF1', + Topf: '\uD835\uDD4B', + topf: '\uD835\uDD65', + topfork: '\u2ADA', + tosa: '\u2929', + tprime: '\u2034', + TRADE: '\u2122', + trade: '\u2122', + triangle: '\u25B5', + triangledown: '\u25BF', + triangleleft: '\u25C3', + trianglelefteq: '\u22B4', + triangleq: '\u225C', + triangleright: '\u25B9', + trianglerighteq: '\u22B5', + tridot: '\u25EC', + trie: '\u225C', + triminus: '\u2A3A', + TripleDot: '\u20DB', + triplus: '\u2A39', + trisb: '\u29CD', + tritime: '\u2A3B', + trpezium: '\u23E2', + Tscr: '\uD835\uDCAF', + tscr: '\uD835\uDCC9', + TScy: '\u0426', + tscy: '\u0446', + TSHcy: '\u040B', + tshcy: '\u045B', + Tstrok: '\u0166', + tstrok: '\u0167', + twixt: '\u226C', + twoheadleftarrow: '\u219E', + twoheadrightarrow: '\u21A0', + Uacute: '\u00DA', + uacute: '\u00FA', + Uarr: '\u219F', + uArr: '\u21D1', + uarr: '\u2191', + Uarrocir: '\u2949', + Ubrcy: '\u040E', + ubrcy: '\u045E', + Ubreve: '\u016C', + ubreve: '\u016D', + Ucirc: '\u00DB', + ucirc: '\u00FB', + Ucy: '\u0423', + ucy: '\u0443', + udarr: '\u21C5', + Udblac: '\u0170', + udblac: '\u0171', + udhar: '\u296E', + ufisht: '\u297E', + Ufr: '\uD835\uDD18', + ufr: '\uD835\uDD32', + Ugrave: '\u00D9', + ugrave: '\u00F9', + uHar: '\u2963', + uharl: '\u21BF', + uharr: '\u21BE', + uhblk: '\u2580', + ulcorn: '\u231C', + ulcorner: '\u231C', + ulcrop: '\u230F', + ultri: '\u25F8', + Umacr: '\u016A', + umacr: '\u016B', + uml: '\u00A8', + UnderBar: '\u005F', + UnderBrace: '\u23DF', + UnderBracket: '\u23B5', + UnderParenthesis: '\u23DD', + Union: '\u22C3', + UnionPlus: '\u228E', + Uogon: '\u0172', + uogon: '\u0173', + Uopf: '\uD835\uDD4C', + uopf: '\uD835\uDD66', + UpArrow: '\u2191', + Uparrow: '\u21D1', + uparrow: '\u2191', + UpArrowBar: '\u2912', + UpArrowDownArrow: '\u21C5', + UpDownArrow: '\u2195', + Updownarrow: '\u21D5', + updownarrow: '\u2195', + UpEquilibrium: '\u296E', + upharpoonleft: '\u21BF', + upharpoonright: '\u21BE', + uplus: '\u228E', + UpperLeftArrow: '\u2196', + UpperRightArrow: '\u2197', + Upsi: '\u03D2', + upsi: '\u03C5', + upsih: '\u03D2', + Upsilon: '\u03A5', + upsilon: '\u03C5', + UpTee: '\u22A5', + UpTeeArrow: '\u21A5', + upuparrows: '\u21C8', + urcorn: '\u231D', + urcorner: '\u231D', + urcrop: '\u230E', + Uring: '\u016E', + uring: '\u016F', + urtri: '\u25F9', + Uscr: '\uD835\uDCB0', + uscr: '\uD835\uDCCA', + utdot: '\u22F0', + Utilde: '\u0168', + utilde: '\u0169', + utri: '\u25B5', + utrif: '\u25B4', + uuarr: '\u21C8', + Uuml: '\u00DC', + uuml: '\u00FC', + uwangle: '\u29A7', + vangrt: '\u299C', + varepsilon: '\u03F5', + varkappa: '\u03F0', + varnothing: '\u2205', + varphi: '\u03D5', + varpi: '\u03D6', + varpropto: '\u221D', + vArr: '\u21D5', + varr: '\u2195', + varrho: '\u03F1', + varsigma: '\u03C2', + varsubsetneq: '\u228A\uFE00', + varsubsetneqq: '\u2ACB\uFE00', + varsupsetneq: '\u228B\uFE00', + varsupsetneqq: '\u2ACC\uFE00', + vartheta: '\u03D1', + vartriangleleft: '\u22B2', + vartriangleright: '\u22B3', + Vbar: '\u2AEB', + vBar: '\u2AE8', + vBarv: '\u2AE9', + Vcy: '\u0412', + vcy: '\u0432', + VDash: '\u22AB', + Vdash: '\u22A9', + vDash: '\u22A8', + vdash: '\u22A2', + Vdashl: '\u2AE6', + Vee: '\u22C1', + vee: '\u2228', + veebar: '\u22BB', + veeeq: '\u225A', + vellip: '\u22EE', + Verbar: '\u2016', + verbar: '\u007C', + Vert: '\u2016', + vert: '\u007C', + VerticalBar: '\u2223', + VerticalLine: '\u007C', + VerticalSeparator: '\u2758', + VerticalTilde: '\u2240', + VeryThinSpace: '\u200A', + Vfr: '\uD835\uDD19', + vfr: '\uD835\uDD33', + vltri: '\u22B2', + vnsub: '\u2282\u20D2', + vnsup: '\u2283\u20D2', + Vopf: '\uD835\uDD4D', + vopf: '\uD835\uDD67', + vprop: '\u221D', + vrtri: '\u22B3', + Vscr: '\uD835\uDCB1', + vscr: '\uD835\uDCCB', + vsubnE: '\u2ACB\uFE00', + vsubne: '\u228A\uFE00', + vsupnE: '\u2ACC\uFE00', + vsupne: '\u228B\uFE00', + Vvdash: '\u22AA', + vzigzag: '\u299A', + Wcirc: '\u0174', + wcirc: '\u0175', + wedbar: '\u2A5F', + Wedge: '\u22C0', + wedge: '\u2227', + wedgeq: '\u2259', + weierp: '\u2118', + Wfr: '\uD835\uDD1A', + wfr: '\uD835\uDD34', + Wopf: '\uD835\uDD4E', + wopf: '\uD835\uDD68', + wp: '\u2118', + wr: '\u2240', + wreath: '\u2240', + Wscr: '\uD835\uDCB2', + wscr: '\uD835\uDCCC', + xcap: '\u22C2', + xcirc: '\u25EF', + xcup: '\u22C3', + xdtri: '\u25BD', + Xfr: '\uD835\uDD1B', + xfr: '\uD835\uDD35', + xhArr: '\u27FA', + xharr: '\u27F7', + Xi: '\u039E', + xi: '\u03BE', + xlArr: '\u27F8', + xlarr: '\u27F5', + xmap: '\u27FC', + xnis: '\u22FB', + xodot: '\u2A00', + Xopf: '\uD835\uDD4F', + xopf: '\uD835\uDD69', + xoplus: '\u2A01', + xotime: '\u2A02', + xrArr: '\u27F9', + xrarr: '\u27F6', + Xscr: '\uD835\uDCB3', + xscr: '\uD835\uDCCD', + xsqcup: '\u2A06', + xuplus: '\u2A04', + xutri: '\u25B3', + xvee: '\u22C1', + xwedge: '\u22C0', + Yacute: '\u00DD', + yacute: '\u00FD', + YAcy: '\u042F', + yacy: '\u044F', + Ycirc: '\u0176', + ycirc: '\u0177', + Ycy: '\u042B', + ycy: '\u044B', + yen: '\u00A5', + Yfr: '\uD835\uDD1C', + yfr: '\uD835\uDD36', + YIcy: '\u0407', + yicy: '\u0457', + Yopf: '\uD835\uDD50', + yopf: '\uD835\uDD6A', + Yscr: '\uD835\uDCB4', + yscr: '\uD835\uDCCE', + YUcy: '\u042E', + yucy: '\u044E', + Yuml: '\u0178', + yuml: '\u00FF', + Zacute: '\u0179', + zacute: '\u017A', + Zcaron: '\u017D', + zcaron: '\u017E', + Zcy: '\u0417', + zcy: '\u0437', + Zdot: '\u017B', + zdot: '\u017C', + zeetrf: '\u2128', + ZeroWidthSpace: '\u200B', + Zeta: '\u0396', + zeta: '\u03B6', + Zfr: '\u2128', + zfr: '\uD835\uDD37', + ZHcy: '\u0416', + zhcy: '\u0436', + zigrarr: '\u21DD', + Zopf: '\u2124', + zopf: '\uD835\uDD6B', + Zscr: '\uD835\uDCB5', + zscr: '\uD835\uDCCF', + zwj: '\u200D', + zwnj: '\u200C', +}); + +/** + * @deprecated use `HTML_ENTITIES` instead + * @see HTML_ENTITIES + */ +exports.entityMap = exports.HTML_ENTITIES; + + +/***/ }), + +/***/ 11544: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var __webpack_unused_export__; +var dom = __webpack_require__(71855) +__webpack_unused_export__ = dom.DOMImplementation +__webpack_unused_export__ = dom.XMLSerializer +exports.DOMParser = __webpack_require__(40654).DOMParser + + +/***/ }), + +/***/ 13418: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var NAMESPACE = (__webpack_require__(16996).NAMESPACE); + +//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +//[5] Name ::= NameStartChar (NameChar)* +var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF +var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); +var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); +//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ +//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') + +//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE +//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE +var S_TAG = 0;//tag name offerring +var S_ATTR = 1;//attr name offerring +var S_ATTR_SPACE=2;//attr name end and space offer +var S_EQ = 3;//=space? +var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only) +var S_ATTR_END = 5;//attr value end and no space(quot end) +var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer) +var S_TAG_CLOSE = 7;//closed el + +/** + * Creates an error that will not be caught by XMLReader aka the SAX parser. + * + * @param {string} message + * @param {any?} locator Optional, can provide details about the location in the source + * @constructor + */ +function ParseError(message, locator) { + this.message = message + this.locator = locator + if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError); +} +ParseError.prototype = new Error(); +ParseError.prototype.name = ParseError.name + +function XMLReader(){ + +} + +XMLReader.prototype = { + parse:function(source,defaultNSMap,entityMap){ + var domBuilder = this.domBuilder; + domBuilder.startDocument(); + _copy(defaultNSMap ,defaultNSMap = {}) + parse(source,defaultNSMap,entityMap, + domBuilder,this.errorHandler); + domBuilder.endDocument(); + } +} +function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ + function fixedFromCharCode(code) { + // String.prototype.fromCharCode does not supports + // > 2 bytes unicode chars directly + if (code > 0xffff) { + code -= 0x10000; + var surrogate1 = 0xd800 + (code >> 10) + , surrogate2 = 0xdc00 + (code & 0x3ff); + + return String.fromCharCode(surrogate1, surrogate2); + } else { + return String.fromCharCode(code); + } + } + function entityReplacer(a){ + var k = a.slice(1,-1); + if (Object.hasOwnProperty.call(entityMap, k)) { + return entityMap[k]; + }else if(k.charAt(0) === '#'){ + return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) + }else{ + errorHandler.error('entity not found:'+a); + return a; + } + } + function appendText(end){//has some bugs + if(end>start){ + var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); + locator&&position(start); + domBuilder.characters(xt,0,end-start); + start = end + } + } + function position(p,m){ + while(p>=lineEnd && (m = linePattern.exec(source))){ + lineStart = m.index; + lineEnd = lineStart + m[0].length; + locator.lineNumber++; + //console.log('line++:',locator,startPos,endPos) + } + locator.columnNumber = p-lineStart+1; + } + var lineStart = 0; + var lineEnd = 0; + var linePattern = /.*(?:\r\n?|\n)|.*$/g + var locator = domBuilder.locator; + + var parseStack = [{currentNSMap:defaultNSMapCopy}] + var closeMap = {}; + var start = 0; + while(true){ + try{ + var tagStart = source.indexOf('<',start); + if(tagStart<0){ + if(!source.substr(start).match(/^\s*$/)){ + var doc = domBuilder.doc; + var text = doc.createTextNode(source.substr(start)); + doc.appendChild(text); + domBuilder.currentElement = text; + } + return; + } + if(tagStart>start){ + appendText(tagStart); + } + switch(source.charAt(tagStart+1)){ + case '/': + var end = source.indexOf('>',tagStart+3); + var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, ''); + var config = parseStack.pop(); + if(end<0){ + + tagName = source.substring(tagStart+2).replace(/[\s<].*/,''); + errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName); + end = tagStart+1+tagName.length; + }else if(tagName.match(/\s + locator&&position(tagStart); + end = parseInstruction(source,tagStart,domBuilder); + break; + case '!':// start){ + start = end; + }else{ + //TODO: 这里有可能sax回退,有位置错误风险 + appendText(Math.max(tagStart,start)+1); + } + } +} +function copyLocator(f,t){ + t.lineNumber = f.lineNumber; + t.columnNumber = f.columnNumber; + return t; +} + +/** + * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); + * @return end of the elementStartPart(end of elementEndPart for selfClosed el) + */ +function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){ + + /** + * @param {string} qname + * @param {string} value + * @param {number} startIndex + */ + function addAttribute(qname, value, startIndex) { + if (el.attributeNames.hasOwnProperty(qname)) { + errorHandler.fatalError('Attribute ' + qname + ' redefined') + } + el.addValue( + qname, + // @see https://www.w3.org/TR/xml/#AVNormalize + // since the xmldom sax parser does not "interpret" DTD the following is not implemented: + // - recursive replacement of (DTD) entity references + // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA + value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityReplacer), + startIndex + ) + } + var attrName; + var value; + var p = ++start; + var s = S_TAG;//status + while(true){ + var c = source.charAt(p); + switch(c){ + case '=': + if(s === S_ATTR){//attrName + attrName = source.slice(start,p); + s = S_EQ; + }else if(s === S_ATTR_SPACE){ + s = S_EQ; + }else{ + //fatalError: equal must after attrName or space after attrName + throw new Error('attribute equal must after attrName'); // No known test case + } + break; + case '\'': + case '"': + if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE + ){//equal + if(s === S_ATTR){ + errorHandler.warning('attribute value must after "="') + attrName = source.slice(start,p) + } + start = p+1; + p = source.indexOf(c,start) + if(p>0){ + value = source.slice(start, p); + addAttribute(attrName, value, start-1); + s = S_ATTR_END; + }else{ + //fatalError: no end quot match + throw new Error('attribute value no end \''+c+'\' match'); + } + }else if(s == S_ATTR_NOQUOT_VALUE){ + value = source.slice(start, p); + addAttribute(attrName, value, start); + errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); + start = p+1; + s = S_ATTR_END + }else{ + //fatalError: no equal before + throw new Error('attribute value must after "="'); // No known test case + } + break; + case '/': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + s =S_TAG_CLOSE; + el.closed = true; + case S_ATTR_NOQUOT_VALUE: + case S_ATTR: + break; + case S_ATTR_SPACE: + el.closed = true; + break; + //case S_EQ: + default: + throw new Error("attribute invalid close char('/')") // No known test case + } + break; + case ''://end document + errorHandler.error('unexpected end of input'); + if(s == S_TAG){ + el.setTagName(source.slice(start,p)); + } + return p; + case '>': + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p)); + case S_ATTR_END: + case S_TAG_SPACE: + case S_TAG_CLOSE: + break;//normal + case S_ATTR_NOQUOT_VALUE://Compatible state + case S_ATTR: + value = source.slice(start,p); + if(value.slice(-1) === '/'){ + el.closed = true; + value = value.slice(0,-1) + } + case S_ATTR_SPACE: + if(s === S_ATTR_SPACE){ + value = attrName; + } + if(s == S_ATTR_NOQUOT_VALUE){ + errorHandler.warning('attribute "'+value+'" missed quot(")!'); + addAttribute(attrName, value, start) + }else{ + if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){ + errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') + } + addAttribute(value, value, start) + } + break; + case S_EQ: + throw new Error('attribute value missed!!'); + } +// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) + return p; + /*xml space '\x20' | #x9 | #xD | #xA; */ + case '\u0080': + c = ' '; + default: + if(c<= ' '){//space + switch(s){ + case S_TAG: + el.setTagName(source.slice(start,p));//tagName + s = S_TAG_SPACE; + break; + case S_ATTR: + attrName = source.slice(start,p) + s = S_ATTR_SPACE; + break; + case S_ATTR_NOQUOT_VALUE: + var value = source.slice(start, p); + errorHandler.warning('attribute "'+value+'" missed quot(")!!'); + addAttribute(attrName, value, start) + case S_ATTR_END: + s = S_TAG_SPACE; + break; + //case S_TAG_SPACE: + //case S_EQ: + //case S_ATTR_SPACE: + // void();break; + //case S_TAG_CLOSE: + //ignore warning + } + }else{//not space +//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE +//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE + switch(s){ + //case S_TAG:void();break; + //case S_ATTR:void();break; + //case S_ATTR_NOQUOT_VALUE:void();break; + case S_ATTR_SPACE: + var tagName = el.tagName; + if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) { + errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!') + } + addAttribute(attrName, attrName, start); + start = p; + s = S_ATTR; + break; + case S_ATTR_END: + errorHandler.warning('attribute space is required"'+attrName+'"!!') + case S_TAG_SPACE: + s = S_ATTR; + start = p; + break; + case S_EQ: + s = S_ATTR_NOQUOT_VALUE; + start = p; + break; + case S_TAG_CLOSE: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + }//end outer switch + //console.log('p++',p) + p++; + } +} +/** + * @return true if has new namespace define + */ +function appendElement(el,domBuilder,currentNSMap){ + var tagName = el.tagName; + var localNSMap = null; + //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; + var i = el.length; + while(i--){ + var a = el[i]; + var qName = a.qName; + var value = a.value; + var nsp = qName.indexOf(':'); + if(nsp>0){ + var prefix = a.prefix = qName.slice(0,nsp); + var localName = qName.slice(nsp+1); + var nsPrefix = prefix === 'xmlns' && localName + }else{ + localName = qName; + prefix = null + nsPrefix = qName === 'xmlns' && '' + } + //can not set prefix,because prefix !== '' + a.localName = localName ; + //prefix == null for no ns prefix attribute + if(nsPrefix !== false){//hack!! + if(localNSMap == null){ + localNSMap = {} + //console.log(currentNSMap,0) + _copy(currentNSMap,currentNSMap={}) + //console.log(currentNSMap,1) + } + currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; + a.uri = NAMESPACE.XMLNS + domBuilder.startPrefixMapping(nsPrefix, value) + } + } + var i = el.length; + while(i--){ + a = el[i]; + var prefix = a.prefix; + if(prefix){//no prefix attribute has no namespace + if(prefix === 'xml'){ + a.uri = NAMESPACE.XML; + }if(prefix !== 'xmlns'){ + a.uri = currentNSMap[prefix || ''] + + //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} + } + } + } + var nsp = tagName.indexOf(':'); + if(nsp>0){ + prefix = el.prefix = tagName.slice(0,nsp); + localName = el.localName = tagName.slice(nsp+1); + }else{ + prefix = null;//important!! + localName = el.localName = tagName; + } + //no prefix element has default namespace + var ns = el.uri = currentNSMap[prefix || '']; + domBuilder.startElement(ns,localName,tagName,el); + //endPrefixMapping and startPrefixMapping have not any help for dom builder + //localNSMap = null + if(el.closed){ + domBuilder.endElement(ns,localName,tagName); + if(localNSMap){ + for (prefix in localNSMap) { + if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) { + domBuilder.endPrefixMapping(prefix); + } + } + } + }else{ + el.currentNSMap = currentNSMap; + el.localNSMap = localNSMap; + //parseStack.push(el); + return true; + } +} +function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ + if(/^(?:script|textarea)$/i.test(tagName)){ + var elEndStart = source.indexOf('',elStartEnd); + var text = source.substring(elStartEnd+1,elEndStart); + if(/[&<]/.test(text)){ + if(/^script$/i.test(tagName)){ + //if(!/\]\]>/.test(text)){ + //lexHandler.startCDATA(); + domBuilder.characters(text,0,text.length); + //lexHandler.endCDATA(); + return elEndStart; + //} + }//}else{//text area + text = text.replace(/&#?\w+;/g,entityReplacer); + domBuilder.characters(text,0,text.length); + return elEndStart; + //} + + } + } + return elStartEnd+1; +} +function fixSelfClosed(source,elStartEnd,tagName,closeMap){ + //if(tagName in closeMap){ + var pos = closeMap[tagName]; + if(pos == null){ + //console.log(tagName) + pos = source.lastIndexOf('') + if(pos',start+4); + //append comment source.substring(4,end)//"); - case DOCUMENT_TYPE_NODE: - var pubid = node.publicId; - var sysid = node.systemId; - buf.push(''); - }else if(sysid && sysid!='.'){ - buf.push(' SYSTEM ', sysid, '>'); - }else{ - var sub = node.internalSubset; - if(sub){ - buf.push(" [",sub,"]"); - } - buf.push(">"); - } - return; - case PROCESSING_INSTRUCTION_NODE: - return buf.push( ""); - case ENTITY_REFERENCE_NODE: - return buf.push( '&',node.nodeName,';'); - //case ENTITY_NODE: - //case NOTATION_NODE: - default: - buf.push('??',node.nodeName); - } - } - function importNode(doc,node,deep){ - var node2; - switch (node.nodeType) { - case ELEMENT_NODE: - node2 = node.cloneNode(false); - node2.ownerDocument = doc; - //var attrs = node2.attributes; - //var len = attrs.length; - //for(var i=0;i 512) { + other = "".concat(other.slice(0, 509), "..."); + } + if (operator === 'deepEqual' || operator === 'equal') { + _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); + } else { + other = " ".concat(operator, " ").concat(other); } } + _this = _super.call(this, "".concat(_res).concat(other)); } } - if(node.childNodes){ - node2.childNodes = new NodeList(); + Error.stackTraceLimit = limit; + _this.generatedMessage = !message; + Object.defineProperty(_assertThisInitialized(_this), 'name', { + value: 'AssertionError [ERR_ASSERTION]', + enumerable: false, + writable: true, + configurable: true + }); + _this.code = 'ERR_ASSERTION'; + _this.actual = actual; + _this.expected = expected; + _this.operator = operator; + if (Error.captureStackTrace) { + // eslint-disable-next-line no-restricted-syntax + Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn); + } + // Create error message including the error code in the name. + _this.stack; + // Reset the name. + _this.name = 'AssertionError'; + return _possibleConstructorReturn(_this); + } + _createClass(AssertionError, [{ + key: "toString", + value: function toString() { + return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); } - node2.ownerDocument = doc; - switch (node2.nodeType) { - case ELEMENT_NODE: - var attrs = node.attributes; - var attrs2 = node2.attributes = new NamedNodeMap(); - var len = attrs.length - attrs2._ownerElement = node2; - for(var i=0;i { + +"use strict"; +// Currently in sync with Node.js lib/internal/errors.js +// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f + +/* eslint node-core/documented-errors: "error" */ +/* eslint node-core/alphabetize-errors: "error" */ +/* eslint node-core/prefer-util-format-errors: "error" */ + + + +// The whole point behind this internal module is to allow Node.js to no +// longer be forced to treat every error message change as a semver-major +// change. The NodeError classes here all expose a `code` property whose +// value statically and permanently identifies the error. While the error +// message may change, the code should not. +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +var codes = {}; + +// Lazy loaded +var assert; +var util; +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); } - return node2; } - - function __set__(object,key,value){ - object[key] = value - } - //do dynamic - try{ - if(Object.defineProperty){ - Object.defineProperty(LiveNodeList.prototype,'length',{ - get:function(){ - _updateLiveList(this); - return this.$$length; - } - }); - - Object.defineProperty(Node.prototype,'textContent',{ - get:function(){ - return getTextContent(this); - }, - - set:function(data){ - switch(this.nodeType){ - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - while(this.firstChild){ - this.removeChild(this.firstChild); - } - if(data || String(data)){ - this.appendChild(this.ownerDocument.createTextNode(data)); - } - break; - - default: - this.data = data; - this.value = data; - this.nodeValue = data; - } - } - }) - - function getTextContent(node){ - switch(node.nodeType){ - case ELEMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: - var buf = []; - node = node.firstChild; - while(node){ - if(node.nodeType!==7 && node.nodeType !==8){ - buf.push(getTextContent(node)); - } - node = node.nextSibling; - } - return buf.join(''); - default: - return node.nodeValue; - } - } - - __set__ = function(object,key,value){ - //console.log(value) - object['$$'+key] = value - } - } - }catch(e){//ie8 - } - - //if(typeof require == 'function'){ - exports.DocumentType = DocumentType; - exports.DOMException = DOMException; - exports.DOMImplementation = DOMImplementation; - exports.Element = Element; - exports.Node = Node; - exports.NodeList = NodeList; - exports.XMLSerializer = XMLSerializer; - //} - - - /***/ }), - - /***/ 16714: - /***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - "use strict"; - - - var freeze = (__webpack_require__(16996).freeze); - - /** - * The entities that are predefined in every XML document. - * - * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1 - * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0 - * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia - */ - exports.XML_ENTITIES = freeze({ - amp: '&', - apos: "'", - gt: '>', - lt: '<', - quot: '"', - }); - - /** - * A map of all entities that are detected in an HTML document. - * They contain all entries from `XML_ENTITIES`. - * - * @see XML_ENTITIES - * @see DOMParser.parseFromString - * @see DOMImplementation.prototype.createHTMLDocument - * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec - * @see https://html.spec.whatwg.org/entities.json JSON - * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names - * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML - * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML) - * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML) - */ - exports.HTML_ENTITIES = freeze({ - Aacute: '\u00C1', - aacute: '\u00E1', - Abreve: '\u0102', - abreve: '\u0103', - ac: '\u223E', - acd: '\u223F', - acE: '\u223E\u0333', - Acirc: '\u00C2', - acirc: '\u00E2', - acute: '\u00B4', - Acy: '\u0410', - acy: '\u0430', - AElig: '\u00C6', - aelig: '\u00E6', - af: '\u2061', - Afr: '\uD835\uDD04', - afr: '\uD835\uDD1E', - Agrave: '\u00C0', - agrave: '\u00E0', - alefsym: '\u2135', - aleph: '\u2135', - Alpha: '\u0391', - alpha: '\u03B1', - Amacr: '\u0100', - amacr: '\u0101', - amalg: '\u2A3F', - AMP: '\u0026', - amp: '\u0026', - And: '\u2A53', - 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: '\u0104', - aogon: '\u0105', - Aopf: '\uD835\uDD38', - aopf: '\uD835\uDD52', - ap: '\u2248', - apacir: '\u2A6F', - apE: '\u2A70', - ape: '\u224A', - apid: '\u224B', - apos: '\u0027', - ApplyFunction: '\u2061', - approx: '\u2248', - approxeq: '\u224A', - Aring: '\u00C5', - aring: '\u00E5', - Ascr: '\uD835\uDC9C', - ascr: '\uD835\uDCB6', - Assign: '\u2254', - ast: '\u002A', - asymp: '\u2248', - asympeq: '\u224D', - Atilde: '\u00C3', - atilde: '\u00E3', - Auml: '\u00C4', - auml: '\u00E4', - awconint: '\u2233', - awint: '\u2A11', - backcong: '\u224C', - backepsilon: '\u03F6', - backprime: '\u2035', - backsim: '\u223D', - backsimeq: '\u22CD', - Backslash: '\u2216', - Barv: '\u2AE7', - barvee: '\u22BD', - Barwed: '\u2306', - barwed: '\u2305', - barwedge: '\u2305', - bbrk: '\u23B5', - bbrktbrk: '\u23B6', - bcong: '\u224C', - Bcy: '\u0411', - bcy: '\u0431', - bdquo: '\u201E', - becaus: '\u2235', - Because: '\u2235', - because: '\u2235', - bemptyv: '\u29B0', - bepsi: '\u03F6', - bernou: '\u212C', - Bernoullis: '\u212C', - Beta: '\u0392', - beta: '\u03B2', - beth: '\u2136', - between: '\u226C', - Bfr: '\uD835\uDD05', - 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: '\u2AED', - bnot: '\u2310', - Bopf: '\uD835\uDD39', - bopf: '\uD835\uDD53', - bot: '\u22A5', - bottom: '\u22A5', - bowtie: '\u22C8', - boxbox: '\u29C9', - boxDL: '\u2557', - boxDl: '\u2556', - boxdL: '\u2555', - boxdl: '\u2510', - boxDR: '\u2554', - boxDr: '\u2553', - boxdR: '\u2552', - boxdr: '\u250C', - boxH: '\u2550', - boxh: '\u2500', - boxHD: '\u2566', - boxHd: '\u2564', - boxhD: '\u2565', - boxhd: '\u252C', - boxHU: '\u2569', - boxHu: '\u2567', - boxhU: '\u2568', - boxhu: '\u2534', - boxminus: '\u229F', - boxplus: '\u229E', - boxtimes: '\u22A0', - boxUL: '\u255D', - boxUl: '\u255C', - boxuL: '\u255B', - boxul: '\u2518', - boxUR: '\u255A', - boxUr: '\u2559', - boxuR: '\u2558', - boxur: '\u2514', - boxV: '\u2551', - boxv: '\u2502', - boxVH: '\u256C', - boxVh: '\u256B', - boxvH: '\u256A', - boxvh: '\u253C', - boxVL: '\u2563', - boxVl: '\u2562', - boxvL: '\u2561', - boxvl: '\u2524', - boxVR: '\u2560', - boxVr: '\u255F', - boxvR: '\u255E', - boxvr: '\u251C', - bprime: '\u2035', - Breve: '\u02D8', - breve: '\u02D8', - brvbar: '\u00A6', - Bscr: '\u212C', - 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: '\u224E', - bumpeq: '\u224F', - Cacute: '\u0106', - cacute: '\u0107', - Cap: '\u22D2', - cap: '\u2229', - capand: '\u2A44', - capbrcup: '\u2A49', - capcap: '\u2A4B', - capcup: '\u2A47', - capdot: '\u2A40', - CapitalDifferentialD: '\u2145', - caps: '\u2229\uFE00', - caret: '\u2041', - caron: '\u02C7', - Cayleys: '\u212D', - ccaps: '\u2A4D', - Ccaron: '\u010C', - ccaron: '\u010D', - Ccedil: '\u00C7', - ccedil: '\u00E7', - Ccirc: '\u0108', - ccirc: '\u0109', - Cconint: '\u2230', - ccups: '\u2A4C', - ccupssm: '\u2A50', - Cdot: '\u010A', - cdot: '\u010B', - cedil: '\u00B8', - Cedilla: '\u00B8', - cemptyv: '\u29B2', - cent: '\u00A2', - CenterDot: '\u00B7', - centerdot: '\u00B7', - Cfr: '\u212D', - cfr: '\uD835\uDD20', - CHcy: '\u0427', - chcy: '\u0447', - check: '\u2713', - checkmark: '\u2713', - Chi: '\u03A7', - chi: '\u03C7', - cir: '\u25CB', - circ: '\u02C6', - circeq: '\u2257', - circlearrowleft: '\u21BA', - circlearrowright: '\u21BB', - circledast: '\u229B', - circledcirc: '\u229A', - circleddash: '\u229D', - CircleDot: '\u2299', - circledR: '\u00AE', - circledS: '\u24C8', - CircleMinus: '\u2296', - CirclePlus: '\u2295', - CircleTimes: '\u2297', - cirE: '\u29C3', - cire: '\u2257', - cirfnint: '\u2A10', - cirmid: '\u2AEF', - cirscir: '\u29C2', - ClockwiseContourIntegral: '\u2232', - CloseCurlyDoubleQuote: '\u201D', - CloseCurlyQuote: '\u2019', - clubs: '\u2663', - clubsuit: '\u2663', - Colon: '\u2237', - colon: '\u003A', - Colone: '\u2A74', - colone: '\u2254', - coloneq: '\u2254', - comma: '\u002C', - commat: '\u0040', - comp: '\u2201', - compfn: '\u2218', - complement: '\u2201', - complexes: '\u2102', - cong: '\u2245', - congdot: '\u2A6D', - Congruent: '\u2261', - Conint: '\u222F', - conint: '\u222E', - ContourIntegral: '\u222E', - Copf: '\u2102', - copf: '\uD835\uDD54', - coprod: '\u2210', - Coproduct: '\u2210', - COPY: '\u00A9', - copy: '\u00A9', - copysr: '\u2117', - CounterClockwiseContourIntegral: '\u2233', - crarr: '\u21B5', - Cross: '\u2A2F', - cross: '\u2717', - Cscr: '\uD835\uDC9E', - 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: '\u22D3', - cup: '\u222A', - cupbrcap: '\u2A48', - CupCap: '\u224D', - 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', - Dagger: '\u2021', - dagger: '\u2020', - daleth: '\u2138', - Darr: '\u21A1', - dArr: '\u21D3', - darr: '\u2193', - dash: '\u2010', - Dashv: '\u2AE4', - dashv: '\u22A3', - dbkarow: '\u290F', - dblac: '\u02DD', - Dcaron: '\u010E', - dcaron: '\u010F', - Dcy: '\u0414', - dcy: '\u0434', - DD: '\u2145', - dd: '\u2146', - ddagger: '\u2021', - ddarr: '\u21CA', - DDotrahd: '\u2911', - ddotseq: '\u2A77', - deg: '\u00B0', - Del: '\u2207', - Delta: '\u0394', - delta: '\u03B4', - demptyv: '\u29B1', - dfisht: '\u297F', - Dfr: '\uD835\uDD07', - dfr: '\uD835\uDD21', - dHar: '\u2965', - dharl: '\u21C3', - dharr: '\u21C2', - DiacriticalAcute: '\u00B4', - DiacriticalDot: '\u02D9', - DiacriticalDoubleAcute: '\u02DD', - DiacriticalGrave: '\u0060', - DiacriticalTilde: '\u02DC', - diam: '\u22C4', - Diamond: '\u22C4', - diamond: '\u22C4', - diamondsuit: '\u2666', - diams: '\u2666', - die: '\u00A8', - DifferentialD: '\u2146', - digamma: '\u03DD', - disin: '\u22F2', - div: '\u00F7', - divide: '\u00F7', - divideontimes: '\u22C7', - divonx: '\u22C7', - DJcy: '\u0402', - djcy: '\u0452', - dlcorn: '\u231E', - dlcrop: '\u230D', - dollar: '\u0024', - Dopf: '\uD835\uDD3B', - dopf: '\uD835\uDD55', - Dot: '\u00A8', - dot: '\u02D9', - DotDot: '\u20DC', - doteq: '\u2250', - doteqdot: '\u2251', - DotEqual: '\u2250', - dotminus: '\u2238', - dotplus: '\u2214', - dotsquare: '\u22A1', - doublebarwedge: '\u2306', - 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', - Downarrow: '\u21D3', - downarrow: '\u2193', - DownArrowBar: '\u2913', - DownArrowUpArrow: '\u21F5', - DownBreve: '\u0311', - downdownarrows: '\u21CA', - downharpoonleft: '\u21C3', - downharpoonright: '\u21C2', - DownLeftRightVector: '\u2950', - DownLeftTeeVector: '\u295E', - DownLeftVector: '\u21BD', - DownLeftVectorBar: '\u2956', - DownRightTeeVector: '\u295F', - DownRightVector: '\u21C1', - DownRightVectorBar: '\u2957', - DownTee: '\u22A4', - DownTeeArrow: '\u21A7', - drbkarow: '\u2910', - drcorn: '\u231F', - drcrop: '\u230C', - Dscr: '\uD835\uDC9F', - dscr: '\uD835\uDCB9', - DScy: '\u0405', - dscy: '\u0455', - dsol: '\u29F6', - Dstrok: '\u0110', - dstrok: '\u0111', - dtdot: '\u22F1', - dtri: '\u25BF', - dtrif: '\u25BE', - duarr: '\u21F5', - duhar: '\u296F', - dwangle: '\u29A6', - DZcy: '\u040F', - dzcy: '\u045F', - dzigrarr: '\u27FF', - Eacute: '\u00C9', - eacute: '\u00E9', - easter: '\u2A6E', - Ecaron: '\u011A', - ecaron: '\u011B', - ecir: '\u2256', - Ecirc: '\u00CA', - ecirc: '\u00EA', - ecolon: '\u2255', - Ecy: '\u042D', - ecy: '\u044D', - eDDot: '\u2A77', - Edot: '\u0116', - eDot: '\u2251', - edot: '\u0117', - ee: '\u2147', - efDot: '\u2252', - Efr: '\uD835\uDD08', - efr: '\uD835\uDD22', - eg: '\u2A9A', - Egrave: '\u00C8', - egrave: '\u00E8', - egs: '\u2A96', - egsdot: '\u2A98', - el: '\u2A99', - Element: '\u2208', - elinters: '\u23E7', - ell: '\u2113', - els: '\u2A95', - elsdot: '\u2A97', - Emacr: '\u0112', - emacr: '\u0113', - empty: '\u2205', - emptyset: '\u2205', - EmptySmallSquare: '\u25FB', - emptyv: '\u2205', - EmptyVerySmallSquare: '\u25AB', - emsp: '\u2003', - emsp13: '\u2004', - emsp14: '\u2005', - ENG: '\u014A', - eng: '\u014B', - ensp: '\u2002', - Eogon: '\u0118', - eogon: '\u0119', - Eopf: '\uD835\uDD3C', - eopf: '\uD835\uDD56', - epar: '\u22D5', - eparsl: '\u29E3', - eplus: '\u2A71', - epsi: '\u03B5', - Epsilon: '\u0395', - epsilon: '\u03B5', - epsiv: '\u03F5', - eqcirc: '\u2256', - eqcolon: '\u2255', - eqsim: '\u2242', - eqslantgtr: '\u2A96', - eqslantless: '\u2A95', - Equal: '\u2A75', - equals: '\u003D', - EqualTilde: '\u2242', - equest: '\u225F', - Equilibrium: '\u21CC', - equiv: '\u2261', - equivDD: '\u2A78', - eqvparsl: '\u29E5', - erarr: '\u2971', - erDot: '\u2253', - Escr: '\u2130', - escr: '\u212F', - esdot: '\u2250', - Esim: '\u2A73', - esim: '\u2242', - Eta: '\u0397', - eta: '\u03B7', - ETH: '\u00D0', - eth: '\u00F0', - Euml: '\u00CB', - euml: '\u00EB', - euro: '\u20AC', - excl: '\u0021', - exist: '\u2203', - Exists: '\u2203', - expectation: '\u2130', - ExponentialE: '\u2147', - exponentiale: '\u2147', - fallingdotseq: '\u2252', - Fcy: '\u0424', - fcy: '\u0444', - female: '\u2640', - ffilig: '\uFB03', - fflig: '\uFB00', - ffllig: '\uFB04', - Ffr: '\uD835\uDD09', - ffr: '\uD835\uDD23', - filig: '\uFB01', - FilledSmallSquare: '\u25FC', - FilledVerySmallSquare: '\u25AA', - fjlig: '\u0066\u006A', - flat: '\u266D', - fllig: '\uFB02', - fltns: '\u25B1', - fnof: '\u0192', - Fopf: '\uD835\uDD3D', - fopf: '\uD835\uDD57', - ForAll: '\u2200', - forall: '\u2200', - fork: '\u22D4', - forkv: '\u2AD9', - Fouriertrf: '\u2131', - 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: '\u2131', - fscr: '\uD835\uDCBB', - gacute: '\u01F5', - Gamma: '\u0393', - gamma: '\u03B3', - Gammad: '\u03DC', - gammad: '\u03DD', - gap: '\u2A86', - Gbreve: '\u011E', - gbreve: '\u011F', - Gcedil: '\u0122', - Gcirc: '\u011C', - gcirc: '\u011D', - Gcy: '\u0413', - gcy: '\u0433', - Gdot: '\u0120', - gdot: '\u0121', - gE: '\u2267', - ge: '\u2265', - gEl: '\u2A8C', - 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\uDD0A', - gfr: '\uD835\uDD24', - Gg: '\u22D9', - gg: '\u226B', - ggg: '\u22D9', - gimel: '\u2137', - GJcy: '\u0403', - gjcy: '\u0453', - gl: '\u2277', - gla: '\u2AA5', - glE: '\u2A92', - glj: '\u2AA4', - gnap: '\u2A8A', - gnapprox: '\u2A8A', - gnE: '\u2269', - gne: '\u2A88', - gneq: '\u2A88', - gneqq: '\u2269', - gnsim: '\u22E7', - Gopf: '\uD835\uDD3E', - gopf: '\uD835\uDD58', - grave: '\u0060', - GreaterEqual: '\u2265', - GreaterEqualLess: '\u22DB', - GreaterFullEqual: '\u2267', - GreaterGreater: '\u2AA2', - GreaterLess: '\u2277', - GreaterSlantEqual: '\u2A7E', - GreaterTilde: '\u2273', - Gscr: '\uD835\uDCA2', - gscr: '\u210A', - gsim: '\u2273', - gsime: '\u2A8E', - gsiml: '\u2A90', - Gt: '\u226B', - GT: '\u003E', - 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', - Hacek: '\u02C7', - hairsp: '\u200A', - half: '\u00BD', - hamilt: '\u210B', - HARDcy: '\u042A', - hardcy: '\u044A', - hArr: '\u21D4', - harr: '\u2194', - harrcir: '\u2948', - harrw: '\u21AD', - Hat: '\u005E', - hbar: '\u210F', - Hcirc: '\u0124', - hcirc: '\u0125', - hearts: '\u2665', - heartsuit: '\u2665', - hellip: '\u2026', - hercon: '\u22B9', - Hfr: '\u210C', - hfr: '\uD835\uDD25', - HilbertSpace: '\u210B', - hksearow: '\u2925', - hkswarow: '\u2926', - hoarr: '\u21FF', - homtht: '\u223B', - hookleftarrow: '\u21A9', - hookrightarrow: '\u21AA', - Hopf: '\u210D', - hopf: '\uD835\uDD59', - horbar: '\u2015', - HorizontalLine: '\u2500', - Hscr: '\u210B', - hscr: '\uD835\uDCBD', - hslash: '\u210F', - Hstrok: '\u0126', - hstrok: '\u0127', - HumpDownHump: '\u224E', - HumpEqual: '\u224F', - hybull: '\u2043', - hyphen: '\u2010', - Iacute: '\u00CD', - iacute: '\u00ED', - ic: '\u2063', - Icirc: '\u00CE', - icirc: '\u00EE', - Icy: '\u0418', - icy: '\u0438', - Idot: '\u0130', - IEcy: '\u0415', - iecy: '\u0435', - iexcl: '\u00A1', - iff: '\u21D4', - Ifr: '\u2111', - ifr: '\uD835\uDD26', - Igrave: '\u00CC', - igrave: '\u00EC', - ii: '\u2148', - iiiint: '\u2A0C', - iiint: '\u222D', - iinfin: '\u29DC', - iiota: '\u2129', - IJlig: '\u0132', - ijlig: '\u0133', - Im: '\u2111', - Imacr: '\u012A', - imacr: '\u012B', - image: '\u2111', - ImaginaryI: '\u2148', - imagline: '\u2110', - imagpart: '\u2111', - imath: '\u0131', - imof: '\u22B7', - imped: '\u01B5', - Implies: '\u21D2', - in: '\u2208', - incare: '\u2105', - infin: '\u221E', - infintie: '\u29DD', - inodot: '\u0131', - Int: '\u222C', - int: '\u222B', - intcal: '\u22BA', - integers: '\u2124', - Integral: '\u222B', - intercal: '\u22BA', - Intersection: '\u22C2', - intlarhk: '\u2A17', - intprod: '\u2A3C', - InvisibleComma: '\u2063', - InvisibleTimes: '\u2062', - IOcy: '\u0401', - iocy: '\u0451', - Iogon: '\u012E', - iogon: '\u012F', - Iopf: '\uD835\uDD40', - iopf: '\uD835\uDD5A', - Iota: '\u0399', - iota: '\u03B9', - iprod: '\u2A3C', - iquest: '\u00BF', - Iscr: '\u2110', - iscr: '\uD835\uDCBE', - isin: '\u2208', - isindot: '\u22F5', - isinE: '\u22F9', - isins: '\u22F4', - isinsv: '\u22F3', - isinv: '\u2208', - it: '\u2062', - Itilde: '\u0128', - itilde: '\u0129', - Iukcy: '\u0406', - iukcy: '\u0456', - Iuml: '\u00CF', - iuml: '\u00EF', - Jcirc: '\u0134', - jcirc: '\u0135', - Jcy: '\u0419', - jcy: '\u0439', - Jfr: '\uD835\uDD0D', - jfr: '\uD835\uDD27', - jmath: '\u0237', - Jopf: '\uD835\uDD41', - jopf: '\uD835\uDD5B', - Jscr: '\uD835\uDCA5', - jscr: '\uD835\uDCBF', - Jsercy: '\u0408', - jsercy: '\u0458', - Jukcy: '\u0404', - jukcy: '\u0454', - Kappa: '\u039A', - kappa: '\u03BA', - kappav: '\u03F0', - Kcedil: '\u0136', - kcedil: '\u0137', - Kcy: '\u041A', - kcy: '\u043A', - Kfr: '\uD835\uDD0E', - kfr: '\uD835\uDD28', - kgreen: '\u0138', - KHcy: '\u0425', - khcy: '\u0445', - KJcy: '\u040C', - kjcy: '\u045C', - Kopf: '\uD835\uDD42', - kopf: '\uD835\uDD5C', - Kscr: '\uD835\uDCA6', - kscr: '\uD835\uDCC0', - lAarr: '\u21DA', - Lacute: '\u0139', - lacute: '\u013A', - laemptyv: '\u29B4', - lagran: '\u2112', - Lambda: '\u039B', - lambda: '\u03BB', - Lang: '\u27EA', - lang: '\u27E8', - langd: '\u2991', - langle: '\u27E8', - lap: '\u2A85', - Laplacetrf: '\u2112', - laquo: '\u00AB', - Larr: '\u219E', - lArr: '\u21D0', - larr: '\u2190', - larrb: '\u21E4', - larrbfs: '\u291F', - larrfs: '\u291D', - larrhk: '\u21A9', - larrlp: '\u21AB', - larrpl: '\u2939', - larrsim: '\u2973', - larrtl: '\u21A2', - lat: '\u2AAB', - lAtail: '\u291B', - latail: '\u2919', - late: '\u2AAD', - lates: '\u2AAD\uFE00', - lBarr: '\u290E', - lbarr: '\u290C', - lbbrk: '\u2772', - lbrace: '\u007B', - lbrack: '\u005B', - lbrke: '\u298B', - lbrksld: '\u298F', - lbrkslu: '\u298D', - Lcaron: '\u013D', - lcaron: '\u013E', - Lcedil: '\u013B', - lcedil: '\u013C', - lceil: '\u2308', - lcub: '\u007B', - Lcy: '\u041B', - lcy: '\u043B', - ldca: '\u2936', - ldquo: '\u201C', - ldquor: '\u201E', - ldrdhar: '\u2967', - ldrushar: '\u294B', - ldsh: '\u21B2', - lE: '\u2266', - le: '\u2264', - LeftAngleBracket: '\u27E8', - LeftArrow: '\u2190', - Leftarrow: '\u21D0', - leftarrow: '\u2190', - LeftArrowBar: '\u21E4', - LeftArrowRightArrow: '\u21C6', - leftarrowtail: '\u21A2', - LeftCeiling: '\u2308', - LeftDoubleBracket: '\u27E6', - LeftDownTeeVector: '\u2961', - LeftDownVector: '\u21C3', - LeftDownVectorBar: '\u2959', - LeftFloor: '\u230A', - leftharpoondown: '\u21BD', - leftharpoonup: '\u21BC', - leftleftarrows: '\u21C7', - LeftRightArrow: '\u2194', - Leftrightarrow: '\u21D4', - leftrightarrow: '\u2194', - leftrightarrows: '\u21C6', - leftrightharpoons: '\u21CB', - leftrightsquigarrow: '\u21AD', - LeftRightVector: '\u294E', - LeftTee: '\u22A3', - LeftTeeArrow: '\u21A4', - LeftTeeVector: '\u295A', - leftthreetimes: '\u22CB', - LeftTriangle: '\u22B2', - LeftTriangleBar: '\u29CF', - LeftTriangleEqual: '\u22B4', - LeftUpDownVector: '\u2951', - LeftUpTeeVector: '\u2960', - LeftUpVector: '\u21BF', - LeftUpVectorBar: '\u2958', - LeftVector: '\u21BC', - LeftVectorBar: '\u2952', - lEg: '\u2A8B', - 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', - LessEqualGreater: '\u22DA', - LessFullEqual: '\u2266', - LessGreater: '\u2276', - lessgtr: '\u2276', - LessLess: '\u2AA1', - lesssim: '\u2272', - LessSlantEqual: '\u2A7D', - LessTilde: '\u2272', - lfisht: '\u297C', - lfloor: '\u230A', - Lfr: '\uD835\uDD0F', - lfr: '\uD835\uDD29', - lg: '\u2276', - lgE: '\u2A91', - lHar: '\u2962', - lhard: '\u21BD', - lharu: '\u21BC', - lharul: '\u296A', - lhblk: '\u2584', - LJcy: '\u0409', - ljcy: '\u0459', - Ll: '\u22D8', - ll: '\u226A', - llarr: '\u21C7', - llcorner: '\u231E', - Lleftarrow: '\u21DA', - llhard: '\u296B', - lltri: '\u25FA', - Lmidot: '\u013F', - lmidot: '\u0140', - lmoust: '\u23B0', - lmoustache: '\u23B0', - lnap: '\u2A89', - lnapprox: '\u2A89', - lnE: '\u2268', - lne: '\u2A87', - lneq: '\u2A87', - lneqq: '\u2268', - lnsim: '\u22E6', - loang: '\u27EC', - loarr: '\u21FD', - lobrk: '\u27E6', - LongLeftArrow: '\u27F5', - Longleftarrow: '\u27F8', - longleftarrow: '\u27F5', - LongLeftRightArrow: '\u27F7', - Longleftrightarrow: '\u27FA', - longleftrightarrow: '\u27F7', - longmapsto: '\u27FC', - LongRightArrow: '\u27F6', - Longrightarrow: '\u27F9', - longrightarrow: '\u27F6', - looparrowleft: '\u21AB', - looparrowright: '\u21AC', - lopar: '\u2985', - Lopf: '\uD835\uDD43', - lopf: '\uD835\uDD5D', - loplus: '\u2A2D', - lotimes: '\u2A34', - lowast: '\u2217', - lowbar: '\u005F', - LowerLeftArrow: '\u2199', - LowerRightArrow: '\u2198', - 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: '\u2112', - lscr: '\uD835\uDCC1', - Lsh: '\u21B0', - lsh: '\u21B0', - lsim: '\u2272', - lsime: '\u2A8D', - lsimg: '\u2A8F', - lsqb: '\u005B', - lsquo: '\u2018', - lsquor: '\u201A', - Lstrok: '\u0141', - lstrok: '\u0142', - Lt: '\u226A', - LT: '\u003C', - lt: '\u003C', - ltcc: '\u2AA6', - ltcir: '\u2A79', - ltdot: '\u22D6', - lthree: '\u22CB', - ltimes: '\u22C9', - ltlarr: '\u2976', - ltquest: '\u2A7B', - ltri: '\u25C3', - ltrie: '\u22B4', - ltrif: '\u25C2', - ltrPar: '\u2996', - lurdshar: '\u294A', - luruhar: '\u2966', - lvertneqq: '\u2268\uFE00', - lvnE: '\u2268\uFE00', - macr: '\u00AF', - male: '\u2642', - malt: '\u2720', - maltese: '\u2720', - Map: '\u2905', - map: '\u21A6', - mapsto: '\u21A6', - mapstodown: '\u21A7', - mapstoleft: '\u21A4', - mapstoup: '\u21A5', - marker: '\u25AE', - mcomma: '\u2A29', - Mcy: '\u041C', - mcy: '\u043C', - mdash: '\u2014', - mDDot: '\u223A', - measuredangle: '\u2221', - MediumSpace: '\u205F', - Mellintrf: '\u2133', - Mfr: '\uD835\uDD10', - mfr: '\uD835\uDD2A', - mho: '\u2127', - micro: '\u00B5', - mid: '\u2223', - midast: '\u002A', - midcir: '\u2AF0', - middot: '\u00B7', - minus: '\u2212', - minusb: '\u229F', - minusd: '\u2238', - minusdu: '\u2A2A', - MinusPlus: '\u2213', - mlcp: '\u2ADB', - mldr: '\u2026', - mnplus: '\u2213', - models: '\u22A7', - Mopf: '\uD835\uDD44', - mopf: '\uD835\uDD5E', - mp: '\u2213', - Mscr: '\u2133', - mscr: '\uD835\uDCC2', - mstpos: '\u223E', - Mu: '\u039C', - mu: '\u03BC', - multimap: '\u22B8', - mumap: '\u22B8', - nabla: '\u2207', - Nacute: '\u0143', - 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: '\u0147', - ncaron: '\u0148', - Ncedil: '\u0145', - ncedil: '\u0146', - ncong: '\u2247', - ncongdot: '\u2A6D\u0338', - ncup: '\u2A42', - Ncy: '\u041D', - ncy: '\u043D', - ndash: '\u2013', - ne: '\u2260', - nearhk: '\u2924', - neArr: '\u21D7', - nearr: '\u2197', - nearrow: '\u2197', - nedot: '\u2250\u0338', - NegativeMediumSpace: '\u200B', - NegativeThickSpace: '\u200B', - NegativeThinSpace: '\u200B', - NegativeVeryThinSpace: '\u200B', - nequiv: '\u2262', - nesear: '\u2928', - nesim: '\u2242\u0338', - NestedGreaterGreater: '\u226B', - NestedLessLess: '\u226A', - NewLine: '\u000A', - nexist: '\u2204', - nexists: '\u2204', - Nfr: '\uD835\uDD11', - nfr: '\uD835\uDD2B', - ngE: '\u2267\u0338', - nge: '\u2271', - ngeq: '\u2271', - ngeqq: '\u2267\u0338', - ngeqslant: '\u2A7E\u0338', - nges: '\u2A7E\u0338', - nGg: '\u22D9\u0338', - ngsim: '\u2275', - nGt: '\u226B\u20D2', - ngt: '\u226F', - ngtr: '\u226F', - nGtv: '\u226B\u0338', - nhArr: '\u21CE', - nharr: '\u21AE', - nhpar: '\u2AF2', - ni: '\u220B', - nis: '\u22FC', - nisd: '\u22FA', - niv: '\u220B', - NJcy: '\u040A', - njcy: '\u045A', - nlArr: '\u21CD', - nlarr: '\u219A', - nldr: '\u2025', - nlE: '\u2266\u0338', - nle: '\u2270', - nLeftarrow: '\u21CD', - nleftarrow: '\u219A', - nLeftrightarrow: '\u21CE', - nleftrightarrow: '\u21AE', - nleq: '\u2270', - nleqq: '\u2266\u0338', - nleqslant: '\u2A7D\u0338', - nles: '\u2A7D\u0338', - nless: '\u226E', - nLl: '\u22D8\u0338', - nlsim: '\u2274', - nLt: '\u226A\u20D2', - nlt: '\u226E', - nltri: '\u22EA', - nltrie: '\u22EC', - nLtv: '\u226A\u0338', - nmid: '\u2224', - NoBreak: '\u2060', - NonBreakingSpace: '\u00A0', - Nopf: '\u2115', - nopf: '\uD835\uDD5F', - Not: '\u2AEC', - not: '\u00AC', - 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', - notin: '\u2209', - notindot: '\u22F5\u0338', - notinE: '\u22F9\u0338', - notinva: '\u2209', - notinvb: '\u22F7', - notinvc: '\u22F6', - 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', - notni: '\u220C', - notniva: '\u220C', - notnivb: '\u22FE', - notnivc: '\u22FD', - 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', - 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: '\u21CF', - nrightarrow: '\u219B', - nrtri: '\u22EB', - nrtrie: '\u22ED', - nsc: '\u2281', - nsccue: '\u22E1', - nsce: '\u2AB0\u0338', - Nscr: '\uD835\uDCA9', - 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: '\u00D1', - ntilde: '\u00F1', - ntlg: '\u2278', - ntriangleleft: '\u22EA', - ntrianglelefteq: '\u22EC', - ntriangleright: '\u22EB', - ntrianglerighteq: '\u22ED', - Nu: '\u039D', - nu: '\u03BD', - num: '\u0023', - numero: '\u2116', - numsp: '\u2007', - nvap: '\u224D\u20D2', - nVDash: '\u22AF', - nVdash: '\u22AE', - nvDash: '\u22AD', - nvdash: '\u22AC', - nvge: '\u2265\u20D2', - nvgt: '\u003E\u20D2', - nvHarr: '\u2904', - nvinfin: '\u29DE', - nvlArr: '\u2902', - nvle: '\u2264\u20D2', - nvlt: '\u003C\u20D2', - nvltrie: '\u22B4\u20D2', - nvrArr: '\u2903', - nvrtrie: '\u22B5\u20D2', - nvsim: '\u223C\u20D2', - nwarhk: '\u2923', - nwArr: '\u21D6', - nwarr: '\u2196', - nwarrow: '\u2196', - nwnear: '\u2927', - Oacute: '\u00D3', - oacute: '\u00F3', - oast: '\u229B', - ocir: '\u229A', - Ocirc: '\u00D4', - ocirc: '\u00F4', - Ocy: '\u041E', - ocy: '\u043E', - odash: '\u229D', - Odblac: '\u0150', - odblac: '\u0151', - odiv: '\u2A38', - odot: '\u2299', - odsold: '\u29BC', - OElig: '\u0152', - oelig: '\u0153', - ofcir: '\u29BF', - Ofr: '\uD835\uDD12', - ofr: '\uD835\uDD2C', - ogon: '\u02DB', - Ograve: '\u00D2', - ograve: '\u00F2', - ogt: '\u29C1', - ohbar: '\u29B5', - ohm: '\u03A9', - oint: '\u222E', - olarr: '\u21BA', - olcir: '\u29BE', - olcross: '\u29BB', - oline: '\u203E', - olt: '\u29C0', - Omacr: '\u014C', - omacr: '\u014D', - Omega: '\u03A9', - omega: '\u03C9', - Omicron: '\u039F', - omicron: '\u03BF', - omid: '\u29B6', - ominus: '\u2296', - Oopf: '\uD835\uDD46', - oopf: '\uD835\uDD60', - opar: '\u29B7', - OpenCurlyDoubleQuote: '\u201C', - OpenCurlyQuote: '\u2018', - operp: '\u29B9', - oplus: '\u2295', - Or: '\u2A54', - or: '\u2228', - orarr: '\u21BB', - ord: '\u2A5D', - order: '\u2134', - orderof: '\u2134', - ordf: '\u00AA', - ordm: '\u00BA', - origof: '\u22B6', - oror: '\u2A56', - orslope: '\u2A57', - orv: '\u2A5B', - oS: '\u24C8', - Oscr: '\uD835\uDCAA', - oscr: '\u2134', - Oslash: '\u00D8', - oslash: '\u00F8', - osol: '\u2298', - Otilde: '\u00D5', - otilde: '\u00F5', - Otimes: '\u2A37', - otimes: '\u2297', - otimesas: '\u2A36', - Ouml: '\u00D6', - ouml: '\u00F6', - ovbar: '\u233D', - OverBar: '\u203E', - OverBrace: '\u23DE', - OverBracket: '\u23B4', - OverParenthesis: '\u23DC', - par: '\u2225', - para: '\u00B6', - parallel: '\u2225', - parsim: '\u2AF3', - parsl: '\u2AFD', - part: '\u2202', - PartialD: '\u2202', - Pcy: '\u041F', - pcy: '\u043F', - percnt: '\u0025', - period: '\u002E', - permil: '\u2030', - perp: '\u22A5', - pertenk: '\u2031', - Pfr: '\uD835\uDD13', - pfr: '\uD835\uDD2D', - Phi: '\u03A6', - phi: '\u03C6', - phiv: '\u03D5', - phmmat: '\u2133', - phone: '\u260E', - Pi: '\u03A0', - 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', - PlusMinus: '\u00B1', - plusmn: '\u00B1', - plussim: '\u2A26', - plustwo: '\u2A27', - pm: '\u00B1', - Poincareplane: '\u210C', - pointint: '\u2A15', - Popf: '\u2119', - popf: '\uD835\uDD61', - pound: '\u00A3', - Pr: '\u2ABB', - pr: '\u227A', - prap: '\u2AB7', - prcue: '\u227C', - prE: '\u2AB3', - pre: '\u2AAF', - prec: '\u227A', - precapprox: '\u2AB7', - preccurlyeq: '\u227C', - Precedes: '\u227A', - PrecedesEqual: '\u2AAF', - PrecedesSlantEqual: '\u227C', - PrecedesTilde: '\u227E', - preceq: '\u2AAF', - precnapprox: '\u2AB9', - precneqq: '\u2AB5', - precnsim: '\u22E8', - precsim: '\u227E', - Prime: '\u2033', - prime: '\u2032', - primes: '\u2119', - prnap: '\u2AB9', - prnE: '\u2AB5', - prnsim: '\u22E8', - prod: '\u220F', - Product: '\u220F', - profalar: '\u232E', - profline: '\u2312', - profsurf: '\u2313', - prop: '\u221D', - Proportion: '\u2237', - Proportional: '\u221D', - propto: '\u221D', - prsim: '\u227E', - prurel: '\u22B0', - Pscr: '\uD835\uDCAB', - pscr: '\uD835\uDCC5', - Psi: '\u03A8', - psi: '\u03C8', - puncsp: '\u2008', - Qfr: '\uD835\uDD14', - qfr: '\uD835\uDD2E', - qint: '\u2A0C', - Qopf: '\u211A', - qopf: '\uD835\uDD62', - qprime: '\u2057', - Qscr: '\uD835\uDCAC', - qscr: '\uD835\uDCC6', - quaternions: '\u210D', - quatint: '\u2A16', - quest: '\u003F', - questeq: '\u225F', - QUOT: '\u0022', - quot: '\u0022', - rAarr: '\u21DB', - race: '\u223D\u0331', - Racute: '\u0154', - racute: '\u0155', - radic: '\u221A', - raemptyv: '\u29B3', - Rang: '\u27EB', - rang: '\u27E9', - rangd: '\u2992', - range: '\u29A5', - rangle: '\u27E9', - raquo: '\u00BB', - Rarr: '\u21A0', - rArr: '\u21D2', - rarr: '\u2192', - rarrap: '\u2975', - rarrb: '\u21E5', - rarrbfs: '\u2920', - rarrc: '\u2933', - rarrfs: '\u291E', - rarrhk: '\u21AA', - rarrlp: '\u21AC', - rarrpl: '\u2945', - rarrsim: '\u2974', - Rarrtl: '\u2916', - rarrtl: '\u21A3', - rarrw: '\u219D', - rAtail: '\u291C', - ratail: '\u291A', - ratio: '\u2236', - rationals: '\u211A', - RBarr: '\u2910', - rBarr: '\u290F', - rbarr: '\u290D', - rbbrk: '\u2773', - rbrace: '\u007D', - rbrack: '\u005D', - rbrke: '\u298C', - rbrksld: '\u298E', - rbrkslu: '\u2990', - Rcaron: '\u0158', - rcaron: '\u0159', - Rcedil: '\u0156', - rcedil: '\u0157', - rceil: '\u2309', - rcub: '\u007D', - Rcy: '\u0420', - rcy: '\u0440', - rdca: '\u2937', - rdldhar: '\u2969', - rdquo: '\u201D', - rdquor: '\u201D', - rdsh: '\u21B3', - Re: '\u211C', - real: '\u211C', - realine: '\u211B', - realpart: '\u211C', - reals: '\u211D', - rect: '\u25AD', - REG: '\u00AE', - reg: '\u00AE', - ReverseElement: '\u220B', - ReverseEquilibrium: '\u21CB', - ReverseUpEquilibrium: '\u296F', - rfisht: '\u297D', - rfloor: '\u230B', - Rfr: '\u211C', - rfr: '\uD835\uDD2F', - rHar: '\u2964', - rhard: '\u21C1', - rharu: '\u21C0', - rharul: '\u296C', - Rho: '\u03A1', - rho: '\u03C1', - rhov: '\u03F1', - RightAngleBracket: '\u27E9', - RightArrow: '\u2192', - Rightarrow: '\u21D2', - rightarrow: '\u2192', - RightArrowBar: '\u21E5', - RightArrowLeftArrow: '\u21C4', - rightarrowtail: '\u21A3', - RightCeiling: '\u2309', - RightDoubleBracket: '\u27E7', - RightDownTeeVector: '\u295D', - RightDownVector: '\u21C2', - RightDownVectorBar: '\u2955', - RightFloor: '\u230B', - rightharpoondown: '\u21C1', - rightharpoonup: '\u21C0', - rightleftarrows: '\u21C4', - rightleftharpoons: '\u21CC', - rightrightarrows: '\u21C9', - rightsquigarrow: '\u219D', - RightTee: '\u22A2', - RightTeeArrow: '\u21A6', - RightTeeVector: '\u295B', - rightthreetimes: '\u22CC', - RightTriangle: '\u22B3', - RightTriangleBar: '\u29D0', - RightTriangleEqual: '\u22B5', - RightUpDownVector: '\u294F', - RightUpTeeVector: '\u295C', - RightUpVector: '\u21BE', - RightUpVectorBar: '\u2954', - RightVector: '\u21C0', - RightVectorBar: '\u2953', - 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: '\u211D', - ropf: '\uD835\uDD63', - roplus: '\u2A2E', - rotimes: '\u2A35', - RoundImplies: '\u2970', - rpar: '\u0029', - rpargt: '\u2994', - rppolint: '\u2A12', - rrarr: '\u21C9', - Rrightarrow: '\u21DB', - rsaquo: '\u203A', - Rscr: '\u211B', - rscr: '\uD835\uDCC7', - Rsh: '\u21B1', - rsh: '\u21B1', - rsqb: '\u005D', - rsquo: '\u2019', - rsquor: '\u2019', - rthree: '\u22CC', - rtimes: '\u22CA', - rtri: '\u25B9', - rtrie: '\u22B5', - rtrif: '\u25B8', - rtriltri: '\u29CE', - RuleDelayed: '\u29F4', - ruluhar: '\u2968', - rx: '\u211E', - Sacute: '\u015A', - sacute: '\u015B', - sbquo: '\u201A', - Sc: '\u2ABC', - sc: '\u227B', - scap: '\u2AB8', - Scaron: '\u0160', - scaron: '\u0161', - sccue: '\u227D', - scE: '\u2AB4', - sce: '\u2AB0', - Scedil: '\u015E', - scedil: '\u015F', - Scirc: '\u015C', - scirc: '\u015D', - scnap: '\u2ABA', - scnE: '\u2AB6', - scnsim: '\u22E9', - scpolint: '\u2A13', - scsim: '\u227F', - Scy: '\u0421', - scy: '\u0441', - sdot: '\u22C5', - sdotb: '\u22A1', - sdote: '\u2A66', - searhk: '\u2925', - seArr: '\u21D8', - searr: '\u2198', - searrow: '\u2198', - sect: '\u00A7', - semi: '\u003B', - seswar: '\u2929', - setminus: '\u2216', - setmn: '\u2216', - sext: '\u2736', - Sfr: '\uD835\uDD16', - sfr: '\uD835\uDD30', - sfrown: '\u2322', - sharp: '\u266F', - SHCHcy: '\u0429', - shchcy: '\u0449', - SHcy: '\u0428', - shcy: '\u0448', - ShortDownArrow: '\u2193', - ShortLeftArrow: '\u2190', - shortmid: '\u2223', - shortparallel: '\u2225', - ShortRightArrow: '\u2192', - ShortUpArrow: '\u2191', - shy: '\u00AD', - Sigma: '\u03A3', - 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', - SmallCircle: '\u2218', - smallsetminus: '\u2216', - smashp: '\u2A33', - smeparsl: '\u29E4', - smid: '\u2223', - smile: '\u2323', - smt: '\u2AAA', - smte: '\u2AAC', - smtes: '\u2AAC\uFE00', - SOFTcy: '\u042C', - softcy: '\u044C', - sol: '\u002F', - solb: '\u29C4', - solbar: '\u233F', - Sopf: '\uD835\uDD4A', - sopf: '\uD835\uDD64', - spades: '\u2660', - spadesuit: '\u2660', - spar: '\u2225', - sqcap: '\u2293', - sqcaps: '\u2293\uFE00', - sqcup: '\u2294', - sqcups: '\u2294\uFE00', - Sqrt: '\u221A', - sqsub: '\u228F', - sqsube: '\u2291', - sqsubset: '\u228F', - sqsubseteq: '\u2291', - sqsup: '\u2290', - sqsupe: '\u2292', - sqsupset: '\u2290', - sqsupseteq: '\u2292', - squ: '\u25A1', - Square: '\u25A1', - square: '\u25A1', - SquareIntersection: '\u2293', - SquareSubset: '\u228F', - SquareSubsetEqual: '\u2291', - SquareSuperset: '\u2290', - SquareSupersetEqual: '\u2292', - SquareUnion: '\u2294', - squarf: '\u25AA', - squf: '\u25AA', - srarr: '\u2192', - Sscr: '\uD835\uDCAE', - sscr: '\uD835\uDCC8', - ssetmn: '\u2216', - ssmile: '\u2323', - sstarf: '\u22C6', - Star: '\u22C6', - star: '\u2606', - starf: '\u2605', - straightepsilon: '\u03F5', - straightphi: '\u03D5', - strns: '\u00AF', - Sub: '\u22D0', - sub: '\u2282', - subdot: '\u2ABD', - subE: '\u2AC5', - sube: '\u2286', - subedot: '\u2AC3', - submult: '\u2AC1', - subnE: '\u2ACB', - subne: '\u228A', - subplus: '\u2ABF', - subrarr: '\u2979', - Subset: '\u22D0', - subset: '\u2282', - subseteq: '\u2286', - subseteqq: '\u2AC5', - SubsetEqual: '\u2286', - subsetneq: '\u228A', - subsetneqq: '\u2ACB', - subsim: '\u2AC7', - subsub: '\u2AD5', - subsup: '\u2AD3', - succ: '\u227B', - succapprox: '\u2AB8', - succcurlyeq: '\u227D', - Succeeds: '\u227B', - SucceedsEqual: '\u2AB0', - SucceedsSlantEqual: '\u227D', - SucceedsTilde: '\u227F', - succeq: '\u2AB0', - succnapprox: '\u2ABA', - succneqq: '\u2AB6', - succnsim: '\u22E9', - succsim: '\u227F', - SuchThat: '\u220B', - Sum: '\u2211', - sum: '\u2211', - sung: '\u266A', - Sup: '\u22D1', - sup: '\u2283', - sup1: '\u00B9', - sup2: '\u00B2', - sup3: '\u00B3', - supdot: '\u2ABE', - supdsub: '\u2AD8', - supE: '\u2AC6', - supe: '\u2287', - supedot: '\u2AC4', - Superset: '\u2283', - SupersetEqual: '\u2287', - suphsol: '\u27C9', - suphsub: '\u2AD7', - suplarr: '\u297B', - supmult: '\u2AC2', - supnE: '\u2ACC', - supne: '\u228B', - supplus: '\u2AC0', - Supset: '\u22D1', - supset: '\u2283', - supseteq: '\u2287', - supseteqq: '\u2AC6', - supsetneq: '\u228B', - supsetneqq: '\u2ACC', - supsim: '\u2AC8', - supsub: '\u2AD4', - supsup: '\u2AD6', - swarhk: '\u2926', - swArr: '\u21D9', - swarr: '\u2199', - swarrow: '\u2199', - swnwar: '\u292A', - szlig: '\u00DF', - Tab: '\u0009', - target: '\u2316', - Tau: '\u03A4', - tau: '\u03C4', - tbrk: '\u23B4', - Tcaron: '\u0164', - tcaron: '\u0165', - Tcedil: '\u0162', - tcedil: '\u0163', - Tcy: '\u0422', - tcy: '\u0442', - tdot: '\u20DB', - telrec: '\u2315', - Tfr: '\uD835\uDD17', - tfr: '\uD835\uDD31', - there4: '\u2234', - Therefore: '\u2234', - therefore: '\u2234', - Theta: '\u0398', - theta: '\u03B8', - thetasym: '\u03D1', - thetav: '\u03D1', - thickapprox: '\u2248', - thicksim: '\u223C', - ThickSpace: '\u205F\u200A', - thinsp: '\u2009', - ThinSpace: '\u2009', - thkap: '\u2248', - thksim: '\u223C', - THORN: '\u00DE', - thorn: '\u00FE', - Tilde: '\u223C', - tilde: '\u02DC', - TildeEqual: '\u2243', - TildeFullEqual: '\u2245', - TildeTilde: '\u2248', - times: '\u00D7', - timesb: '\u22A0', - timesbar: '\u2A31', - timesd: '\u2A30', - tint: '\u222D', - toea: '\u2928', - top: '\u22A4', - topbot: '\u2336', - topcir: '\u2AF1', - Topf: '\uD835\uDD4B', - topf: '\uD835\uDD65', - topfork: '\u2ADA', - tosa: '\u2929', - tprime: '\u2034', - TRADE: '\u2122', - trade: '\u2122', - triangle: '\u25B5', - triangledown: '\u25BF', - triangleleft: '\u25C3', - trianglelefteq: '\u22B4', - triangleq: '\u225C', - triangleright: '\u25B9', - trianglerighteq: '\u22B5', - tridot: '\u25EC', - trie: '\u225C', - triminus: '\u2A3A', - TripleDot: '\u20DB', - triplus: '\u2A39', - trisb: '\u29CD', - tritime: '\u2A3B', - trpezium: '\u23E2', - Tscr: '\uD835\uDCAF', - tscr: '\uD835\uDCC9', - TScy: '\u0426', - tscy: '\u0446', - TSHcy: '\u040B', - tshcy: '\u045B', - Tstrok: '\u0166', - tstrok: '\u0167', - twixt: '\u226C', - twoheadleftarrow: '\u219E', - twoheadrightarrow: '\u21A0', - Uacute: '\u00DA', - uacute: '\u00FA', - Uarr: '\u219F', - uArr: '\u21D1', - uarr: '\u2191', - Uarrocir: '\u2949', - Ubrcy: '\u040E', - ubrcy: '\u045E', - Ubreve: '\u016C', - ubreve: '\u016D', - Ucirc: '\u00DB', - ucirc: '\u00FB', - Ucy: '\u0423', - ucy: '\u0443', - udarr: '\u21C5', - Udblac: '\u0170', - udblac: '\u0171', - udhar: '\u296E', - ufisht: '\u297E', - Ufr: '\uD835\uDD18', - ufr: '\uD835\uDD32', - Ugrave: '\u00D9', - ugrave: '\u00F9', - uHar: '\u2963', - uharl: '\u21BF', - uharr: '\u21BE', - uhblk: '\u2580', - ulcorn: '\u231C', - ulcorner: '\u231C', - ulcrop: '\u230F', - ultri: '\u25F8', - Umacr: '\u016A', - umacr: '\u016B', - uml: '\u00A8', - UnderBar: '\u005F', - UnderBrace: '\u23DF', - UnderBracket: '\u23B5', - UnderParenthesis: '\u23DD', - Union: '\u22C3', - UnionPlus: '\u228E', - Uogon: '\u0172', - uogon: '\u0173', - Uopf: '\uD835\uDD4C', - uopf: '\uD835\uDD66', - UpArrow: '\u2191', - Uparrow: '\u21D1', - uparrow: '\u2191', - UpArrowBar: '\u2912', - UpArrowDownArrow: '\u21C5', - UpDownArrow: '\u2195', - Updownarrow: '\u21D5', - updownarrow: '\u2195', - UpEquilibrium: '\u296E', - upharpoonleft: '\u21BF', - upharpoonright: '\u21BE', - uplus: '\u228E', - UpperLeftArrow: '\u2196', - UpperRightArrow: '\u2197', - Upsi: '\u03D2', - upsi: '\u03C5', - upsih: '\u03D2', - Upsilon: '\u03A5', - upsilon: '\u03C5', - UpTee: '\u22A5', - UpTeeArrow: '\u21A5', - upuparrows: '\u21C8', - urcorn: '\u231D', - urcorner: '\u231D', - urcrop: '\u230E', - Uring: '\u016E', - uring: '\u016F', - urtri: '\u25F9', - Uscr: '\uD835\uDCB0', - uscr: '\uD835\uDCCA', - utdot: '\u22F0', - Utilde: '\u0168', - utilde: '\u0169', - utri: '\u25B5', - utrif: '\u25B4', - uuarr: '\u21C8', - Uuml: '\u00DC', - uuml: '\u00FC', - uwangle: '\u29A7', - vangrt: '\u299C', - varepsilon: '\u03F5', - varkappa: '\u03F0', - varnothing: '\u2205', - varphi: '\u03D5', - varpi: '\u03D6', - varpropto: '\u221D', - vArr: '\u21D5', - varr: '\u2195', - varrho: '\u03F1', - varsigma: '\u03C2', - varsubsetneq: '\u228A\uFE00', - varsubsetneqq: '\u2ACB\uFE00', - varsupsetneq: '\u228B\uFE00', - varsupsetneqq: '\u2ACC\uFE00', - vartheta: '\u03D1', - vartriangleleft: '\u22B2', - vartriangleright: '\u22B3', - Vbar: '\u2AEB', - vBar: '\u2AE8', - vBarv: '\u2AE9', - Vcy: '\u0412', - vcy: '\u0432', - VDash: '\u22AB', - Vdash: '\u22A9', - vDash: '\u22A8', - vdash: '\u22A2', - Vdashl: '\u2AE6', - Vee: '\u22C1', - vee: '\u2228', - veebar: '\u22BB', - veeeq: '\u225A', - vellip: '\u22EE', - Verbar: '\u2016', - verbar: '\u007C', - Vert: '\u2016', - vert: '\u007C', - VerticalBar: '\u2223', - VerticalLine: '\u007C', - VerticalSeparator: '\u2758', - VerticalTilde: '\u2240', - VeryThinSpace: '\u200A', - Vfr: '\uD835\uDD19', - vfr: '\uD835\uDD33', - vltri: '\u22B2', - vnsub: '\u2282\u20D2', - vnsup: '\u2283\u20D2', - Vopf: '\uD835\uDD4D', - vopf: '\uD835\uDD67', - vprop: '\u221D', - vrtri: '\u22B3', - Vscr: '\uD835\uDCB1', - vscr: '\uD835\uDCCB', - vsubnE: '\u2ACB\uFE00', - vsubne: '\u228A\uFE00', - vsupnE: '\u2ACC\uFE00', - vsupne: '\u228B\uFE00', - Vvdash: '\u22AA', - vzigzag: '\u299A', - Wcirc: '\u0174', - wcirc: '\u0175', - wedbar: '\u2A5F', - Wedge: '\u22C0', - wedge: '\u2227', - wedgeq: '\u2259', - weierp: '\u2118', - Wfr: '\uD835\uDD1A', - wfr: '\uD835\uDD34', - Wopf: '\uD835\uDD4E', - wopf: '\uD835\uDD68', - wp: '\u2118', - wr: '\u2240', - wreath: '\u2240', - Wscr: '\uD835\uDCB2', - wscr: '\uD835\uDCCC', - xcap: '\u22C2', - xcirc: '\u25EF', - xcup: '\u22C3', - xdtri: '\u25BD', - Xfr: '\uD835\uDD1B', - xfr: '\uD835\uDD35', - xhArr: '\u27FA', - xharr: '\u27F7', - Xi: '\u039E', - xi: '\u03BE', - xlArr: '\u27F8', - xlarr: '\u27F5', - xmap: '\u27FC', - xnis: '\u22FB', - xodot: '\u2A00', - Xopf: '\uD835\uDD4F', - xopf: '\uD835\uDD69', - xoplus: '\u2A01', - xotime: '\u2A02', - xrArr: '\u27F9', - xrarr: '\u27F6', - Xscr: '\uD835\uDCB3', - xscr: '\uD835\uDCCD', - xsqcup: '\u2A06', - xuplus: '\u2A04', - xutri: '\u25B3', - xvee: '\u22C1', - xwedge: '\u22C0', - Yacute: '\u00DD', - yacute: '\u00FD', - YAcy: '\u042F', - yacy: '\u044F', - Ycirc: '\u0176', - ycirc: '\u0177', - Ycy: '\u042B', - ycy: '\u044B', - yen: '\u00A5', - Yfr: '\uD835\uDD1C', - yfr: '\uD835\uDD36', - YIcy: '\u0407', - yicy: '\u0457', - Yopf: '\uD835\uDD50', - yopf: '\uD835\uDD6A', - Yscr: '\uD835\uDCB4', - yscr: '\uD835\uDCCE', - YUcy: '\u042E', - yucy: '\u044E', - Yuml: '\u0178', - yuml: '\u00FF', - Zacute: '\u0179', - zacute: '\u017A', - Zcaron: '\u017D', - zcaron: '\u017E', - Zcy: '\u0417', - zcy: '\u0437', - Zdot: '\u017B', - zdot: '\u017C', - zeetrf: '\u2128', - ZeroWidthSpace: '\u200B', - Zeta: '\u0396', - zeta: '\u03B6', - Zfr: '\u2128', - zfr: '\uD835\uDD37', - ZHcy: '\u0416', - zhcy: '\u0436', - zigrarr: '\u21DD', - Zopf: '\u2124', - zopf: '\uD835\uDD6B', - Zscr: '\uD835\uDCB5', - zscr: '\uD835\uDCCF', - zwj: '\u200D', - zwnj: '\u200C', - }); - - /** - * @deprecated use `HTML_ENTITIES` instead - * @see HTML_ENTITIES - */ - exports.entityMap = exports.HTML_ENTITIES; - - - /***/ }), - - /***/ 11544: - /***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - var __webpack_unused_export__; - var dom = __webpack_require__(71855) - __webpack_unused_export__ = dom.DOMImplementation - __webpack_unused_export__ = dom.XMLSerializer - exports.DOMParser = __webpack_require__(40654).DOMParser - - - /***/ }), - - /***/ 13418: - /***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - var NAMESPACE = (__webpack_require__(16996).NAMESPACE); - - //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] - //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] - //[5] Name ::= NameStartChar (NameChar)* - var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF - var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); - var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); - //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ - //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') - - //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE - //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE - var S_TAG = 0;//tag name offerring - var S_ATTR = 1;//attr name offerring - var S_ATTR_SPACE=2;//attr name end and space offer - var S_EQ = 3;//=space? - var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only) - var S_ATTR_END = 5;//attr value end and no space(quot end) - var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer) - var S_TAG_CLOSE = 7;//closed el - - /** - * Creates an error that will not be caught by XMLReader aka the SAX parser. - * - * @param {string} message - * @param {any?} locator Optional, can provide details about the location in the source - * @constructor - */ - function ParseError(message, locator) { - this.message = message - this.locator = locator - if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError); - } - ParseError.prototype = new Error(); - ParseError.prototype.name = ParseError.name - - function XMLReader(){ - - } - - XMLReader.prototype = { - parse:function(source,defaultNSMap,entityMap){ - var domBuilder = this.domBuilder; - domBuilder.startDocument(); - _copy(defaultNSMap ,defaultNSMap = {}) - parse(source,defaultNSMap,entityMap, - domBuilder,this.errorHandler); - domBuilder.endDocument(); - } - } - function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ - function fixedFromCharCode(code) { - // String.prototype.fromCharCode does not supports - // > 2 bytes unicode chars directly - if (code > 0xffff) { - code -= 0x10000; - var surrogate1 = 0xd800 + (code >> 10) - , surrogate2 = 0xdc00 + (code & 0x3ff); - - return String.fromCharCode(surrogate1, surrogate2); - } else { - return String.fromCharCode(code); - } - } - function entityReplacer(a){ - var k = a.slice(1,-1); - if (Object.hasOwnProperty.call(entityMap, k)) { - return entityMap[k]; - }else if(k.charAt(0) === '#'){ - return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) - }else{ - errorHandler.error('entity not found:'+a); - return a; - } + var NodeError = /*#__PURE__*/function (_Base) { + _inherits(NodeError, _Base); + var _super = _createSuper(NodeError); + function NodeError(arg1, arg2, arg3) { + var _this; + _classCallCheck(this, NodeError); + _this = _super.call(this, getMessage(arg1, arg2, arg3)); + _this.code = code; + return _this; } - function appendText(end){//has some bugs - if(end>start){ - var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); - locator&&position(start); - domBuilder.characters(xt,0,end-start); - start = end - } - } - function position(p,m){ - while(p>=lineEnd && (m = linePattern.exec(source))){ - lineStart = m.index; - lineEnd = lineStart + m[0].length; - locator.lineNumber++; - //console.log('line++:',locator,startPos,endPos) - } - locator.columnNumber = p-lineStart+1; - } - var lineStart = 0; - var lineEnd = 0; - var linePattern = /.*(?:\r\n?|\n)|.*$/g - var locator = domBuilder.locator; - - var parseStack = [{currentNSMap:defaultNSMapCopy}] - var closeMap = {}; - var start = 0; - while(true){ - try{ - var tagStart = source.indexOf('<',start); - if(tagStart<0){ - if(!source.substr(start).match(/^\s*$/)){ - var doc = domBuilder.doc; - var text = doc.createTextNode(source.substr(start)); - doc.appendChild(text); - domBuilder.currentElement = text; - } - return; - } - if(tagStart>start){ - appendText(tagStart); - } - switch(source.charAt(tagStart+1)){ - case '/': - var end = source.indexOf('>',tagStart+3); - var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, ''); - var config = parseStack.pop(); - if(end<0){ - - tagName = source.substring(tagStart+2).replace(/[\s<].*/,''); - errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName); - end = tagStart+1+tagName.length; - }else if(tagName.match(/\s - locator&&position(tagStart); - end = parseInstruction(source,tagStart,domBuilder); - break; - case '!':// start){ - start = end; - }else{ - //TODO: 这里有可能sax回退,有位置错误风险 - appendText(Math.max(tagStart,start)+1); - } + return _createClass(NodeError); + }(Base); + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); } + } else { + return "of ".concat(thing, " ").concat(String(expected)); } - function copyLocator(f,t){ - t.lineNumber = f.lineNumber; - t.columnNumber = f.columnNumber; - return t; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; } - - /** - * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); - * @return end of the elementStartPart(end of elementEndPart for selfClosed el) - */ - function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){ - - /** - * @param {string} qname - * @param {string} value - * @param {number} startIndex - */ - function addAttribute(qname, value, startIndex) { - if (el.attributeNames.hasOwnProperty(qname)) { - errorHandler.fatalError('Attribute ' + qname + ' redefined') - } - el.addValue( - qname, - // @see https://www.w3.org/TR/xml/#AVNormalize - // since the xmldom sax parser does not "interpret" DTD the following is not implemented: - // - recursive replacement of (DTD) entity references - // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA - value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityReplacer), - startIndex - ) - } - var attrName; - var value; - var p = ++start; - var s = S_TAG;//status - while(true){ - var c = source.charAt(p); - switch(c){ - case '=': - if(s === S_ATTR){//attrName - attrName = source.slice(start,p); - s = S_EQ; - }else if(s === S_ATTR_SPACE){ - s = S_EQ; - }else{ - //fatalError: equal must after attrName or space after attrName - throw new Error('attribute equal must after attrName'); // No known test case - } - break; - case '\'': - case '"': - if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE - ){//equal - if(s === S_ATTR){ - errorHandler.warning('attribute value must after "="') - attrName = source.slice(start,p) - } - start = p+1; - p = source.indexOf(c,start) - if(p>0){ - value = source.slice(start, p); - addAttribute(attrName, value, start-1); - s = S_ATTR_END; - }else{ - //fatalError: no end quot match - throw new Error('attribute value no end \''+c+'\' match'); - } - }else if(s == S_ATTR_NOQUOT_VALUE){ - value = source.slice(start, p); - addAttribute(attrName, value, start); - errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); - start = p+1; - s = S_ATTR_END - }else{ - //fatalError: no equal before - throw new Error('attribute value must after "="'); // No known test case - } - break; - case '/': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - s =S_TAG_CLOSE; - el.closed = true; - case S_ATTR_NOQUOT_VALUE: - case S_ATTR: - break; - case S_ATTR_SPACE: - el.closed = true; - break; - //case S_EQ: - default: - throw new Error("attribute invalid close char('/')") // No known test case - } - break; - case ''://end document - errorHandler.error('unexpected end of input'); - if(s == S_TAG){ - el.setTagName(source.slice(start,p)); - } - return p; - case '>': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_ATTR_END: - case S_TAG_SPACE: - case S_TAG_CLOSE: - break;//normal - case S_ATTR_NOQUOT_VALUE://Compatible state - case S_ATTR: - value = source.slice(start,p); - if(value.slice(-1) === '/'){ - el.closed = true; - value = value.slice(0,-1) - } - case S_ATTR_SPACE: - if(s === S_ATTR_SPACE){ - value = attrName; - } - if(s == S_ATTR_NOQUOT_VALUE){ - errorHandler.warning('attribute "'+value+'" missed quot(")!'); - addAttribute(attrName, value, start) - }else{ - if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){ - errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') - } - addAttribute(value, value, start) - } - break; - case S_EQ: - throw new Error('attribute value missed!!'); - } - // console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) - return p; - /*xml space '\x20' | #x9 | #xD | #xA; */ - case '\u0080': - c = ' '; - default: - if(c<= ' '){//space - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p));//tagName - s = S_TAG_SPACE; - break; - case S_ATTR: - attrName = source.slice(start,p) - s = S_ATTR_SPACE; - break; - case S_ATTR_NOQUOT_VALUE: - var value = source.slice(start, p); - errorHandler.warning('attribute "'+value+'" missed quot(")!!'); - addAttribute(attrName, value, start) - case S_ATTR_END: - s = S_TAG_SPACE; - break; - //case S_TAG_SPACE: - //case S_EQ: - //case S_ATTR_SPACE: - // void();break; - //case S_TAG_CLOSE: - //ignore warning - } - }else{//not space - //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE - //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE - switch(s){ - //case S_TAG:void();break; - //case S_ATTR:void();break; - //case S_ATTR_NOQUOT_VALUE:void();break; - case S_ATTR_SPACE: - var tagName = el.tagName; - if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) { - errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!') - } - addAttribute(attrName, attrName, start); - start = p; - s = S_ATTR; - break; - case S_ATTR_END: - errorHandler.warning('attribute space is required"'+attrName+'"!!') - case S_TAG_SPACE: - s = S_ATTR; - start = p; - break; - case S_EQ: - s = S_ATTR_NOQUOT_VALUE; - start = p; - break; - case S_TAG_CLOSE: - throw new Error("elements closed character '/' and '>' must be connected to"); - } - } - }//end outer switch - //console.log('p++',p) - p++; - } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; } - /** - * @return true if has new namespace define - */ - function appendElement(el,domBuilder,currentNSMap){ - var tagName = el.tagName; - var localNSMap = null; - //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; - var i = el.length; - while(i--){ - var a = el[i]; - var qName = a.qName; - var value = a.value; - var nsp = qName.indexOf(':'); - if(nsp>0){ - var prefix = a.prefix = qName.slice(0,nsp); - var localName = qName.slice(nsp+1); - var nsPrefix = prefix === 'xmlns' && localName - }else{ - localName = qName; - prefix = null - nsPrefix = qName === 'xmlns' && '' - } - //can not set prefix,because prefix !== '' - a.localName = localName ; - //prefix == null for no ns prefix attribute - if(nsPrefix !== false){//hack!! - if(localNSMap == null){ - localNSMap = {} - //console.log(currentNSMap,0) - _copy(currentNSMap,currentNSMap={}) - //console.log(currentNSMap,1) - } - currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; - a.uri = NAMESPACE.XMLNS - domBuilder.startPrefixMapping(nsPrefix, value) - } - } - var i = el.length; - while(i--){ - a = el[i]; - var prefix = a.prefix; - if(prefix){//no prefix attribute has no namespace - if(prefix === 'xml'){ - a.uri = NAMESPACE.XML; - }if(prefix !== 'xmlns'){ - a.uri = currentNSMap[prefix || ''] - - //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} - } - } - } - var nsp = tagName.indexOf(':'); - if(nsp>0){ - prefix = el.prefix = tagName.slice(0,nsp); - localName = el.localName = tagName.slice(nsp+1); - }else{ - prefix = null;//important!! - localName = el.localName = tagName; - } - //no prefix element has default namespace - var ns = el.uri = currentNSMap[prefix || '']; - domBuilder.startElement(ns,localName,tagName,el); - //endPrefixMapping and startPrefixMapping have not any help for dom builder - //localNSMap = null - if(el.closed){ - domBuilder.endElement(ns,localName,tagName); - if(localNSMap){ - for (prefix in localNSMap) { - if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) { - domBuilder.endPrefixMapping(prefix); - } - } - } - }else{ - el.currentNSMap = currentNSMap; - el.localNSMap = localNSMap; - //parseStack.push(el); - return true; - } + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; } - function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ - if(/^(?:script|textarea)$/i.test(tagName)){ - var elEndStart = source.indexOf('',elStartEnd); - var text = source.substring(elStartEnd+1,elEndStart); - if(/[&<]/.test(text)){ - if(/^script$/i.test(tagName)){ - //if(!/\]\]>/.test(text)){ - //lexHandler.startCDATA(); - domBuilder.characters(text,0,text.length); - //lexHandler.endCDATA(); - return elEndStart; - //} - }//}else{//text area - text = text.replace(/&#?\w+;/g,entityReplacer); - domBuilder.characters(text,0,text.length); - return elEndStart; - //} - - } - } - return elStartEnd+1; - } - function fixSelfClosed(source,elStartEnd,tagName,closeMap){ - //if(tagName in closeMap){ - var pos = closeMap[tagName]; - if(pos == null){ - //console.log(tagName) - pos = source.lastIndexOf('') - if(pos',start+4); - //append comment source.substring(4,end)//"; +} + + +/***/ }), + +/***/ 45119: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0; +var entities_json_1 = __importDefault(__webpack_require__(91363)); +var legacy_json_1 = __importDefault(__webpack_require__(28611)); +var xml_json_1 = __importDefault(__webpack_require__(94204)); +var decode_codepoint_1 = __importDefault(__webpack_require__(79362)); +var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; +exports.decodeXML = getStrictDecoder(xml_json_1.default); +exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); +function getStrictDecoder(map) { + var replace = getReplacer(map); + return function (str) { return String(str).replace(strictEntityRe, replace); }; +} +var sorter = function (a, b) { return (a < b ? 1 : -1); }; +exports.decodeHTML = (function () { + var legacy = Object.keys(legacy_json_1.default).sort(sorter); + var keys = Object.keys(entities_json_1.default).sort(sorter); + for (var i = 0, j = 0; i < keys.length; i++) { + if (legacy[j] === keys[i]) { + keys[i] += ";?"; + j++; } - - namespaces = split[i].replace(/\*/g, '.*?'); - - if (namespaces[0] === '-') { - createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); - } else { - createDebug.names.push(new RegExp('^' + namespaces + '$')); + else { + keys[i] += ";"; + } + } + var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); + var replace = getReplacer(entities_json_1.default); + function replacer(str) { + if (str.substr(-1) !== ";") + str += ";"; + return replace(str); + } + // TODO consider creating a merged map + return function (str) { return String(str).replace(re, replacer); }; +})(); +function getReplacer(map) { + return function replace(str) { + if (str.charAt(1) === "#") { + var secondChar = str.charAt(2); + if (secondChar === "X" || secondChar === "x") { + return decode_codepoint_1.default(parseInt(str.substr(3), 16)); + } + return decode_codepoint_1.default(parseInt(str.substr(2), 10)); } - } + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + return map[str.slice(1, -1)] || str; + }; +} + + +/***/ }), + +/***/ 79362: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +var decode_json_1 = __importDefault(__webpack_require__(39451)); +// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 +var fromCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.fromCodePoint || + function (codePoint) { + var output = ""; + if (codePoint > 0xffff) { + codePoint -= 0x10000; + output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); + codePoint = 0xdc00 | (codePoint & 0x3ff); + } + output += String.fromCharCode(codePoint); + return output; + }; +function decodeCodePoint(codePoint) { + if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { + return "\uFFFD"; + } + if (codePoint in decode_json_1.default) { + codePoint = decode_json_1.default[codePoint]; + } + return fromCodePoint(codePoint); +} +exports["default"] = decodeCodePoint; + + +/***/ }), + +/***/ 9049: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0; +var xml_json_1 = __importDefault(__webpack_require__(94204)); +var inverseXML = getInverseObj(xml_json_1.default); +var xmlReplacer = getInverseReplacer(inverseXML); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using XML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeXML = getASCIIEncoder(inverseXML); +var entities_json_1 = __importDefault(__webpack_require__(91363)); +var inverseHTML = getInverseObj(entities_json_1.default); +var htmlReplacer = getInverseReplacer(inverseHTML); +/** + * Encodes all entities and non-ASCII characters in the input. + * + * This includes characters that are valid ASCII characters in HTML documents. + * For example `#` will be encoded as `#`. To get a more compact output, + * consider using the `encodeNonAsciiHTML` function. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeHTML = getInverse(inverseHTML, htmlReplacer); +/** + * Encodes all non-ASCII characters, as well as characters not valid in HTML + * documents using HTML entities. + * + * If a character has no equivalent entity, a + * numeric hexadecimal reference (eg. `ü`) will be used. + */ +exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); +function getInverseObj(obj) { + return Object.keys(obj) + .sort() + .reduce(function (inverse, name) { + inverse[obj[name]] = "&" + name + ";"; + return inverse; + }, {}); +} +function getInverseReplacer(inverse) { + var single = []; + var multiple = []; + for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { + var k = _a[_i]; + if (k.length === 1) { + // Add value to single array + single.push("\\" + k); + } + else { + // Add value to multiple array + multiple.push(k); + } + } + // Add ranges to single characters. + single.sort(); + for (var start = 0; start < single.length - 1; start++) { + // Find the end of a run of characters + var end = start; + while (end < single.length - 1 && + single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { + end += 1; + } + var count = 1 + end - start; + // We want to replace at least three characters + if (count < 3) + continue; + single.splice(start, count, single[start] + "-" + single[end]); + } + multiple.unshift("[" + single.join("") + "]"); + return new RegExp(multiple.join("|"), "g"); +} +// /[^\0-\x7F]/gu +var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; +var getCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition +String.prototype.codePointAt != null + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + function (str) { return str.codePointAt(0); } + : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function (c) { + return (c.charCodeAt(0) - 0xd800) * 0x400 + + c.charCodeAt(1) - + 0xdc00 + + 0x10000; + }; +function singleCharReplacer(c) { + return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)) + .toString(16) + .toUpperCase() + ";"; +} +function getInverse(inverse, re) { + return function (data) { + return data + .replace(re, function (name) { return inverse[name]; }) + .replace(reNonASCII, singleCharReplacer); + }; +} +var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); +/** + * Encodes all non-ASCII characters, as well as characters not valid in XML + * documents using numeric hexadecimal reference (eg. `ü`). + * + * Have a look at `escapeUTF8` if you want a more concise output at the expense + * of reduced transportability. + * + * @param data String to escape. + */ +function escape(data) { + return data.replace(reEscapeChars, singleCharReplacer); +} +exports.escape = escape; +/** + * Encodes all characters not valid in XML documents using numeric hexadecimal + * reference (eg. `ü`). + * + * Note that the output will be character-set dependent. + * + * @param data String to escape. + */ +function escapeUTF8(data) { + return data.replace(xmlReplacer, singleCharReplacer); +} +exports.escapeUTF8 = escapeUTF8; +function getASCIIEncoder(obj) { + return function (data) { + return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); }); + }; +} + + +/***/ }), + +/***/ 39526: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0; +var decode_1 = __webpack_require__(45119); +var encode_1 = __webpack_require__(9049); +/** + * Decodes a string with entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeXML` or `decodeHTML` directly. + */ +function decode(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); +} +exports.decode = decode; +/** + * Decodes a string with entities. Does not allow missing trailing semicolons for entities. + * + * @param data String to decode. + * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. + */ +function decodeStrict(data, level) { + return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); +} +exports.decodeStrict = decodeStrict; +/** + * Encodes a string with entities. + * + * @param data String to encode. + * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. + * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + */ +function encode(data, level) { + return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); +} +exports.encode = encode; +var encode_2 = __webpack_require__(9049); +Object.defineProperty(exports, "encodeXML", ({ enumerable: true, get: function () { return encode_2.encodeXML; } })); +Object.defineProperty(exports, "encodeHTML", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +Object.defineProperty(exports, "encodeNonAsciiHTML", ({ enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } })); +Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return encode_2.escape; } })); +Object.defineProperty(exports, "escapeUTF8", ({ enumerable: true, get: function () { return encode_2.escapeUTF8; } })); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "encodeHTML4", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +Object.defineProperty(exports, "encodeHTML5", ({ enumerable: true, get: function () { return encode_2.encodeHTML; } })); +var decode_2 = __webpack_require__(45119); +Object.defineProperty(exports, "decodeXML", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); +Object.defineProperty(exports, "decodeHTML", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +// Legacy aliases (deprecated) +Object.defineProperty(exports, "decodeHTML4", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTML5", ({ enumerable: true, get: function () { return decode_2.decodeHTML; } })); +Object.defineProperty(exports, "decodeHTML4Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +Object.defineProperty(exports, "decodeHTML5Strict", ({ enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } })); +Object.defineProperty(exports, "decodeXMLStrict", ({ enumerable: true, get: function () { return decode_2.decodeXML; } })); + + +/***/ }), + +/***/ 49293: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0; +/** Types of elements found in htmlparser2's DOM */ +var ElementType; +(function (ElementType) { + /** Type for the root element of a document */ + ElementType["Root"] = "root"; + /** Type for Text */ + ElementType["Text"] = "text"; + /** Type for */ + ElementType["Directive"] = "directive"; + /** Type for */ + ElementType["Comment"] = "comment"; + /** Type for